Add a mutator hook to control whether the race timer HUD panel is shown
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 09:46:33 +0000 (19:46 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 09:46:33 +0000 (19:46 +1000)
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/mutators/events.qh
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc
qcsrc/common/gamemodes/gamemode/race/cl_race.qc

index c82d764..9bc62b2 100644 (file)
@@ -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;
        }
 
index 232a9a4..258ad9e 100644 (file)
@@ -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);
index d20bcfa..27d6b86 100644 (file)
@@ -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
+}
index e8b5516..01a6e83 100644 (file)
@@ -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
+}