From a73bd5e59f556bba8d778bf2a7b5bc15d02523ee Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 15 Aug 2016 17:36:38 +0200 Subject: [PATCH] Allow to hide panels that don't make too much sense when dead (cl_deathscoreboard must be disabled, otherwise scoreboards hides all the panels) --- _hud_common.cfg | 5 +++++ qcsrc/client/autocvars.qh | 4 ++++ qcsrc/client/hud/panel/ammo.qc | 6 ++++-- qcsrc/client/hud/panel/healtharmor.qc | 10 ++++++---- qcsrc/client/hud/panel/powerups.qc | 7 ++++--- qcsrc/client/hud/panel/weapons.qc | 2 ++ 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index 4f109944b..725bfe4e3 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -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" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 61c54ae61..0ac857754 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index 5c45ff0f3..bd3ccd068 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -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(); diff --git a/qcsrc/client/hud/panel/healtharmor.qc b/qcsrc/client/hud/panel/healtharmor.qc index bc4291a94..b56e390b3 100644 --- a/qcsrc/client/hud/panel/healtharmor.qc +++ b/qcsrc/client/hud/panel/healtharmor.qc @@ -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) diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 223bf72ce..7528c2ba2 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -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); diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index d08061d81..fe2aefc60 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -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))) { -- 2.39.2