]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/healtharmor.qc
Make it pass compilation unit tests
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / healtharmor.qc
index 83043293c5c60a60a4a46e3182f8620393cd4ba8..6407628e85b5cf25bae92169f6a8bb4e053f9e8f 100644 (file)
@@ -1,22 +1,30 @@
-/** Health/armor (#3) */
+#include "healtharmor.qh"
+
+#include "scoreboard.qh"
+#include <common/deathtypes/all.qh>
+
+// Health/armor (#3)
+
 void HUD_HealthArmor()
 {
        int armor, health, fuel;
        if(!autocvar__hud_configure)
        {
-               if(!autocvar_hud_panel_healtharmor) return;
+               if((!autocvar_hud_panel_healtharmor) || (spectatee_status == -1))
+                       return;
                if(hud != HUD_NORMAL) return;
-               if(spectatee_status == -1) return;
 
-               health = getstati(STAT_HEALTH);
+               health = STAT(HEALTH);
                if(health <= 0)
                {
+                       health = 0;
                        prev_health = -1;
-                       return;
+                       if(autocvar_hud_panel_healtharmor_hide_ondeath)
+                               return;
                }
-               armor = getstati(STAT_ARMOR);
+               armor = STAT(ARMOR);
 
-               // code to check for spectatee_status changes is in Ent_ClientData()
+               // code to check for spectatee_status changes is in ENT_CLIENT_CLIENTDATA
                // prev_p_health and prev_health can be set to -1 there
 
                if (prev_p_health == -1)
@@ -41,7 +49,7 @@ void HUD_HealthArmor()
                        prev_health = 0;
                        prev_armor = 0;
                }
-               fuel = getstati(STAT_FUEL);
+               fuel = STAT(FUEL);
        }
        else
        {
@@ -50,7 +58,9 @@ void HUD_HealthArmor()
                fuel = 20;
        }
 
-       HUD_Panel_UpdateCvars();
+       if(1 - scoreboard_fade_alpha <= 0)
+               return;
+       HUD_Panel_UpdateCvars(1 - scoreboard_fade_alpha);
 
        draw_beginBoldFont();
 
@@ -58,7 +68,11 @@ void HUD_HealthArmor()
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(1);
+       if (autocvar_hud_panel_healtharmor_dynamichud)
+               HUD_Scale_Enable();
+       else
+               HUD_Scale_Disable();
+       HUD_Panel_DrawBg();
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -70,7 +84,7 @@ void HUD_HealthArmor()
 
     int maxhealth = autocvar_hud_panel_healtharmor_maxhealth;
     int maxarmor = autocvar_hud_panel_healtharmor_maxarmor;
-       if(autocvar_hud_panel_healtharmor == 2) // combined health and armor display
+       if(autocvar_hud_panel_healtharmor_combined) // combined health and armor display
        {
                vector v;
                v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id);