Move LMS info message to its own file
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:33:15 +0000 (17:33 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 07:33:15 +0000 (17:33 +1000)
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/mutators/events.qh
qcsrc/common/gamemodes/gamemode/lms/_mod.inc
qcsrc/common/gamemodes/gamemode/lms/_mod.qh
qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc [new file with mode: 0644]
qcsrc/common/gamemodes/gamemode/lms/cl_lms.qh [new file with mode: 0644]

index 627fd67efb1f5cd2c7f0fa8d72057543b57387e5..83897dfd3f250541e3f2d56e67f9cf391698faa2 100644 (file)
@@ -4,7 +4,6 @@
 #include <client/miscfunctions.qh>
 
 #include <common/ent_cs.qh>
-#include <common/gamemodes/_mod.qh>
 
 // Info messages (#14)
 
@@ -122,22 +121,15 @@ void HUD_InfoMessages()
                                InfoMessage(s);
                        }
 
-                       MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize);
+                       bool mutator_returnvalue = MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize, img_curr_group);
+                       pos = M_ARGV(0, vector);
+                       img_curr_group = M_ARGV(2, int);
 
-                       if(!warmup_stage && ISGAMETYPE(LMS))
+                       if(!mutator_returnvalue)
                        {
-                               entity sk;
-                               sk = playerslots[player_localnum];
-                               if(sk.(scores(ps_primary)) >= 666)
-                                       s = _("^1Match has already begun");
-                               else if(sk.(scores(ps_primary)) > 0)
-                                       s = _("^1You have no more lives left");
-                               else
-                                       s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
-                       }
-                       else
                                s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
-                       InfoMessage(s);
+                               InfoMessage(s);
+                       }
                }
 
                if (time < STAT(GAMESTARTTIME))
index 0629c2a9f0dd17a7897c73f6ff68dc818748c4ac..d08b020e3556c97d9352634ab70776d67dfd2cda 100644 (file)
@@ -163,10 +163,13 @@ MUTATOR_HOOKABLE(DrawCrosshair, EV_NO_ARGS);
 /** Return true to not draw scoreboard */
 MUTATOR_HOOKABLE(DrawScoreboard, EV_NO_ARGS);
 
-/** Called when drawing info messages, allows adding new info messages */
+/** Called when drawing info messages, allows adding new info messages. Return true to hide the standard join message */
 #define EV_DrawInfoMessages(i, o) \
        /** pos */                          i(vector, MUTATOR_ARGV_0_vector) \
+       /***/                           o(vector, MUTATOR_ARGV_0_vector) \
        /** mySize */                   i(vector, MUTATOR_ARGV_1_vector) \
+       /** img_curr_group */   i(int, MUTATOR_ARGV_2_int) \
+       /***/                                   o(int, MUTATOR_ARGV_2_int) \
        /**/
 MUTATOR_HOOKABLE(DrawInfoMessages, EV_DrawInfoMessages);
 
index 69be66feb50226e1ebbc9bd8a283c53da4d005a1..11f7446644eaa2772495d0bcd946ea9c5fa5f667 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/lms/lms.qc>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/lms/cl_lms.qc>
+#endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/lms/sv_lms.qc>
 #endif
index cbb42ad8d3c3ac25643ad73c7ae2bc8e5d5922bc..1b1143f4bb7c947f4190dfed9bda1e3317763ba8 100644 (file)
@@ -1,5 +1,8 @@
 // generated file; do not modify
 #include <common/gamemodes/gamemode/lms/lms.qh>
+#ifdef CSQC
+    #include <common/gamemodes/gamemode/lms/cl_lms.qh>
+#endif
 #ifdef SVQC
     #include <common/gamemodes/gamemode/lms/sv_lms.qh>
 #endif
diff --git a/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc
new file mode 100644 (file)
index 0000000..649f964
--- /dev/null
@@ -0,0 +1,30 @@
+#include "cl_lms.qh"
+
+REGISTER_MUTATOR(cl_lms, true);
+
+MUTATOR_HOOKFUNCTION(cl_lms, DrawInfoMessages)
+{
+       if(!warmup_stage && ISGAMETYPE(LMS))
+       {
+               entity sk = playerslots[player_localnum];
+               vector pos = M_ARGV(0, vector);
+               vector mySize = M_ARGV(1, vector);
+               vector fontsize = '0.2 0.2 0' * mySize.y;
+               int img_curr_group = M_ARGV(2, int);
+               if(sk.(scores(ps_primary)) >= 666)
+               {
+                       InfoMessage(_("^1Match has already begun"));
+                       M_ARGV(0, vector) = pos;
+                       M_ARGV(2, int) = img_curr_group;
+                       return true;
+               }
+               else if(sk.(scores(ps_primary)) > 0)
+               {
+                       InfoMessage(_("^1You have no more lives left"));
+                       M_ARGV(0, vector) = pos;
+                       M_ARGV(2, int) = img_curr_group;
+                       return true;
+               }
+       }
+       return false;
+}
diff --git a/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qh b/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once