]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mvm_cmds.c
extresponse: make svqc receive only those on the server socket, and csqc/menuqc only...
[xonotic/darkplaces.git] / mvm_cmds.c
index bb445a997ac3de5c5a7f3791beba6c261fcc5774..2bcf93feaff9ff1f37da5eb7455c740152fe35b5 100644 (file)
@@ -21,6 +21,7 @@ char *vm_m_extensions =
 "DP_QC_CVAR_TYPE "
 "DP_QC_CVAR_DESCRIPTION "
 "DP_QC_FINDCHAIN_TOFIELD "
+"DP_QC_LOG "
 "DP_QC_RENDER_SCENE "
 "DP_QC_STRFTIME "
 "DP_QC_STRINGBUFFERS "
@@ -146,74 +147,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;
-}
 
 /*
 =========
@@ -229,9 +162,9 @@ void VM_M_getresolution(void)
 
        nr = (int)PRVM_G_FLOAT(OFS_PARM0);
 
-       l = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1)));
+       fs = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1)));
 
-       if(nr < 0 || nr >= (l ? video_resolutions_count : video_resolutions_hardcoded_count))
+       if(nr < 0 || nr >= (fs ? video_resolutions_count : video_resolutions_hardcoded_count))
        {
                PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
                PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
@@ -239,9 +172,10 @@ void VM_M_getresolution(void)
        }
        else
        {
-               PRVM_G_VECTOR(OFS_RETURN)[0] = (l ? video_resolutions : video_resolutions_hardcoded)[nr].width;
-               PRVM_G_VECTOR(OFS_RETURN)[1] = (l ? video_resolutions : video_resolutions_hardcoded)[nr].height;
-               PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
+               video_resolution_t *r = &((fs ? video_resolutions : video_resolutions_hardcoded)[nr]);
+               PRVM_G_VECTOR(OFS_RETURN)[0] = r->width;
+               PRVM_G_VECTOR(OFS_RETURN)[1] = r->height;
+               PRVM_G_VECTOR(OFS_RETURN)[2] = r->pixelheight;
        }
 }
 
@@ -452,7 +386,7 @@ void VM_M_setserverlistmasknumber( void )
                        mask->info.freeslots = number;
                        break;
                case SLIF_ISFAVORITE:
-                       mask->info.isfavorite = number;
+                       mask->info.isfavorite = number != 0;
                        break;
                default:
                        VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
@@ -1376,7 +1310,7 @@ NULL,                                                                     // #528
 NULL,                                                                  // #529
 NULL,                                                                  // #530
 NULL,                                                                  // #531
-NULL,                                                                  // #532
+VM_log,                                                                        // #532
 NULL,                                                                  // #533
 NULL,                                                                  // #534
 NULL,                                                                  // #535
@@ -1449,9 +1383,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)
@@ -1468,7 +1402,7 @@ VM_M_refreshserverlist,                   // #620 void refreshhostcache(void)
 VM_M_getserverlistnumber,              // #621 float gethostcachenumber(float fld, float hostnr)
 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
 VM_M_addwantedserverlistkey,   // #623 void addwantedhostcachekey(string key)
-VM_getextresponse,                             // #624 string getextresponse(void)
+VM_CL_getextresponse,                  // #624 string getextresponse(void)
 VM_netaddress_resolve,          // #625 string netaddress_resolve(string, float)
 VM_M_getgamedirinfo,            // #626 string getgamedirinfo(float n, float prop)
 NULL