Add a mutator hook to hide the score HUD panel
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:50:12 +0000 (17:50 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:50:12 +0000 (17:50 +1000)
qcsrc/client/hud/panel/score.qc
qcsrc/client/mutators/events.qh
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc
qcsrc/common/gamemodes/gamemode/race/cl_race.qc

index 70a47a8..32db0a2 100644 (file)
@@ -147,7 +147,7 @@ void HUD_Score()
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_score) return;
-               if(spectatee_status == -1 && (ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
+               if(MUTATOR_CALLHOOK(HUD_Score_show)) return;
        }
 
        HUD_Panel_LoadCvars();
index 7ddcb20..cafd607 100644 (file)
@@ -121,6 +121,9 @@ MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
 /** return true to show the physics HUD panel when optional mode is enabled */
 MUTATOR_HOOKABLE(HUD_Physics_showoptional, EV_NO_ARGS);
 
+/** return true to hide the score HUD panel */
+MUTATOR_HOOKABLE(HUD_Score_show, EV_NO_ARGS);
+
 /** Return true to not draw any vortex beam */
 #define EV_Particles_VortexBeam(i, o) \
        /** beam shot origin */  i(vector, MUTATOR_ARGV_0_vector) \
index ded220d..3f0c26f 100644 (file)
@@ -6,3 +6,8 @@ MUTATOR_HOOKFUNCTION(cl_cts, HUD_Physics_showoptional)
 {
        return ISGAMETYPE(CTS); // show the optional physics panel
 }
+
+MUTATOR_HOOKFUNCTION(cl_cts, HUD_Score_show)
+{
+       return spectatee_status == -1 && ISGAMETYPE(CTS); // hide the score panel while observing
+}
index cb5e647..92d75dc 100644 (file)
@@ -152,3 +152,8 @@ MUTATOR_HOOKFUNCTION(cl_race, HUD_Physics_showoptional)
 {
        return ISGAMETYPE(RACE); // show the optional physics panel
 }
+
+MUTATOR_HOOKFUNCTION(cl_race, HUD_Score_show)
+{
+       return spectatee_status == -1 && ISGAMETYPE(RACE); // hide the score panel while observing
+}