patch from esteel making the findkeysforcommand builtin available in
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 16 Sep 2008 13:36:21 +0000 (13:36 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 16 Sep 2008 13:36:21 +0000 (13:36 +0000)
csqc (formerly only available in menu qc)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8506 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
mvm_cmds.c
prvm_cmds.c
prvm_cmds.h

index f1d3b4a..289e531 100644 (file)
@@ -3494,6 +3494,8 @@ NULL,                                                     // #516
 NULL,                                                  // #517
 NULL,                                                  // #518
 NULL,                                                  // #519
+VM_keynumtostring,                             // #520 string keynumtostring(float keynum)
+VM_findkeysforcommand,         // #521 string findkeysforcommand(string command)
 };
 
 const int vm_cl_numbuiltins = sizeof(vm_cl_builtins) / sizeof(prvm_builtin_t);
index 5b507dd..d4c447b 100644 (file)
@@ -231,40 +231,6 @@ void VM_M_getresolution(void)
 
 /*
 =========
-VM_M_findkeysforcommand
-
-string findkeysforcommand(string command)
-
-the returned string is an altstring
-=========
-*/
-#define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
-
-void M_FindKeysForCommand(const char *command, int *keys);
-void VM_M_findkeysforcommand(void)
-{
-       const char *cmd;
-       char ret[VM_STRINGTEMP_LENGTH];
-       int keys[NUMKEYS];
-       int i;
-
-       VM_SAFEPARMCOUNT(1, VM_M_findkeysforcommand);
-
-       cmd = PRVM_G_STRING(OFS_PARM0);
-
-       VM_CheckEmptyString(cmd);
-
-       M_FindKeysForCommand(cmd, keys);
-
-       ret[0] = 0;
-       for(i = 0; i < NUMKEYS; i++)
-               strlcat(ret, va(" \'%i\'", keys[i]), sizeof(ret));
-
-       PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(ret);
-}
-
-/*
-=========
 VM_M_getserverliststat
 
 float  getserverliststat(float type)
@@ -1454,7 +1420,7 @@ VM_writetofile,                                   // #606 void writetofile(float fhandle, entity ent)
 VM_M_isfunction,                                       // #607 float isfunction(string function_name)
 VM_M_getresolution,                            // #608 vector getresolution(float number)
 VM_keynumtostring,                             // #609 string keynumtostring(float keynum)
-VM_M_findkeysforcommand,               // #610 string findkeysforcommand(string command)
+VM_findkeysforcommand,         // #610 string findkeysforcommand(string command)
 VM_M_getserverliststat,                        // #611 float gethostcachevalue(float type)
 VM_M_getserverliststring,              // #612 string gethostcachestring(float type, float hostnr)
 VM_parseentitydata,                            // #613 void parseentitydata(entity ent, string data)
index 2a4ebc8..6d88a9d 100644 (file)
@@ -3175,6 +3175,40 @@ void VM_keynumtostring (void)
 
 /*
 =========
+VM_findkeysforcommand
+
+string findkeysforcommand(string command)
+
+the returned string is an altstring
+=========
+*/
+#define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
+
+void M_FindKeysForCommand(const char *command, int *keys);
+void VM_findkeysforcommand(void)
+{
+       const char *cmd;
+       char ret[VM_STRINGTEMP_LENGTH];
+       int keys[NUMKEYS];
+       int i;
+
+       VM_SAFEPARMCOUNT(1, VM_findkeysforcommand);
+
+       cmd = PRVM_G_STRING(OFS_PARM0);
+
+       VM_CheckEmptyString(cmd);
+
+       M_FindKeysForCommand(cmd, keys);
+
+       ret[0] = 0;
+       for(i = 0; i < NUMKEYS; i++)
+               strlcat(ret, va(" \'%i\'", keys[i]), sizeof(ret));
+
+       PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(ret);
+}
+
+/*
+=========
 VM_stringtokeynum
 
 float stringtokeynum(string key)
index 54c8d7d..42cd5d7 100644 (file)
@@ -359,6 +359,7 @@ void VM_makevectors (void);
 void VM_vectorvectors (void);
 
 void VM_keynumtostring (void);
+void VM_findkeysforcommand (void);
 void VM_stringtokeynum (void);
 
 void VM_cin_open( void );