Add a mutator hook to indicate whether the physics HUD panel should be shown when...
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:44:10 +0000 (17:44 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:44:10 +0000 (17:44 +1000)
qcsrc/client/hud/panel/physics.qc
qcsrc/client/mutators/events.qh
qcsrc/common/gamemodes/gamemode/cts/_mod.inc
qcsrc/common/gamemodes/gamemode/cts/_mod.qh
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/cts/cl_cts.qh [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/race/cl_race.qc

index e49ea3a..d45aea2 100644 (file)
@@ -39,7 +39,7 @@ void HUD_Physics()
        {
                if(!autocvar_hud_panel_physics) return;
                if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
        {
                if(!autocvar_hud_panel_physics) return;
                if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
-               if(autocvar_hud_panel_physics == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
+               if(autocvar_hud_panel_physics == 3 && !MUTATOR_CALLHOOK(HUD_Physics_showoptional)) return;
        }
 
        HUD_Panel_LoadCvars();
        }
 
        HUD_Panel_LoadCvars();
index d08b020..7ddcb20 100644 (file)
@@ -118,6 +118,9 @@ MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
 
 MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
 
 
 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 not draw any vortex beam */
 #define EV_Particles_VortexBeam(i, o) \
        /** beam shot origin */  i(vector, MUTATOR_ARGV_0_vector) \
 /** Return true to not draw any vortex beam */
 #define EV_Particles_VortexBeam(i, o) \
        /** beam shot origin */  i(vector, MUTATOR_ARGV_0_vector) \
index 5978c8b..f60b8de 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/cts/cts.qc>
 // generated file; do not modify
 #include <common/gamemodes/gamemode/cts/cts.qc>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/cts/cl_cts.qc>
+#endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/cts/sv_cts.qc>
 #endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/cts/sv_cts.qc>
 #endif
index e062122..5e9ba63 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/cts/cts.qh>
 // generated file; do not modify
 #include <common/gamemodes/gamemode/cts/cts.qh>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/cts/cl_cts.qh>
+#endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/cts/sv_cts.qh>
 #endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/cts/sv_cts.qh>
 #endif
diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qc
new file mode 100644 (file)
index 0000000..ded220d
--- /dev/null
@@ -0,0 +1,8 @@
+#include "cl_cts.qh"
+
+REGISTER_MUTATOR(cl_cts, true);
+
+MUTATOR_HOOKFUNCTION(cl_cts, HUD_Physics_showoptional)
+{
+       return ISGAMETYPE(CTS); // show the optional physics panel
+}
diff --git a/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qh b/qcsrc/common/gamemodes/gamemode/cts/cl_cts.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index ee90914..cb5e647 100644 (file)
@@ -145,3 +145,10 @@ void HUD_Mod_Race(vector pos, vector mySize)
                strfree(race_status_name_prev);
        }
 }
                strfree(race_status_name_prev);
        }
 }
+
+REGISTER_MUTATOR(cl_race, true);
+
+MUTATOR_HOOKFUNCTION(cl_race, HUD_Physics_showoptional)
+{
+       return ISGAMETYPE(RACE); // show the optional physics panel
+}