]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: use a hook to determine whether the strafehud is shown
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 7 Aug 2020 17:41:32 +0000 (19:41 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 7 Aug 2020 17:41:32 +0000 (19:41 +0200)
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/mutators/events.qh
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc
qcsrc/common/gamemodes/gamemode/race/cl_race.qc

index 379cc71502b916df3f9400e61734f3116d3dc0e7..63311dd1173ac39c08dc1cbc6f241687e4761656 100644 (file)
@@ -64,7 +64,7 @@ void HUD_StrafeHUD()
     {
         if(!autocvar_hud_panel_strafehud ||
            (spectatee_status == -1 && (autocvar_hud_panel_strafehud == 1 || autocvar_hud_panel_strafehud == 3)) ||
-           (autocvar_hud_panel_strafehud == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS)))) return;
+           (autocvar_hud_panel_strafehud == 3 && !MUTATOR_CALLHOOK(HUD_StrafeHUD_showoptional))) return;
     }
 
     HUD_Panel_LoadCvars();
index 23bbe00d89e767d5dc5c81d3d045fb75e80c1e34..c606906ab2eb45da744e7ace1b93ff6e1527876b 100644 (file)
@@ -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 show the strafehud when optional mode is enabled */
+MUTATOR_HOOKABLE(HUD_StrafeHUD_showoptional, EV_NO_ARGS);
+
 /** return true to hide the score HUD panel */
 MUTATOR_HOOKABLE(HUD_Score_show, EV_NO_ARGS);
 
index 27d6b868ef0d69c292881c1d6ba9d681ea22243a..b0cfc15dbcf9419f43eed1191a87748dd5fe26c2 100644 (file)
@@ -7,6 +7,11 @@ MUTATOR_HOOKFUNCTION(cl_cts, HUD_Physics_showoptional)
        return ISGAMETYPE(CTS); // show the optional physics panel
 }
 
+MUTATOR_HOOKFUNCTION(cl_cts, HUD_StrafeHUD_showoptional)
+{
+       return ISGAMETYPE(CTS); // show the optional strafehud
+}
+
 MUTATOR_HOOKFUNCTION(cl_cts, HUD_Score_show)
 {
        return spectatee_status == -1 && ISGAMETYPE(CTS); // hide the score panel while observing
index c2346a4f2c84af163e5e38a5f241d5b54e2843db..84d88064cc7a6d14aaea37583c2c96eb3f1bfce9 100644 (file)
@@ -153,6 +153,11 @@ MUTATOR_HOOKFUNCTION(cl_race, HUD_Physics_showoptional)
        return ISGAMETYPE(RACE); // show the optional physics panel
 }
 
+MUTATOR_HOOKFUNCTION(cl_race, HUD_StrafeHUD_showoptional)
+{
+       return ISGAMETYPE(RACE); // show the optional strafehud
+}
+
 MUTATOR_HOOKFUNCTION(cl_race, HUD_Score_show)
 {
        return spectatee_status == -1 && ISGAMETYPE(RACE); // hide the score panel while observing