X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fpowerups.qc;h=076ce918f14723dcde2e755308a3f4379fb885e0;hb=d492869ab1f18e05121529b7bcffcb637d13994c;hp=6ab4537ace438eba0cff107b377f802439f1a380;hpb=67b127cee4597c5a385921ca51c24f0cea863f4e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 6ab4537ac..076ce918f 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -1,3 +1,7 @@ +#include "powerups.qh" + +#include + // Powerups (#2) // Powerup item fields (reusing existing fields) @@ -40,6 +44,7 @@ void addPowerupItem(string name, string icon, vector color, float currentTime, f int getPowerupItemAlign(int align, int column, int row, int columns, int rows, bool isVertical) { + TC(int, align); TC(int, column); TC(int, row); TC(int, columns); TC(int, rows); TC(bool, isVertical); if(align < 2) return align; @@ -56,17 +61,18 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b void HUD_Powerups() { - int allItems = getstati(STAT_ITEMS, 0, 24); - int allBuffs = getstati(STAT_BUFFS, 0, 24); - int strengthTime, shieldTime, superTime; + int allItems = STAT(ITEMS); + int allBuffs = STAT(BUFFS); + float strengthTime, shieldTime, superTime; // Initialize items if(!autocvar__hud_configure) { - if(!autocvar_hud_panel_powerups) return; - if(spectatee_status == -1) return; - if(getstati(STAT_HEALTH) <= 0) return; - if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return; + if((!autocvar_hud_panel_powerups) || (spectatee_status == -1)) + return; + if(STAT(HEALTH) <= 0 && autocvar_hud_panel_powerups_hide_ondeath) + return; + //if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return; strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99); shieldTime = bound(0, STAT(INVINCIBLE_FINISHED) - time, 99); @@ -97,16 +103,19 @@ void HUD_Powerups() if(superTime) addPowerupItem("Superweapons", "superweapons", autocvar_hud_progressbar_superweapons_color, superTime, 30); - FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA( - addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, getstatf(STAT_BUFF_TIME) - time, 99), 60); - )); + MUTATOR_CALLHOOK(HUD_Powerups_add); if(!powerupItemsCount) return; // Draw panel background - HUD_Panel_UpdateCvars(); - HUD_Panel_DrawBg(1); + HUD_Panel_LoadCvars(); + + if (autocvar_hud_panel_powerups_dynamichud) + HUD_Scale_Enable(); + else + HUD_Scale_Disable(); + HUD_Panel_DrawBg(); // Set drawing area vector pos = panel_pos;