]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 c82d7640228560fa0bdb703dd6fbbcc2551476ed..9bc62b283ab2c326cddac848112e4ca2ca0c691e 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 232a9a4123555b4a0e079c7e08b80883b5ee4eea..258ad9e1197342bcefd5f426a12d53c717e5ab1a 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 d20bcfa5406baa8206040b1b0383ff0446319a70..27d6b868ef0d69c292881c1d6ba9d681ea22243a 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 e8b5516d04cb5cfa9c42a286d576861e30e9dfeb..01a6e83b21b691e40ed4548cecbf7f25ed30dcd1 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
+}