From: Mario Date: Mon, 13 Jul 2020 09:46:33 +0000 (+1000) Subject: Add a mutator hook to control whether the race timer HUD panel is shown X-Git-Tag: xonotic-v0.8.5~855^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e1cf71864773085863f25a1438dfa9c602efadd6;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook to control whether the race timer HUD panel is shown --- 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 +}