X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=mvm_cmds.c;h=bc43c092af2d417427191e2461ec1d287ae15f55;hb=f2467d484c38a13d23bb92f91c19a9d6a71f7bec;hp=71e59ab20e1e72918542a0bda2d678decf1540b7;hpb=46cfccb1fef9095b35d4f6c37876a178361e3174;p=xonotic%2Fdarkplaces.git diff --git a/mvm_cmds.c b/mvm_cmds.c index 71e59ab2..bc43c092 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -4,25 +4,40 @@ #include "clvm_cmds.h" #include "menu.h" +// TODO check which strings really should be engine strings + //============================================================================ // Menu char *vm_m_extensions = "BX_WAL_SUPPORT " "DP_CINEMATIC_DPV " +"DP_FONT_VARIABLEWIDTH " +"DP_GECKO_SUPPORT " "DP_MENU_EXTRESPONSEPACKET " "DP_QC_ASINACOSATANATAN2TAN " +"DP_QC_AUTOCVARS " +"DP_QC_CMD " +"DP_QC_CRC16 " +"DP_QC_CVAR_TYPE " +"DP_QC_CVAR_DESCRIPTION " +"DP_QC_FINDCHAIN_TOFIELD " +"DP_QC_LOG " +"DP_QC_RENDER_SCENE " +"DP_QC_SPRINTF " "DP_QC_STRFTIME " -"DP_QC_STRING_CASE_FUNCTIONS " +"DP_QC_STRINGBUFFERS " +"DP_QC_STRINGBUFFERS_CVARLIST " "DP_QC_STRINGCOLORFUNCTIONS " +"DP_QC_STRING_CASE_FUNCTIONS " +"DP_QC_STRREPLACE " "DP_QC_TOKENIZEBYSEPARATOR " +"DP_QC_TOKENIZE_CONSOLE " "DP_QC_UNLIMITEDTEMPSTRINGS " -"DP_QC_CMD " -"DP_QC_STRREPLACE " -"DP_FONT_VARIABLEWIDTH " -// FIXME: rename this extension maybe? [12/5/2007 Black] -"DP_GECKO_SUPPORT " -"DP_QC_RENDER_SCENE" +"DP_QC_URI_ESCAPE " +"DP_QC_URI_GET " +"DP_QC_WHICHPACK " +"FTE_STRINGS " ; /* @@ -134,127 +149,55 @@ void VM_M_getkeydest(void) } } + /* ========= -VM_M_callfunction +VM_M_getresolution - callfunction(...,string function_name) -Extension: pass +vector getresolution(float number) ========= */ -mfunction_t *PRVM_ED_FindFunction (const char *name); -void VM_M_callfunction(void) +void VM_M_getresolution(void) { - mfunction_t *func; - const char *s; - - VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction); - - s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3); + int nr, fs; + VM_SAFEPARMCOUNTRANGE(1, 2, VM_getresolution); - VM_CheckEmptyString(s); + nr = (int)PRVM_G_FLOAT(OFS_PARM0); - func = PRVM_ED_FindFunction(s); + fs = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1))); - if(!func) - PRVM_ERROR("VM_M_callfunciton: function %s not found !", s); - else if (func->first_statement < 0) + if(nr < 0 || nr >= (fs ? video_resolutions_count : video_resolutions_hardcoded_count)) { - // 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", builtinnumber, PRVM_NAME); + PRVM_G_VECTOR(OFS_RETURN)[0] = 0; + PRVM_G_VECTOR(OFS_RETURN)[1] = 0; + PRVM_G_VECTOR(OFS_RETURN)[2] = 0; } - else if(func - prog->functions > 0) + else { - prog->argc--; - PRVM_ExecuteProgram(func - prog->functions,""); - prog->argc++; + 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; } } -/* -========= -VM_M_isfunction - -float isfunction(string function_name) -========= -*/ -mfunction_t *PRVM_ED_FindFunction (const char *name); -void VM_M_isfunction(void) +void VM_M_getgamedirinfo(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; -} - -/* -========= -VM_M_getresolution - -vector getresolution(float number) -========= -*/ -void VM_M_getresolution(void) -{ - int nr; - VM_SAFEPARMCOUNT(1, VM_getresolution); + int nr, item; + VM_SAFEPARMCOUNT(2, VM_getgamedirinfo); nr = (int)PRVM_G_FLOAT(OFS_PARM0); + item = (int)PRVM_G_FLOAT(OFS_PARM1); - // FIXME bounds check - 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)[2] = 0; -} + PRVM_G_INT( OFS_RETURN ) = OFS_NULL; -/* -========= -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); + if(nr >= 0 && nr < fs_all_gamedirs_count) + { + if(item == 0) + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( fs_all_gamedirs[nr].name ); + else if(item == 1) + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( fs_all_gamedirs[nr].description ); + } } /* @@ -273,7 +216,7 @@ float getserverliststat(float type) 4 serverquerycount 5 serverreplycount 6 sortfield -7 sortdescending +7 sortflags */ void VM_M_getserverliststat( void ) { @@ -306,7 +249,7 @@ void VM_M_getserverliststat( void ) PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield; return; case 7: - PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortdescending; + PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortflags; return; default: VM_Warning( "VM_M_getserverliststat: bad type %i!\n", type ); @@ -361,19 +304,25 @@ void VM_M_setserverlistmaskstring( void ) switch( field ) { case SLIF_CNAME: - strlcpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) ); + strlcpy( mask->info.cname, str, sizeof(mask->info.cname) ); break; case SLIF_NAME: - strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name) ); + strlcpy( mask->info.name, str, sizeof(mask->info.name) ); + break; + case SLIF_QCSTATUS: + strlcpy( mask->info.qcstatus, str, sizeof(mask->info.qcstatus) ); + break; + case SLIF_PLAYERS: + strlcpy( mask->info.players, str, sizeof(mask->info.players) ); break; case SLIF_MAP: - strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map) ); + strlcpy( mask->info.map, str, sizeof(mask->info.map) ); break; case SLIF_MOD: - strlcpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod) ); + strlcpy( mask->info.mod, str, sizeof(mask->info.mod) ); break; case SLIF_GAME: - strlcpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game) ); + strlcpy( mask->info.game, str, sizeof(mask->info.game) ); break; default: VM_Warning( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field ); @@ -438,6 +387,9 @@ void VM_M_setserverlistmasknumber( void ) case SLIF_FREESLOTS: mask->info.freeslots = number; break; + case SLIF_ISFAVORITE: + mask->info.isfavorite = number != 0; + break; default: VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field ); return; @@ -484,29 +436,35 @@ void VM_M_getserverliststring(void) Con_Print("VM_M_getserverliststring: bad hostnr passed!\n"); return; } - cache = serverlist_viewlist[hostnr]; + cache = ServerList_GetViewEntry(hostnr); switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) { case SLIF_CNAME: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->info.cname ); break; case SLIF_NAME: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->info.name ); + break; + case SLIF_QCSTATUS: + PRVM_G_INT (OFS_RETURN ) = PRVM_SetTempString (cache->info.qcstatus ); + break; + case SLIF_PLAYERS: + PRVM_G_INT (OFS_RETURN ) = PRVM_SetTempString (cache->info.players ); break; case SLIF_GAME: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->info.game ); break; case SLIF_MOD: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->info.mod ); break; case SLIF_MAP: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->info.map ); break; // TODO remove this again case 1024: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->line1 ); break; case 1025: - PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 ); + PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( cache->line2 ); break; default: Con_Print("VM_M_getserverliststring: bad field number passed!\n"); @@ -536,7 +494,7 @@ void VM_M_getserverlistnumber(void) Con_Print("VM_M_getserverliststring: bad hostnr passed!\n"); return; } - cache = serverlist_viewlist[hostnr]; + cache = ServerList_GetViewEntry(hostnr); switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) { case SLIF_MAXPLAYERS: PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers; @@ -559,6 +517,9 @@ void VM_M_getserverlistnumber(void) case SLIF_PROTOCOL: PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol; break; + case SLIF_ISFAVORITE: + PRVM_G_FLOAT( OFS_RETURN ) = cache->info.isfavorite; + break; default: Con_Print("VM_M_getserverlistnumber: bad field number passed!\n"); } @@ -568,7 +529,7 @@ void VM_M_getserverlistnumber(void) ======================== VM_M_setserverlistsort -setserverlistsort(float field, float descending) +setserverlistsort(float field, float flags) ======================== */ void VM_M_setserverlistsort( void ) @@ -576,7 +537,7 @@ void VM_M_setserverlistsort( void ) VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort ); serverlist_sortbyfield = (serverlist_infofield_t)((int)PRVM_G_FLOAT( OFS_PARM0 )); - serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 ); + serverlist_sortflags = (int) PRVM_G_FLOAT( OFS_PARM1 ); } /* @@ -619,6 +580,10 @@ void VM_M_getserverlistindexforkey( void ) PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP; else if( !strcmp( key, "name" ) ) PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME; + else if( !strcmp( key, "qcstatus" ) ) + PRVM_G_FLOAT( OFS_RETURN ) = SLIF_QCSTATUS; + else if( !strcmp( key, "players" ) ) + PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PLAYERS; else if( !strcmp( key, "maxplayers" ) ) PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS; else if( !strcmp( key, "numplayers" ) ) @@ -631,6 +596,8 @@ void VM_M_getserverlistindexforkey( void ) PRVM_G_FLOAT( OFS_RETURN ) = SLIF_FREESLOTS; else if( !strcmp( key, "protocol" ) ) PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL; + else if( !strcmp( key, "isfavorite" ) ) + PRVM_G_FLOAT( OFS_RETURN ) = SLIF_ISFAVORITE; else PRVM_G_FLOAT( OFS_RETURN ) = -1; } @@ -747,22 +714,6 @@ void VM_M_WriteEntity (void) MSG_WriteShort (VM_M_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0)); } -//string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client -void VM_M_getextresponse (void) -{ - VM_SAFEPARMCOUNT(0,VM_argv); - - if (net_extresponse_count <= 0) - PRVM_G_INT(OFS_RETURN) = OFS_NULL; - else - { - int first; - --net_extresponse_count; - first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX; - PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]); - } -} - /* ================= VM_M_copyentity @@ -781,6 +732,26 @@ static void VM_M_copyentity (void) memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4); } +//#66 vector() getmousepos (EXT_CSQC) +static void VM_M_getmousepos(void) +{ + VM_SAFEPARMCOUNT(0,VM_M_getmousepos); + + if (key_consoleactive || (key_dest != key_menu && key_dest != key_menu_grabbed)) + VectorSet(PRVM_G_VECTOR(OFS_RETURN), 0, 0, 0); + else if (in_client_mouse) + VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0); + else + VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0); +} + +//#349 float() isdemo (EXT_CSQC) +static void VM_M_isdemo (void) +{ + VM_SAFEPARMCOUNT(0, VM_M_isdemo); + PRVM_G_FLOAT(OFS_RETURN) = cls.demoplayback; +} + prvm_builtin_t vm_m_builtins[] = { NULL, // #0 NULL function (not callable) VM_checkextension, // #1 @@ -848,7 +819,7 @@ VM_clientstate, // #62 VM_clcommand, // #63 VM_changelevel, // #64 VM_localsound, // #65 -VM_getmousepos, // #66 +VM_M_getmousepos, // #66 VM_gettime, // #67 VM_loadfromdata, // #68 VM_loadfromfile, // #69 @@ -872,9 +843,16 @@ VM_altstr_ins, // #86 VM_findflags, // #87 VM_findchainflags, // #88 VM_cvar_defstring, // #89 +// deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas] +#if 0 VM_CL_setmodel, // #90 void(entity e, string m) setmodel (QUAKE) VM_CL_precache_model, // #91 void(string s) precache_model (QUAKE) VM_CL_setorigin, // #92 void(entity e, vector o) setorigin (QUAKE) +#else +NULL, +NULL, +NULL, +#endif NULL, // #93 NULL, // #94 NULL, // #95 @@ -1004,12 +982,12 @@ NULL, // #218 NULL, // #219 NULL, // #220 VM_strstrofs, // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS) -NULL, // #222 -NULL, // #223 -NULL, // #224 -NULL, // #225 -NULL, // #226 -NULL, // #227 +VM_str2chr, // #222 float(string str, float ofs) str2chr (FTE_STRINGS) +VM_chr2str, // #223 string(float c, ...) chr2str (FTE_STRINGS) +VM_strconv, // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS) +VM_strpad, // #225 string(float chars, string s, ...) strpad (FTE_STRINGS) +VM_infoadd, // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS) +VM_infoget, // #227 string(string info, string key) infoget (FTE_STRINGS) VM_strncmp, // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS) VM_strncasecmp, // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS) VM_strncasecmp, // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS) @@ -1082,6 +1060,8 @@ NULL, // #296 NULL, // #297 NULL, // #298 NULL, // #299 +// deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas] +#if 0 // CSQC range #300-#399 VM_CL_R_ClearScene, // #300 void() clearscene (DP_QC_RENDER_SCENE) VM_CL_R_AddEntities, // #301 void(float mask) addentities (DP_QC_RENDER_SCENE) @@ -1089,13 +1069,30 @@ VM_CL_R_AddEntity, // #302 void(entity ent) addentity (DP_QC_RENDER_SCENE) VM_CL_R_SetView, // #303 float(float property, ...) setproperty (DP_QC_RENDER_SCENE) VM_CL_R_RenderScene, // #304 void() renderscene (DP_QC_RENDER_SCENE) VM_CL_R_AddDynamicLight, // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (DP_QC_RENDER_SCENE) -VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon -VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex +VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon (DP_QC_RENDER_SCENE) +VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (DP_QC_RENDER_SCENE) VM_CL_R_PolygonEnd, // #308 void() R_EndPolygon NULL/*VM_CL_R_LoadWorldModel*/, // #309 void(string modelname) R_LoadWorldModel -NULL, // #310 -NULL, // #311 -NULL, // #312 +// TODO: rearrange and merge all builtin lists and share as many extensions as possible between all VM instances [1/27/2008 Andreas] +VM_CL_setattachment, // #310 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) (DP_QC_RENDER_SCENE) +VM_CL_gettagindex, // #311 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE) +VM_CL_gettaginfo, // #312 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE) +#else +// CSQC range #300-#399 +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +NULL, +#endif NULL, // #313 NULL, // #314 NULL, // #315 @@ -1132,7 +1129,7 @@ NULL, // #345 NULL, // #346 NULL, // #347 NULL, // #348 -NULL, // #349 +VM_M_isdemo, // #349 NULL, // #350 NULL, // #351 NULL, // #352 @@ -1223,16 +1220,16 @@ NULL, // #436 NULL, // #437 NULL, // #438 NULL, // #439 -NULL, // #440 -NULL, // #441 -NULL, // #442 -NULL, // #443 -NULL, // #444 -NULL, // #445 -NULL, // #446 -NULL, // #447 -NULL, // #448 -NULL, // #449 +VM_buf_create, // #440 float() buf_create (DP_QC_STRINGBUFFERS) +VM_buf_del, // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS) +VM_buf_getsize, // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS) +VM_buf_copy, // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS) +VM_buf_sort, // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS) +VM_buf_implode, // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS) +VM_bufstr_get, // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS) +VM_bufstr_set, // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS) +VM_bufstr_add, // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS) +VM_bufstr_free, // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS) NULL, // #450 VM_iscachedpic, // #451 draw functions... VM_precache_pic, // #452 @@ -1253,7 +1250,7 @@ VM_drawline, // #466 VM_drawcolorcodedstring, // #467 VM_stringwidth, // #468 VM_drawsubpic, // #469 -NULL, // #470 +VM_drawrotpic, // #470 VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN) VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN) VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN) @@ -1277,8 +1274,8 @@ VM_gecko_keyevent, // #490 float gecko_keyevent( string name, float key, floa VM_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y ) VM_gecko_resize, // #492 void gecko_resize( string name, float w, float h ) VM_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name ) -NULL, // #494 -NULL, // #495 +VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16) +VM_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE) NULL, // #496 NULL, // #497 NULL, // #498 @@ -1286,22 +1283,22 @@ NULL, // #499 NULL, // #500 NULL, // #501 NULL, // #502 -NULL, // #503 +VM_whichpack, // #503 string(string) whichpack = #503; NULL, // #504 NULL, // #505 NULL, // #506 NULL, // #507 NULL, // #508 NULL, // #509 -NULL, // #510 -NULL, // #511 -NULL, // #512 -NULL, // #513 -NULL, // #514 -NULL, // #515 -NULL, // #516 -NULL, // #517 -NULL, // #518 +VM_uri_escape, // #510 string(string in) uri_escape = #510; +VM_uri_unescape, // #511 string(string in) uri_unescape = #511; +VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT) +VM_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET) +VM_tokenize_console, // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE) +VM_argv_start_index, // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE) +VM_argv_end_index, // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE) +VM_buf_cvarlist, // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST) +VM_cvar_description, // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION) NULL, // #519 NULL, // #520 NULL, // #521 @@ -1315,7 +1312,7 @@ NULL, // #528 NULL, // #529 NULL, // #530 NULL, // #531 -NULL, // #532 +VM_log, // #532 NULL, // #533 NULL, // #534 NULL, // #535 @@ -1388,12 +1385,12 @@ 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_M_getresolution, // #608 vector getresolution(float number) +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_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) @@ -1407,29 +1404,39 @@ 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_M_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) +VM_sprintf, // #627 string sprintf(string format, ...) +NULL }; const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t); -r_refdef_scene_t menu_scene; - void VM_M_Cmd_Init(void) { + r_refdef_scene_t *scene; + VM_Cmd_Init(); VM_Polygons_Reset(); - memset (&menu_scene, 0, sizeof (menu_scene)); + scene = R_GetScenePointer( RST_MENU ); + + memset (scene, 0, sizeof (*scene)); - menu_scene.maxtempentities = 128; - menu_scene.tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * menu_scene.maxtempentities); + scene->maxtempentities = 128; + scene->tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * scene->maxtempentities); - menu_scene.maxentities = MAX_EDICTS + 256 + 512; - menu_scene.entities = (entity_render_t **)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t *) * menu_scene.maxentities); + scene->maxentities = MAX_EDICTS + 256 + 512; + scene->entities = (entity_render_t **)Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t *) * scene->maxentities); + + scene->ambient = 32.0f; } void VM_M_Cmd_Reset(void) { + // note: the menu's render entities are automatically freed when the prog's pool is freed + //VM_Cmd_Init(); VM_Cmd_Reset(); VM_Polygons_Reset();