]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Chat: refactor to module, it will be more than just a few commands
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 7 Apr 2018 02:01:00 +0000 (12:01 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 7 Apr 2018 04:17:43 +0000 (14:17 +1000)
14 files changed:
qcsrc/client/main.qc
qcsrc/menu/_mod.inc
qcsrc/menu/_mod.qh
qcsrc/menu/command/_mod.inc
qcsrc/menu/command/_mod.qh
qcsrc/menu/command/notice.qc [deleted file]
qcsrc/menu/command/notice.qh [deleted file]
qcsrc/menu/modules/_mod.inc [new file with mode: 0644]
qcsrc/menu/modules/_mod.qh [new file with mode: 0644]
qcsrc/menu/modules/chat/_mod.inc [new file with mode: 0644]
qcsrc/menu/modules/chat/_mod.qh [new file with mode: 0644]
qcsrc/menu/modules/chat/commands.qc [new file with mode: 0644]
qcsrc/menu/modules/chat/commands.qh [new file with mode: 0644]
qcsrc/menu/modules/chat/interface.qh [new file with mode: 0644]

index 163bbce22e18619b238e5251e98182c4d8f64191..2d8483c834742955fd567f4a3fd88f60fd2286f4 100644 (file)
@@ -29,7 +29,7 @@
 #include <lib/csqcmodel/cl_model.qh>
 #include <lib/csqcmodel/interpolate.qh>
 #include <lib/warpzone/client.qh>
-#include <menu/command/notice.qh>
+#include <menu/modules/chat/interface.qh>
 
 // --------------------------------------------------------------------------
 // BEGIN REQUIRED CSQC FUNCTIONS
@@ -909,8 +909,6 @@ void CSQC_Parse_StuffCmd(string strMessage)
        localcmd(strMessage);
 }
 
-string autocvar__cl_hook_print;
-
 // CSQC_Parse_Print : Provides the print string in the first parameter that the server provided.  To execute standard behavior, simply execute print with the string.
 void CSQC_Parse_Print(string strMessage)
 {
index d2a8d702f16ad3241b92011889b7a52da3599bd4..fd956463bb57414bca50ed41266ff68cb735c011 100644 (file)
@@ -7,5 +7,6 @@
 #include <menu/anim/_mod.inc>
 #include <menu/command/_mod.inc>
 #include <menu/item/_mod.inc>
+#include <menu/modules/_mod.inc>
 #include <menu/mutators/_mod.inc>
 #include <menu/xonotic/_mod.inc>
index da8675831a4d8e130e66df558f7ecb102625ce5a..2e36d72858b8770305cf9165d20af35a0f00c2d7 100644 (file)
@@ -7,5 +7,6 @@
 #include <menu/anim/_mod.qh>
 #include <menu/command/_mod.qh>
 #include <menu/item/_mod.qh>
+#include <menu/modules/_mod.qh>
 #include <menu/mutators/_mod.qh>
 #include <menu/xonotic/_mod.qh>
index 9b9dc0bf168597185e8067bbeebf931322fe3043..0bcef50de71c6d6f4b59d1a8574916f6c2866652 100644 (file)
@@ -1,3 +1,2 @@
 // generated file; do not modify
 #include <menu/command/menu_cmd.qc>
-#include <menu/command/notice.qc>
index 3633b94d9646542b258fc1a0c8e01f0b6b05d6a0..91c0a8f35e80a23ccdc487acb7a1ba1853d107e6 100644 (file)
@@ -1,3 +1,2 @@
 // generated file; do not modify
 #include <menu/command/menu_cmd.qh>
-#include <menu/command/notice.qh>
diff --git a/qcsrc/menu/command/notice.qc b/qcsrc/menu/command/notice.qc
deleted file mode 100644 (file)
index 8fee54d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "notice.qh"
-
-#include <common/sounds/all.qh>
-
-noref string autocvar__cl_hook_print = "menu_cmd notice";
-
-int notice_buffer;
-int notice_buffer_idx;
-
-STATIC_INIT(notice_buffer) {
-    notice_buffer = buf_create();
-}
-
-GENERIC_COMMAND(notice, "Append a notice to chat")
-{
-    switch(request)
-    {
-        case CMD_REQUEST_COMMAND:
-        {
-            string s = console_decode(substring(command, argv_start_index(1), argv_end_index(1) - argv_start_index(1)));
-            int flags = stoi(argv(2));
-            s = ColorTranslateRGB(s);
-            string prefix = (flags & NOTICE_CHAT) ? "\{3}" : "";
-            if (!(flags & NOTICE_SILENT)) {
-                entity snd = (flags & NOTICE_PRIVATE) ? SND_TALK2 : SND_TALK;
-                localsound(Sound_fixpath(snd));
-            }
-            bufstr_set(notice_buffer, notice_buffer_idx++, s);
-            print(prefix, "^7", s, "\n");
-            return;
-        }
-
-        default:
-        case CMD_REQUEST_USAGE:
-        {
-            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " notice message");
-            LOG_INFO("  Where 'message' is the message to append.");
-            return;
-        }
-    }
-}
diff --git a/qcsrc/menu/command/notice.qh b/qcsrc/menu/command/notice.qh
deleted file mode 100644 (file)
index dd58583..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-enum {
-    NOTICE_CHAT = BIT(0),
-    NOTICE_SILENT = BIT(1),
-    NOTICE_PRIVATE = BIT(2),
-};
diff --git a/qcsrc/menu/modules/_mod.inc b/qcsrc/menu/modules/_mod.inc
new file mode 100644 (file)
index 0000000..8b11cef
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+
+#include <menu/modules/chat/_mod.inc>
diff --git a/qcsrc/menu/modules/_mod.qh b/qcsrc/menu/modules/_mod.qh
new file mode 100644 (file)
index 0000000..026d482
--- /dev/null
@@ -0,0 +1,3 @@
+// generated file; do not modify
+
+#include <menu/modules/chat/_mod.qh>
diff --git a/qcsrc/menu/modules/chat/_mod.inc b/qcsrc/menu/modules/chat/_mod.inc
new file mode 100644 (file)
index 0000000..b8c8810
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include <menu/modules/chat/commands.qc>
diff --git a/qcsrc/menu/modules/chat/_mod.qh b/qcsrc/menu/modules/chat/_mod.qh
new file mode 100644 (file)
index 0000000..8eaea0a
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include <menu/modules/chat/commands.qh>
diff --git a/qcsrc/menu/modules/chat/commands.qc b/qcsrc/menu/modules/chat/commands.qc
new file mode 100644 (file)
index 0000000..668ff65
--- /dev/null
@@ -0,0 +1,41 @@
+#include "commands.qh"
+
+#include <common/sounds/all.qh>
+
+noref string autocvar__cl_hook_print = "menu_cmd notice";
+
+int notice_buffer;
+int notice_buffer_idx;
+
+STATIC_INIT(notice_buffer) {
+    notice_buffer = buf_create();
+}
+
+GENERIC_COMMAND(notice, "Append a notice to chat")
+{
+    switch(request)
+    {
+        case CMD_REQUEST_COMMAND:
+        {
+            string s = console_decode(substring(command, argv_start_index(1), argv_end_index(1) - argv_start_index(1)));
+            int flags = stoi(argv(2));
+            s = ColorTranslateRGB(s);
+            string prefix = (flags & NOTICE_CHAT) ? "\{3}" : "";
+            if (!(flags & NOTICE_SILENT)) {
+                entity snd = (flags & NOTICE_PRIVATE) ? SND_TALK2 : SND_TALK;
+                localsound(Sound_fixpath(snd));
+            }
+            bufstr_set(notice_buffer, notice_buffer_idx++, s);
+            print(prefix, "^7", s, "\n");
+            return;
+        }
+
+        default:
+        case CMD_REQUEST_USAGE:
+        {
+            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " notice message");
+            LOG_INFO("  Where 'message' is the message to append.");
+            return;
+        }
+    }
+}
diff --git a/qcsrc/menu/modules/chat/commands.qh b/qcsrc/menu/modules/chat/commands.qh
new file mode 100644 (file)
index 0000000..dd58583
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+enum {
+    NOTICE_CHAT = BIT(0),
+    NOTICE_SILENT = BIT(1),
+    NOTICE_PRIVATE = BIT(2),
+};
diff --git a/qcsrc/menu/modules/chat/interface.qh b/qcsrc/menu/modules/chat/interface.qh
new file mode 100644 (file)
index 0000000..1760a2e
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "commands.qh"
+
+string autocvar__cl_hook_print;