]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
menu: Partially implement MQC built-in #352 (registercommand). Not enabled yet due...
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Apr 2021 13:24:11 +0000 (13:24 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Apr 2021 13:24:11 +0000 (13:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13128 d7cf8633-e32d-0410-b094-e92efae38249

menu.h
mvm_cmds.c

diff --git a/menu.h b/menu.h
index d0b3189ebab49e3d43a462a9d4eb939594df8304..38a034f6629b1d419dbc6b996bca5c025e184e31 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -72,6 +72,8 @@ void MP_Draw (void);
 void MP_ToggleMenu (int mode);
 void MP_Shutdown (void);*/
 
+qbool MP_ConsoleCommand(const char *text);
+
 //
 // menu router
 //
index 3168bbf445ac3de706a2a149b9d7d4a0c9287bd9..337d196bd037d5794d44f06b4c785841b78de60a 100644 (file)
@@ -53,6 +53,12 @@ const char *vm_m_extensions[] = {
 NULL
 };
 
+qbool MP_ConsoleCommand(const char *text)
+{
+       prvm_prog_t *prog = MVM_prog;
+       return PRVM_ConsoleCommand(prog, text, &prog->funcoffsets.GameCommand, false, -1, 0, prog->loaded, "QC function GameCommand is missing");
+}
+
 /*
 =========
 VM_M_setmousetarget
@@ -1049,6 +1055,13 @@ void VM_cin_restart(prvm_prog_t *prog)
                CL_RestartVideo( video );
 }
 
+static void VM_M_registercommand(prvm_prog_t *prog)
+{
+       VM_SAFEPARMCOUNT(1, VM_M_registercommand);
+       if(!Cmd_Exists(cmd_client, PRVM_G_STRING(OFS_PARM0)))
+               Cmd_AddCommand(CF_CLIENT, PRVM_G_STRING(OFS_PARM0), NULL, "console command created by QuakeC");
+}
+
 prvm_builtin_t vm_m_builtins[] = {
 NULL,                                                                  //   #0 NULL function (not callable)
 VM_checkextension,                             //   #1
@@ -1429,7 +1442,7 @@ NULL,                                                                     // #348
 VM_CL_isdemo,                                                  // #349
 NULL,                                                                  // #350
 NULL,                                                                  // #351
-NULL,                                                                  // #352
+VM_M_registercommand,                                  // #352 void(string cmdname)
 VM_wasfreed,                                                   // #353 float(entity ent) wasfreed
 NULL,                                                                  // #354
 VM_CL_videoplaying,                                            // #355