DP_QC_ENTITYSTRING: menu builtins like reading/writing whole entities -> svqc, csqc too
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 24 Oct 2009 16:38:15 +0000 (16:38 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 24 Oct 2009 16:38:15 +0000 (16:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9396 d7cf8633-e32d-0410-b094-e92efae38249

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

index 959e043..f11251b 100644 (file)
@@ -4165,8 +4165,8 @@ VM_CL_ParticleThemeSave,          // #525 void() particlethemesave, void(float theme) pa
 VM_CL_ParticleThemeFree,               // #526 void() particlethemefree (DP_CSQC_SPAWNPARTICLE)
 VM_CL_SpawnParticle,                   // #527 float(vector org, vector vel, [float theme]) particle (DP_CSQC_SPAWNPARTICLE)
 VM_CL_SpawnParticleDelayed,            // #528 float(vector org, vector vel, float delay, float collisiondelay, [float theme]) delayedparticle (DP_CSQC_SPAWNPARTICLE)
-NULL,                                                  // #529
-NULL,                                                  // #530
+VM_loadfromdata,                               // #529
+VM_loadfromfile,                               // #530
 NULL,                                                  // #531
 NULL,                                                  // #532
 NULL,                                                  // #533
@@ -4241,15 +4241,15 @@ NULL,                                                   // #601
 NULL,                                                  // #602
 NULL,                                                  // #603
 NULL,                                                  // #604
-NULL,                                                  // #605
-NULL,                                                  // #606
-NULL,                                                  // #607
+VM_callfunction,                               // #605
+VM_writetofile,                                        // #606
+VM_isfunction,                                 // #607
 NULL,                                                  // #608
 NULL,                                                  // #609
 NULL,                                                  // #610
 NULL,                                                  // #611
 NULL,                                                  // #612
-NULL,                                                  // #613
+VM_parseentitydata,                            // #613
 NULL,                                                  // #614
 NULL,                                                  // #615
 NULL,                                                  // #616
index 8b19327..b22db36 100644 (file)
@@ -146,74 +146,6 @@ void VM_M_getkeydest(void)
        }
 }
 
-/*
-=========
-VM_M_callfunction
-
-       callfunction(...,string function_name)
-Extension: pass
-=========
-*/
-mfunction_t *PRVM_ED_FindFunction (const char *name);
-void VM_M_callfunction(void)
-{
-       mfunction_t *func;
-       const char *s;
-
-       VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction);
-
-       s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
-
-       VM_CheckEmptyString(s);
-
-       func = PRVM_ED_FindFunction(s);
-
-       if(!func)
-               PRVM_ERROR("VM_M_callfunciton: function %s not found !", s);
-       else if (func->first_statement < 0)
-       {
-               // negative statements are built in functions
-               int builtinnumber = -func->first_statement;
-               prog->xfunction->builtinsprofile++;
-               if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
-                       prog->builtins[builtinnumber]();
-               else
-                       PRVM_ERROR("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, PRVM_NAME);
-       }
-       else if(func - prog->functions > 0)
-       {
-               prog->argc--;
-               PRVM_ExecuteProgram(func - prog->functions,"");
-               prog->argc++;
-       }
-}
-
-/*
-=========
-VM_M_isfunction
-
-float  isfunction(string function_name)
-=========
-*/
-mfunction_t *PRVM_ED_FindFunction (const char *name);
-void VM_M_isfunction(void)
-{
-       mfunction_t *func;
-       const char *s;
-
-       VM_SAFEPARMCOUNT(1, VM_M_isfunction);
-
-       s = PRVM_G_STRING(OFS_PARM0);
-
-       VM_CheckEmptyString(s);
-
-       func = PRVM_ED_FindFunction(s);
-
-       if(!func)
-               PRVM_G_FLOAT(OFS_RETURN) = false;
-       else
-               PRVM_G_FLOAT(OFS_RETURN) = true;
-}
 
 /*
 =========
@@ -1450,9 +1382,9 @@ VM_M_setkeydest,                                  // #601 void setkeydest(float dest)
 VM_M_getkeydest,                                       // #602 float getkeydest(void)
 VM_M_setmousetarget,                           // #603 void setmousetarget(float trg)
 VM_M_getmousetarget,                           // #604 float getmousetarget(void)
-VM_M_callfunction,                             // #605 void callfunction(...)
+VM_callfunction,                               // #605 void callfunction(...)
 VM_writetofile,                                        // #606 void writetofile(float fhandle, entity ent)
-VM_M_isfunction,                                       // #607 float isfunction(string function_name)
+VM_isfunction,                                 // #607 float isfunction(string function_name)
 VM_M_getresolution,                            // #608 vector getresolution(float number, [float forfullscreen])
 VM_keynumtostring,                             // #609 string keynumtostring(float keynum)
 VM_findkeysforcommand,         // #610 string findkeysforcommand(string command)
index d875d03..2950c00 100644 (file)
@@ -5295,3 +5295,72 @@ void VM_getextresponse (void)
                PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
        }
 }
+
+/*
+=========
+VM_M_callfunction
+
+       callfunction(...,string function_name)
+Extension: pass
+=========
+*/
+mfunction_t *PRVM_ED_FindFunction (const char *name);
+void VM_callfunction(void)
+{
+       mfunction_t *func;
+       const char *s;
+
+       VM_SAFEPARMCOUNTRANGE(1, 8, VM_callfunction);
+
+       s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
+
+       VM_CheckEmptyString(s);
+
+       func = PRVM_ED_FindFunction(s);
+
+       if(!func)
+               PRVM_ERROR("VM_callfunciton: function %s not found !", s);
+       else if (func->first_statement < 0)
+       {
+               // negative statements are built in functions
+               int builtinnumber = -func->first_statement;
+               prog->xfunction->builtinsprofile++;
+               if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
+                       prog->builtins[builtinnumber]();
+               else
+                       PRVM_ERROR("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, PRVM_NAME);
+       }
+       else if(func - prog->functions > 0)
+       {
+               prog->argc--;
+               PRVM_ExecuteProgram(func - prog->functions,"");
+               prog->argc++;
+       }
+}
+
+/*
+=========
+VM_isfunction
+
+float  isfunction(string function_name)
+=========
+*/
+mfunction_t *PRVM_ED_FindFunction (const char *name);
+void VM_isfunction(void)
+{
+       mfunction_t *func;
+       const char *s;
+
+       VM_SAFEPARMCOUNT(1, VM_isfunction);
+
+       s = PRVM_G_STRING(OFS_PARM0);
+
+       VM_CheckEmptyString(s);
+
+       func = PRVM_ED_FindFunction(s);
+
+       if(!func)
+               PRVM_G_FLOAT(OFS_RETURN) = false;
+       else
+               PRVM_G_FLOAT(OFS_RETURN) = true;
+}
index 6c549c2..cb83fb5 100644 (file)
@@ -443,3 +443,6 @@ void VM_buf_cvarlist(void);
 void VM_cvar_description(void);
 
 void VM_getextresponse (void);
+
+void VM_isfunction(void);
+void VM_callfunction(void);
index f25db91..879ada0 100644 (file)
@@ -71,6 +71,7 @@ char *vm_sv_extensions =
 "DP_QC_CVAR_TYPE "
 "DP_QC_EDICT_NUM "
 "DP_QC_ENTITYDATA "
+"DP_QC_ENTITYSTRING "
 "DP_QC_ETOS "
 "DP_QC_EXTRESPONSEPACKET "
 "DP_QC_FINDCHAIN "
@@ -3604,8 +3605,8 @@ NULL,                                                     // #525
 NULL,                                                  // #526
 NULL,                                                  // #527
 NULL,                                                  // #528
-NULL,                                                  // #529
-NULL,                                                  // #530
+VM_loadfromdata,                               // #529
+VM_loadfromfile,                               // #530
 VM_SV_setpause,                                        // #531 void(float pause) setpause = #531;
 NULL,                                                  // #532
 NULL,                                                  // #533
@@ -3680,15 +3681,15 @@ NULL,                                                   // #601
 NULL,                                                  // #602
 NULL,                                                  // #603
 NULL,                                                  // #604
-NULL,                                                  // #605
-NULL,                                                  // #606
-NULL,                                                  // #607
+VM_callfunction,                               // #605
+VM_writetofile,                                        // #606
+VM_isfunction,                                 // #607
 NULL,                                                  // #608
 NULL,                                                  // #609
 NULL,                                                  // #610
 NULL,                                                  // #611
 NULL,                                                  // #612
-NULL,                                                  // #613
+VM_parseentitydata,                            // #613
 NULL,                                                  // #614
 NULL,                                                  // #615
 NULL,                                                  // #616