]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
menu QC builtin getgamedirinfo(float gamedirno, float index);
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 6 Aug 2009 19:14:30 +0000 (19:14 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 6 Aug 2009 19:14:30 +0000 (19:14 +0000)
index = 0: directory name
index = 1: description (modinfo.txt content)

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

mvm_cmds.c

index 876deaec6578b6817c17440a3b7bb98dbc714656..b2fbaaf0c6dc9cdfad7ad9edbc84a1eec239cbe8 100644 (file)
@@ -4,6 +4,8 @@
 #include "clvm_cmds.h"
 #include "menu.h"
 
+// TODO check which strings really should be engine strings
+
 //============================================================================
 // Menu
 
@@ -241,6 +243,25 @@ void VM_M_getresolution(void)
        }
 }
 
+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
@@ -1446,7 +1467,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);