]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow to hide panels that don't make too much sense when dead (cl_deathscoreboard...
authorterencehill <piuntn@gmail.com>
Mon, 15 Aug 2016 15:36:38 +0000 (17:36 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 15 Aug 2016 15:36:38 +0000 (17:36 +0200)
_hud_common.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/hud/panel/weapons.qc

index 4f109944ba1d7f168484a28b0f8663b947394bf5..725bfe4e38b840dec5a7c4dc27c04f7028e503ce 100644 (file)
@@ -72,13 +72,18 @@ seta hud_panel_weapons_ammo_full_cells 180 "show 100% of the status bar at this
 seta hud_panel_weapons_ammo_full_plasma 180 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_rockets 160 "show 100% of the status bar at this ammo count"
 seta hud_panel_weapons_ammo_full_fuel 100 "show 100% of the status bar at this ammo count"
+seta hud_panel_weapons_hide_ondeath 0 "hide this panel when dead"
 
 seta hud_panel_ammo_maxammo "40" "when you have this much ammo, the ammo status bar is full"
+seta hud_panel_ammo_hide_ondeath 0 "hide this panel when dead"
+
+seta hud_panel_powerups_hide_ondeath 0 "hide this panel when dead"
 
 seta hud_panel_healtharmor_maxhealth "200" "when you have this much health, the health status bar is full"
 seta hud_panel_healtharmor_maxarmor "200" "when you have this much armor, the armor status bar is full"
 seta hud_panel_healtharmor_progressbar_gfx_damage 5 "show damage effect when damaged at least by this amount; 0 disables the effect"
 seta hud_panel_healtharmor_progressbar_gfx_lowhealth 40 "health progressbar blinks when health is lower than this amount"
+seta hud_panel_healtharmor_hide_ondeath 0 "hide this panel when dead"
 
 seta hud_panel_timer_increment "0" "show elapsed time instead of remaining time"
 
index 61c54ae619f2a84a0dc3961916d6c44954a243b6..0ac857754bd8f8867709ada63c3acc6573e369a7 100644 (file)
@@ -210,6 +210,10 @@ bool autocvar_hud_panel_infomessages_dynamichud = false;
 bool autocvar_hud_panel_physics_dynamichud      = true;
 bool autocvar_hud_panel_centerprint_dynamichud  = true;
 bool autocvar_hud_panel_itemstime_dynamichud    = true;
+bool autocvar_hud_panel_healtharmor_hide_ondeath  = false;
+bool autocvar_hud_panel_ammo_hide_ondeath         = false;
+bool autocvar_hud_panel_powerups_hide_ondeath     = false;
+bool autocvar_hud_panel_weapons_hide_ondeath      = false;
 bool autocvar_hud_panel_ammo;
 bool autocvar_hud_panel_ammo_iconalign;
 int autocvar_hud_panel_ammo_maxammo;
index 5c45ff0f331a1544be55bf6b4f3a262d7f704022..bd3ccd068160d9130db8f308fe28548a4c092dad 100644 (file)
@@ -98,8 +98,10 @@ void HUD_Ammo()
        if(hud != HUD_NORMAL) return;
        if(!autocvar__hud_configure)
        {
-               if(!autocvar_hud_panel_ammo) return;
-               if(spectatee_status == -1) return;
+               if((!autocvar_hud_panel_ammo) || (spectatee_status == -1))
+                       return;
+               if(STAT(HEALTH) < 1 && autocvar_hud_panel_ammo_hide_ondeath)
+                       return;
        }
 
        HUD_Panel_UpdateCvars();
index bc4291a948648e8eb5f8cf843c683cdc17d7ba1c..b56e390b35824802dc07db5bbe60c5f22541ae66 100644 (file)
@@ -8,19 +8,21 @@ 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 = STAT(HEALTH);
                if(health <= 0)
                {
+                       health = 0;
                        prev_health = -1;
-                       return;
+                       if(autocvar_hud_panel_healtharmor_hide_ondeath)
+                               return;
                }
                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)
index 223bf72ce8efae4a679f8c6405673deaf1aac283..7528c2ba2b1a6f89353b6e4cf83116f5ee4a6473 100644 (file)
@@ -68,9 +68,10 @@ void HUD_Powerups()
        // Initialize items
        if(!autocvar__hud_configure)
        {
-               if(!autocvar_hud_panel_powerups) return;
-               if(spectatee_status == -1) return;
-               if(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);
index d08061d8108907d747427fecf419f7c8784fdb74..fe2aefc60d1c3fe5f123c49386a235ccb3cc2b8b 100644 (file)
@@ -70,6 +70,8 @@ void HUD_Weapons()
        {
                if((!autocvar_hud_panel_weapons) || (spectatee_status == -1))
                        return;
+               if(STAT(HEALTH) <= 0 && autocvar_hud_panel_weapons_hide_ondeath)
+                       return;
                if(timeout && time >= weapontime + timeout + timeout_effect_length)
                if(autocvar_hud_panel_weapons_timeout_effect == 3 || (autocvar_hud_panel_weapons_timeout_effect == 1 && !(autocvar_hud_panel_weapons_timeout_fadebgmin + autocvar_hud_panel_weapons_timeout_fadefgmin)))
                {