]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
menuqc: declare localcmd() and deduplicate it
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 2 Apr 2024 07:03:40 +0000 (17:03 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 2 Apr 2024 07:17:11 +0000 (17:17 +1000)
It's awkward having a different name for the same builtin in a different
VM, Xonotic was working around it (for code sharing) with a macro.

clvm_cmds.c
dpdefs/menudefs.qc
mvm_cmds.c
prvm_cmds.c
prvm_cmds.h
svvm_cmds.c

index a08bb6ba8a9b95e5a8ec818aac8b889c62eafd60..f3e986ed278ca2a07e3122653cf4cc7455f4b0ed 100644 (file)
@@ -5028,7 +5028,7 @@ NULL,                                                     // #42 (QUAKE)
 VM_fabs,                                               // #43 float(float f) fabs (QUAKE)
 NULL,                                                  // #44 vector(entity e, float speed) aim (QUAKE)
 VM_cvar,                                               // #45 float(string s) cvar (QUAKE)
-VM_localcmd_local,                             // #46 void(string s) localcmd (QUAKE)
+VM_localcmd,                                   // #46 void(string s) localcmd (QUAKE)
 VM_nextent,                                            // #47 entity(entity e) nextent (QUAKE)
 VM_CL_particle,                                        // #48 void(vector o, vector d, float color, float count) particle (QUAKE)
 VM_changeyaw,                                  // #49 void() ChangeYaw (QUAKE)
index b987491b7cf778c5ea33bcfb2f783851b5a60461..93bdff12d6fbe9a0a455f214651c3d59403d3140 100644 (file)
@@ -182,6 +182,7 @@ vector      vectoangles(vector v)           = #11;
 float  random(void)  = #12; // Returns a random number > 0 and < 1
 
 void   cmd(string command, ...) = #13;
+void localcmd(string command, ...) = #13;
 
 // cvar cmds
 
index 86ea2fd346e38ca55a5256cb55191085ace45dd0..41c0d1bb82f8d7e0f6ed04cffc35ff68ec59354e 100644 (file)
@@ -1075,7 +1075,7 @@ VM_vlen,                                                          //   #9
 VM_vectoyaw,                                           //  #10
 VM_vectoangles,                                        //  #11
 VM_random,                                                     //  #12
-VM_localcmd_local,                                             //  #13
+VM_localcmd,                                           //  #13
 VM_cvar,                                                               //  #14
 VM_cvar_set,                                           //  #15
 VM_dprint,                                                     //  #16
index 6a19baff45df819cfb499a71809ce872d683377f..1fb432c9824d4db3f4727924035e7c910df685ad 100644 (file)
@@ -667,36 +667,18 @@ void VM_break(prvm_prog_t *prog)
 
 /*
 =================
-VM_localcmd_local
+VM_localcmd
 
-Sends text over to the client's execution buffer
+Appends text to the command buffer
 
 [localcmd (string, ...) or]
 cmd (string, ...)
 =================
 */
-void VM_localcmd_local(prvm_prog_t *prog)
+void VM_localcmd(prvm_prog_t *prog)
 {
        char string[VM_TEMPSTRING_MAXSIZE];
-       VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_local);
-       VM_VarString(prog, 0, string, sizeof(string));
-       Cbuf_AddText(cmd_local, string);
-}
-
-/*
-=================
-VM_localcmd_server
-
-Sends text over to the server's execution buffer
-
-[localcmd (string, ...) or]
-cmd (string, ...)
-=================
-*/
-void VM_localcmd_server(prvm_prog_t *prog)
-{
-       char string[VM_TEMPSTRING_MAXSIZE];
-       VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_server);
+       VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd);
        VM_VarString(prog, 0, string, sizeof(string));
        Cbuf_AddText(cmd_local, string);
 }
index efc70f7db4dd8b2db45f5f3c9c6102a6ee2583a5..292e8f556b7da7c0b1d4c84f2f447c1a6f63a5d2 100644 (file)
@@ -239,8 +239,7 @@ void VM_vectoangles (prvm_prog_t *prog);
 void VM_random (prvm_prog_t *prog);
 void VM_localsound(prvm_prog_t *prog);
 void VM_break (prvm_prog_t *prog);
-void VM_localcmd_local(prvm_prog_t *prog);
-void VM_localcmd_server(prvm_prog_t *prog);
+void VM_localcmd(prvm_prog_t *prog);
 void VM_cvar (prvm_prog_t *prog);
 void VM_cvar_string(prvm_prog_t *prog);
 void VM_cvar_type (prvm_prog_t *prog);
index 8a6a81ecb2aac735b999906c3df3f39fce02f1f7..4ad07559b7473ba25fbf1fe0007c88c3ee19795a 100644 (file)
@@ -3310,7 +3310,7 @@ NULL,                                                     // #42 (QUAKE)
 VM_fabs,                                               // #43 float(float f) fabs (QUAKE)
 VM_SV_aim,                                             // #44 vector(entity e, float speed) aim (QUAKE)
 VM_cvar,                                               // #45 float(string s) cvar (QUAKE)
-VM_localcmd_server,                            // #46 void(string s) localcmd (QUAKE)
+VM_localcmd,                                   // #46 void(string s) localcmd (QUAKE)
 VM_nextent,                                            // #47 entity(entity e) nextent (QUAKE)
 VM_SV_particle,                                        // #48 void(vector o, vector d, float color, float count) particle (QUAKE)
 VM_changeyaw,                                  // #49 void() ChangeYaw (QUAKE)