From: Mario Date: Mon, 13 Jul 2020 07:50:12 +0000 (+1000) Subject: Add a mutator hook to hide the score HUD panel X-Git-Tag: xonotic-v0.8.5~855^2~14 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=5be2c6f1762b829c880f607c6de65a79f9b525de Add a mutator hook to hide the score HUD panel --- diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 70a47a8120..32db0a29fb 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -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(); diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 7ddcb204aa..cafd6075a0 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -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) \ diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc index ded220d9cc..3f0c26fde5 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc @@ -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 +} diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index cb5e647b27..92d75dc4d6 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -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 +}