]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mvm_cmds.c
also check ticrate movevar
[xonotic/darkplaces.git] / mvm_cmds.c
index 876deaec6578b6817c17440a3b7bb98dbc714656..9b832d7c91baf4afcfddd5de3373c174fc7705bd 100644 (file)
@@ -4,6 +4,8 @@
 #include "clvm_cmds.h"
 #include "menu.h"
 
+// TODO check which strings really should be engine strings
+
 //============================================================================
 // Menu
 
@@ -222,12 +224,14 @@ vector    getresolution(float number)
 */
 void VM_M_getresolution(void)
 {
-       int nr;
-       VM_SAFEPARMCOUNT(1, VM_getresolution);
+       int nr, fs;
+       VM_SAFEPARMCOUNTRANGE(1, 2, VM_getresolution);
 
        nr = (int)PRVM_G_FLOAT(OFS_PARM0);
 
-       if(nr < 0 || nr >= video_resolutions_count)
+       fs = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1)));
+
+       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;
@@ -235,12 +239,31 @@ void VM_M_getresolution(void)
        }
        else
        {
-               PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width;
-               PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height;
+               PRVM_G_VECTOR(OFS_RETURN)[0] = (fs ? video_resolutions : video_resolutions_hardcoded)[nr].width;
+               PRVM_G_VECTOR(OFS_RETURN)[1] = (fs ? video_resolutions : video_resolutions_hardcoded)[nr].height;
                PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
        }
 }
 
+void VM_M_getgamedirinfo(void)
+{
+       int nr, item;
+       VM_SAFEPARMCOUNT(2, VM_getgamedirinfo);
+
+       nr = (int)PRVM_G_FLOAT(OFS_PARM0);
+       item = (int)PRVM_G_FLOAT(OFS_PARM1);
+
+       PRVM_G_INT( OFS_RETURN ) = OFS_NULL;
+
+       if(nr >= 0 && nr < fs_all_gamedirs_count)
+       {
+               if(item == 0)
+                       PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( fs_all_gamedirs[nr].name );
+               else if(item == 1)
+                       PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( fs_all_gamedirs[nr].description );
+       }
+}
+
 /*
 =========
 VM_M_getserverliststat
@@ -1429,7 +1452,7 @@ VM_M_getmousetarget,                              // #604 float getmousetarget(void)
 VM_M_callfunction,                             // #605 void callfunction(...)
 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_M_getresolution,                            // #608 vector getresolution(float number, [float forfullscreen])
 VM_keynumtostring,                             // #609 string keynumtostring(float keynum)
 VM_findkeysforcommand,         // #610 string findkeysforcommand(string command)
 VM_M_getserverliststat,                        // #611 float gethostcachevalue(float type)
@@ -1446,7 +1469,9 @@ VM_M_getserverlistnumber,         // #621 float gethostcachenumber(float fld, float hos
 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
 VM_M_addwantedserverlistkey,   // #623 void addwantedhostcachekey(string key)
 VM_getextresponse,                             // #624 string getextresponse(void)
-VM_netaddress_resolve           // #625 string netaddress_resolve(string, float)
+VM_netaddress_resolve,          // #625 string netaddress_resolve(string, float)
+VM_M_getgamedirinfo,            // #626 string getgamedirinfo(float n, float prop)
+NULL
 };
 
 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);