From e1cf71864773085863f25a1438dfa9c602efadd6 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 13 Jul 2020 19:46:33 +1000 Subject: [PATCH] Add a mutator hook to control whether the race timer HUD panel is shown --- qcsrc/client/hud/panel/racetimer.qc | 2 +- qcsrc/client/mutators/events.qh | 3 +++ qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc | 5 +++++ qcsrc/common/gamemodes/gamemode/race/cl_race.qc | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index c82d76402..9bc62b283 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -104,7 +104,7 @@ void HUD_RaceTimer () if(!autocvar__hud_configure) { if(!autocvar_hud_panel_racetimer) return; - if(!(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return; + if(!MUTATOR_CALLHOOK(ShowRaceTimer)) return; if(spectatee_status == -1) return; } diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 232a9a412..258ad9e11 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -225,3 +225,6 @@ MUTATOR_HOOKABLE(ShowRankings, EV_ShowRankings); /***/ o(float, MUTATOR_ARGV_1_float) \ /**/ MUTATOR_HOOKABLE(ShowNames_Draw, EV_ShowNames_Draw); + +/** Return true to display the race timer HUD panel */ +MUTATOR_HOOKABLE(ShowRaceTimer, EV_NO_ARGS); diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc index d20bcfa54..27d6b868e 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc @@ -35,3 +35,8 @@ MUTATOR_HOOKFUNCTION(cl_cts, ShowNames_Draw) { return (ISGAMETYPE(CTS) && M_ARGV(1, float) < ALPHA_MIN_VISIBLE); } + +MUTATOR_HOOKFUNCTION(cl_cts, ShowRaceTimer) +{ + return ISGAMETYPE(CTS); // show the race timer panel +} diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index e8b5516d0..01a6e83b2 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -171,3 +171,8 @@ MUTATOR_HOOKFUNCTION(cl_race, DrawScoreboardAccuracy) { return ISGAMETYPE(RACE); // accuracy is not a factor in this gamemode } + +MUTATOR_HOOKFUNCTION(cl_race, ShowRaceTimer) +{ + return ISGAMETYPE(RACE); // show the race timer panel +} -- 2.39.2