]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 e49ea3a48cf2ba1070a064914d76bd51ba38ed60..d45aea2c1109248b171c8ae0b316d4dc88aa3e3f 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 == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
+               if(autocvar_hud_panel_physics == 3 && !MUTATOR_CALLHOOK(HUD_Physics_showoptional)) return;
        }
 
        HUD_Panel_LoadCvars();
index d08b020e3556c97d9352634ab70776d67dfd2cda..7ddcb204aa3144cf6d46e10db0d67cffc4088728 100644 (file)
@@ -118,6 +118,9 @@ MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
 
 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) \
index 5978c8bac13d67df1d22f1d39b47d1a33a222b76..f60b8de4cfc4c7da886439a61d481ef4649cd1ea 100644 (file)
@@ -1,5 +1,8 @@
 // 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
index e0621224075c5578cd700a7ccc4105633b7f423b..5e9ba6326d09a90d1ef9e6f7535920a541d258f4 100644 (file)
@@ -1,5 +1,8 @@
 // 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
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 ee90914a3d7e124dfbfc89037ffe84a043cd9b0e..cb5e647b27a9383bb353a7f92e6e660d9f963ca8 100644 (file)
@@ -145,3 +145,10 @@ void HUD_Mod_Race(vector pos, vector mySize)
                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
+}