]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow translating gameplay tips (ported them from server to client)
authorterencehill <piuntn@gmail.com>
Fri, 25 Mar 2022 16:55:33 +0000 (17:55 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 25 Mar 2022 16:55:33 +0000 (17:55 +0100)
13 files changed:
qcsrc/client/main.qc
qcsrc/common/mutators/mutator/hook/_mod.inc
qcsrc/common/mutators/mutator/hook/_mod.qh
qcsrc/common/mutators/mutator/hook/cl_hook.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/hook/cl_hook.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/hook/sv_hook.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/offhand_blaster/_mod.inc
qcsrc/common/mutators/mutator/offhand_blaster/_mod.qh
qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc
qcsrc/server/client.qc

index 1441eedf039882c98d9cb8f7cc8d0360f6a729fc..0741acc21a8e38faf61d9d5831b8b343fbe261bf 100644 (file)
@@ -1345,18 +1345,23 @@ NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
        string modifications = translate_modifications(ReadString());
        string weaponarena_list = translate_weaponarena(ReadString());
        string cache_mutatormsg = ReadString();
-       string mutator_msg = ReadString();
        string motd = ReadString();
 
        string msg = "";
        msg = strcat(msg, ver);
        msg = strcat(msg, "^8\n\n", _("match type is "), " ^1", MapInfo_Type_ToText(gametype), "^8\n");
+
        modifications = cons_mid(modifications, ", ", weaponarena_list);
        if(modifications != "")
                msg = strcat(msg, "^8\n", _("active modifications:"), " ^3", modifications, "^8\n");
+
        if (cache_mutatormsg != "")
                msg = strcat(msg, "\n\n^8", _("special gameplay tips:"), " ^7", cache_mutatormsg);
+       string mutator_msg = "";
+       MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
+       mutator_msg = M_ARGV(0, string);
        msg = strcat(msg, mutator_msg); // trust that the mutator will do proper formatting
+
        if (motd != "")
                msg = strcat(msg, "\n\n^8", _("MOTD:"), " ^7", motd);
 
index e5e68b6106fed48992f8d3d743eb9f087ac168c6..626c4cffa673fed98b3a14f972594068a0eaca51 100644 (file)
@@ -1,4 +1,7 @@
 // generated file; do not modify
+#ifdef CSQC
+    #include <common/mutators/mutator/hook/cl_hook.qc>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/hook/sv_hook.qc>
 #endif
index 5a5d26e8172fd5ee077fc200e18a519b64acca0c..1216e36e8bacd8feb26deba268219a1c334c921d 100644 (file)
@@ -1,4 +1,7 @@
 // generated file; do not modify
+#ifdef CSQC
+    #include <common/mutators/mutator/hook/cl_hook.qh>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/hook/sv_hook.qh>
 #endif
diff --git a/qcsrc/common/mutators/mutator/hook/cl_hook.qc b/qcsrc/common/mutators/mutator/hook/cl_hook.qc
new file mode 100644 (file)
index 0000000..b600701
--- /dev/null
@@ -0,0 +1,12 @@
+#include "cl_hook.qh"
+
+#ifdef CSQC
+REGISTER_MUTATOR(cl_hook, true);
+
+MUTATOR_HOOKFUNCTION(cl_hook, BuildGameplayTipsString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string),
+               "\n\n", _("^3grappling hook^8 is enabled, press 'e' (+hook) to use it"), "\n");
+}
+
+#endif
diff --git a/qcsrc/common/mutators/mutator/hook/cl_hook.qh b/qcsrc/common/mutators/mutator/hook/cl_hook.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index c6a595363c3a272f64b4a4e0f89de37c7e94e9c6..94379cbb2828410315ee8312c1f42844a32dcdb1 100644 (file)
@@ -30,11 +30,6 @@ MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
     M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
 }
 
-MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
-{
-    M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' (+hook) to use it\n");
-}
-
 MUTATOR_HOOKFUNCTION(hook, SetStartItems)
 {
     if(autocvar_g_grappling_hook_useammo)
index 7a00bd686b5b122b4b481e42fced7119becc67ce..49e70b600fd8cb9b2b2500d7e11bab5345c12be7 100644 (file)
@@ -117,6 +117,13 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
        else
                proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
 }
+
+MUTATOR_HOOKFUNCTION(cl_nades, BuildGameplayTipsString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string),
+               "\n\n", _("^3nades^8 are enabled, press 'g' (dropweapon) to use them"), "\n");
+}
+
 bool Projectile_isnade(int p)
 {
        return Nade_FromProjectile(p) != NADE_TYPE_Null;
@@ -1569,9 +1576,4 @@ MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
        M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
 }
 
-MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString)
-{
-       M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3nades^8 are enabled, press 'g' (dropweapon) to use them\n");
-}
-
 #endif
index 41bb01e55eeaee272278e8ede77ab4f8c05be397..0a555570d1d6f6b83db21e4ee1275425cfde8542 100644 (file)
@@ -1,4 +1,7 @@
 // generated file; do not modify
+#ifdef CSQC
+    #include <common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qc>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qc>
 #endif
index 5e11096a532644d671eb7bd409b0519e08d3c3bd..2c4587f417b2e1e3820e3f4b1facd22e55b1d772 100644 (file)
@@ -1,4 +1,7 @@
 // generated file; do not modify
+#ifdef CSQC
+    #include <common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qh>
+#endif
 #ifdef SVQC
     #include <common/mutators/mutator/offhand_blaster/sv_offhand_blaster.qh>
 #endif
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qc b/qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qc
new file mode 100644 (file)
index 0000000..39e6ad8
--- /dev/null
@@ -0,0 +1,9 @@
+#include "cl_offhand_blaster.qh"
+
+REGISTER_MUTATOR(cl_offhand_blaster, true);
+
+MUTATOR_HOOKFUNCTION(cl_offhand_blaster, BuildGameplayTipsString)
+{
+       M_ARGV(0, string) = strcat(M_ARGV(0, string),
+               "\n\n", _("^3offhand blaster^8 is enabled, press 'e' (+hook) to use it"), "\n");
+}
diff --git a/qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qh b/qcsrc/common/mutators/mutator/offhand_blaster/cl_offhand_blaster.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index fbffa8a439cd241d5977bde45d876661fdcb9c7e..931ab1ad9991f517cde5ab95e56f5f4dd53a9db7 100644 (file)
@@ -14,11 +14,6 @@ MUTATOR_HOOKFUNCTION(offhand_blaster, BuildMutatorsPrettyString)
        M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Offhand blaster");
 }
 
-MUTATOR_HOOKFUNCTION(offhand_blaster, BuildGameplayTipsString)
-{
-    M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3offhand blaster^8 is enabled, press 'e' (+hook) to use it\n");
-}
-
 MUTATOR_HOOKFUNCTION(offhand_blaster, PlayerSpawn)
 {
        entity player = M_ARGV(0, entity);
index 15cac948a7d3a655b2a6790637c9b3ef9151f900..c27ba948cf9e466637d73075f894b06766cd3266 100644 (file)
@@ -1053,11 +1053,6 @@ void SendWelcomemessage(entity this, bool force_centerprint)
 
        WriteString(MSG_ONE, cache_mutatormsg);
 
-       string mutator_msg = "";
-       MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
-       mutator_msg = M_ARGV(0, string);
-
-       WriteString(MSG_ONE, mutator_msg); // trust that the mutator will do proper formatting
        WriteString(MSG_ONE, strreplace("\\n", "\n", autocvar_sv_motd));
 }