]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/powerups.qc
Merge branch 'master' into TimePath/modules
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / powerups.qc
index 933cb422928e6e6af0daec20b09b148445116b0f..4779ab747999365cf458f889304a06893484cdef 100644 (file)
@@ -1,3 +1,7 @@
+#include "powerups.qh"
+
+#include <common/items/_mod.qh>
+
 // 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,16 +61,17 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b
 
 void HUD_Powerups()
 {
-       int allItems = getstati(STAT_ITEMS, 0, 24);
+       int allItems = STAT(ITEMS);
        int allBuffs = STAT(BUFFS);
        int 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((!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);
@@ -97,15 +103,17 @@ 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();
+       if (autocvar_hud_panel_powerups_dynamichud)
+               HUD_Scale_Enable();
+       else
+               HUD_Scale_Disable();
        HUD_Panel_DrawBg(1);
 
        // Set drawing area