From: Mario Date: Wed, 5 Aug 2015 13:07:22 +0000 (+1000) Subject: Merge branch 'master' into Mario/buff_updates X-Git-Tag: xonotic-v0.8.1~18^2~1 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=0e11fe379dc3d256b0041886893a0e35b70c86d9 Merge branch 'master' into Mario/buff_updates # Conflicts: # _hud_descriptions.cfg # hud_luma.cfg # hud_luminos.cfg # hud_luminos_minimal.cfg # hud_luminos_minimal_xhair.cfg # hud_luminos_old.cfg # hud_nexuiz.cfg # qcsrc/client/hud.qc # qcsrc/client/hud.qh --- 0e11fe379dc3d256b0041886893a0e35b70c86d9 diff --cc _hud_descriptions.cfg index ec8ef05741,7657bddc8b..01c768aec9 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@@ -300,3 -304,23 +300,13 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "" "minimum factor that the second pass can fade to" seta hud_panel_centerprint_fade_subsequent_minfontsize "" "minimum factor for the font size from the subsequent fading effects" seta hud_panel_centerprint_fade_minfontsize "" "minimum factor for the font size from the fading in/out effects" + -seta hud_panel_buffs "" "enable/disable this panel" -seta hud_panel_buffs_pos "" "position of this panel" -seta hud_panel_buffs_size "" "size of this panel" -seta hud_panel_buffs_bg "" "if set to something else than \"\" = override default background" -seta hud_panel_buffs_bg_color "" "if set to something else than \"\" = override default panel background color" -seta hud_panel_buffs_bg_color_team "" "override panel color with team color in team based games" -seta hud_panel_buffs_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" -seta hud_panel_buffs_bg_border "" "if set to something else than \"\" = override default size of border around the background" -seta hud_panel_buffs_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" - + seta hud_panel_mapvote "" "enable/disable this panel" + seta hud_panel_mapvote_pos "" "position of this panel" + seta hud_panel_mapvote_size "" "size of this panel" + seta hud_panel_mapvote_bg "" "if set to something else than \"\" = override default background" + seta hud_panel_mapvote_bg_color "" "if set to something else than \"\" = override default panel background color" + seta hud_panel_mapvote_bg_color_team "" "override panel color with team color in team based games" + seta hud_panel_mapvote_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" + seta hud_panel_mapvote_bg_border "" "if set to something else than \"\" = override default size of border around the background" + seta hud_panel_mapvote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" diff --cc hud_luma.cfg index b63bb4fdf0,e6312c1ac9..2ff915b472 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.325000 0.820000" -seta hud_panel_buffs_size "0.350000 0.050000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "border_default" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc hud_luminos.cfg index 362b19af2a,56f696f3e6..641333a155 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.450000 0.855000" -seta hud_panel_buffs_size "0.050000 0.070000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "0" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc hud_luminos_minimal.cfg index 213cecc771,e5829e0355..75a74fae44 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.450000 0.855000" -seta hud_panel_buffs_size "0.050000 0.070000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "0" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc hud_luminos_minimal_xhair.cfg index b58c47b05c,126d22310c..ead25b0a26 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.450000 0.855000" -seta hud_panel_buffs_size "0.050000 0.070000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "0" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc hud_luminos_old.cfg index 33149cea69,aed07d9cef..162b9a3204 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.450000 0.855000" -seta hud_panel_buffs_size "0.050000 0.070000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "0" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc hud_nexuiz.cfg index b30d5729a0,d950703f92..66bfa69009 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@@ -299,4 -303,24 +299,14 @@@ seta hud_panel_centerprint_fade_subsequ seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75" seta hud_panel_centerprint_fade_minfontsize "0" -seta hud_panel_buffs 1 -seta hud_panel_buffs_pos "0.450000 0.855000" -seta hud_panel_buffs_size "0.050000 0.070000" -seta hud_panel_buffs_bg "0" -seta hud_panel_buffs_bg_color "" -seta hud_panel_buffs_bg_color_team "" -seta hud_panel_buffs_bg_alpha "" -seta hud_panel_buffs_bg_border "" -seta hud_panel_buffs_bg_padding "" - + seta hud_panel_mapvote 1 + seta hud_panel_mapvote_pos "0 0" + seta hud_panel_mapvote_size "1 1" + seta hud_panel_mapvote_bg "0" + seta hud_panel_mapvote_bg_color "" + seta hud_panel_mapvote_bg_color_team "" + seta hud_panel_mapvote_bg_alpha "" + seta hud_panel_mapvote_bg_border "" + seta hud_panel_mapvote_bg_padding "" + menu_sync diff --cc qcsrc/client/hud.qc index 9e678343b4,511391b000..9019afc18f --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -1301,68 -1303,10 +1303,70 @@@ void DrawNumIcon(vector myPos, vector m // Powerups (#2) // + +// Powerup item fields (reusing existing fields) +.string message; // Human readable name +.string netname; // Icon name +.vector colormod; // Color +.float count; // Time left +.float lifetime; // Maximum time + +entity powerupItems; +int powerupItemsCount; + +void resetPowerupItems() +{ + entity item; + for(item = powerupItems; item; item = item.chain) + item.count = 0; + + powerupItemsCount = 0; +} + +void addPowerupItem(string name, string icon, vector color, float currentTime, float lifeTime) +{ + if(!powerupItems) + powerupItems = spawn(); + + entity item; + for(item = powerupItems; item.count; item = item.chain) + if(!item.chain) + item.chain = spawn(); + + item.message = name; + item.netname = icon; + item.colormod = color; + item.count = currentTime; + item.lifetime = lifeTime; + + ++powerupItemsCount; +} + +int getPowerupItemAlign(int align, int column, int row, int columns, int rows, bool isVertical) +{ + if(align < 2) + return align; + + bool isTop = isVertical && rows > 1 && row == 0; + bool isBottom = isVertical && rows > 1 && row == rows-1; + bool isLeft = !isVertical && columns > 1 && column == 0; + bool isRight = !isVertical && columns > 1 && column == columns-1; + + if(isTop || isLeft) return (align == 2) ? 1 : 0; + if(isBottom || isRight) return (align == 2) ? 0 : 1; + + return 2; +} + void HUD_Powerups(void) { - float strength_time, shield_time, superweapons_time; + if(intermission == 2) return; ++ + int allItems = getstati(STAT_ITEMS, 0, 24); + int allBuffs = getstati(STAT_BUFFS, 0, 24); + int strengthTime, shieldTime, superTime; + + // Initialize items if(!autocvar__hud_configure) { if(!autocvar_hud_panel_powerups) return; @@@ -4578,7 -4582,67 +4604,6 @@@ void HUD_CenterPrint (void } } -// Buffs (#18) -// -void HUD_Buffs(void) -{ - if(intermission == 2) return; - int buffs = getstati(STAT_BUFFS, 0, 24); - if(!autocvar__hud_configure) - { - if(!autocvar_hud_panel_buffs) return; - if(spectatee_status == -1) return; - if(getstati(STAT_HEALTH) <= 0) return; - if(!buffs) return; - } - else - { - buffs = Buff_Type_first.items; // force first buff - } - - int b = 0; // counter to tell other functions that we have buffs - entity e; - string s = ""; - for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items) - { - ++b; - string o = strcat(rgb_to_hexcolor(Buff_Color(e.items)), Buff_PrettyName(e.items)); - if(s == "") - s = o; - else - s = strcat(s, " ", o); - } - - HUD_Panel_UpdateCvars(); - - draw_beginBoldFont(); - - vector pos, mySize; - pos = panel_pos; - mySize = panel_size; - - HUD_Panel_DrawBg(bound(0, b, 1)); - if(panel_bg_padding) - { - pos += '1 1 0' * panel_bg_padding; - mySize -= '2 2 0' * panel_bg_padding; - } - - //float panel_ar = mySize_x/mySize_y; - //bool is_vertical = (panel_ar < 1); - //float buff_iconalign = autocvar_hud_panel_buffs_iconalign; - vector buff_offset = '0 0 0'; - - for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items) - { - //DrawNumIcon(pos + buff_offset, mySize, shield, "shield", is_vertical, buff_iconalign, '1 1 1', 1); - drawcolorcodedstring_aspect(pos + buff_offset, s, mySize, panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); - } - - draw_endBoldFont(); -} - -- /* ================== Main HUD system diff --cc qcsrc/client/hud.qh index cdbe2cb41c,8e0b965860..894066028f --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@@ -137,24 -142,27 +142,26 @@@ float old_p_healthtime, old_p_armortime int prev_p_health, prev_p_armor; --#define HUD_PANELS(HUD_PANEL) \ -- HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \ -- HUD_PANEL(AMMO , HUD_Ammo , ammo) \ -- HUD_PANEL(POWERUPS , HUD_Powerups , powerups) \ -- HUD_PANEL(HEALTHARMOR , HUD_HealthArmor , healtharmor) \ -- HUD_PANEL(NOTIFY , HUD_Notify , notify) \ -- HUD_PANEL(TIMER , HUD_Timer , timer) \ -- HUD_PANEL(RADAR , HUD_Radar , radar) \ -- HUD_PANEL(SCORE , HUD_Score , score) \ -- HUD_PANEL(RACETIMER , HUD_RaceTimer , racetimer) \ -- HUD_PANEL(VOTE , HUD_Vote , vote) \ -- HUD_PANEL(MODICONS , HUD_ModIcons , modicons) \ -- HUD_PANEL(PRESSEDKEYS , HUD_PressedKeys , pressedkeys) \ -- HUD_PANEL(CHAT , HUD_Chat , chat) \ -- HUD_PANEL(ENGINEINFO , HUD_EngineInfo , engineinfo) \ -- HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \ -- HUD_PANEL(PHYSICS , HUD_Physics , physics) \ - HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint) - HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint) \ - HUD_PANEL(BUFFS , HUD_Buffs , buffs) \ ++#define HUD_PANELS(HUD_PANEL) \ ++ HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \ ++ HUD_PANEL(AMMO , HUD_Ammo , ammo) \ ++ HUD_PANEL(POWERUPS , HUD_Powerups , powerups) \ ++ HUD_PANEL(HEALTHARMOR , HUD_HealthArmor , healtharmor) \ ++ HUD_PANEL(NOTIFY , HUD_Notify , notify) \ ++ HUD_PANEL(TIMER , HUD_Timer , timer) \ ++ HUD_PANEL(RADAR , HUD_Radar , radar) \ ++ HUD_PANEL(SCORE , HUD_Score , score) \ ++ HUD_PANEL(RACETIMER , HUD_RaceTimer , racetimer) \ ++ HUD_PANEL(VOTE , HUD_Vote , vote) \ ++ HUD_PANEL(MODICONS , HUD_ModIcons , modicons) \ ++ HUD_PANEL(PRESSEDKEYS , HUD_PressedKeys , pressedkeys) \ ++ HUD_PANEL(CHAT , HUD_Chat , chat) \ ++ HUD_PANEL(ENGINEINFO , HUD_EngineInfo , engineinfo) \ ++ HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \ ++ HUD_PANEL(PHYSICS , HUD_Physics , physics) \ ++ HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint) \ + HUD_PANEL(MAPVOTE , MapVote_Draw , mapvote) \ + // always add new panels to the end of list #define HUD_PANEL(NAME, draw_func, name) \ int HUD_PANEL_##NAME; \