7 //============================================================================
10 char *vm_m_extensions =
13 "DP_FONT_VARIABLEWIDTH "
15 "DP_MENU_EXTRESPONSEPACKET "
16 "DP_QC_ASINACOSATANATAN2TAN "
22 "DP_QC_STRINGBUFFERS "
23 "DP_QC_STRINGCOLORFUNCTIONS "
24 "DP_QC_STRING_CASE_FUNCTIONS "
26 "DP_QC_TOKENIZEBYSEPARATOR "
27 "DP_QC_UNLIMITEDTEMPSTRINGS "
38 setmousetarget(float target)
41 void VM_M_setmousetarget(void)
43 VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
45 switch((int)PRVM_G_FLOAT(OFS_PARM0))
48 in_client_mouse = false;
51 in_client_mouse = true;
54 PRVM_ERROR("VM_M_setmousetarget: wrong destination %f !",PRVM_G_FLOAT(OFS_PARM0));
65 void VM_M_getmousetarget(void)
67 VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
70 PRVM_G_FLOAT(OFS_RETURN) = 2;
72 PRVM_G_FLOAT(OFS_RETURN) = 1;
81 setkeydest(float dest)
84 void VM_M_setkeydest(void)
86 VM_SAFEPARMCOUNT(1,VM_M_setkeydest);
88 switch((int)PRVM_G_FLOAT(OFS_PARM0))
100 key_dest = key_menu_grabbed;
104 // key_dest = key_message
107 PRVM_ERROR("VM_M_setkeydest: wrong destination %f !", PRVM_G_FLOAT(OFS_PARM0));
118 void VM_M_getkeydest(void)
120 VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
122 // key_game = 0, key_message = 1, key_menu = 2, key_menu_grabbed = 3, unknown = -1
126 PRVM_G_FLOAT(OFS_RETURN) = 0;
129 PRVM_G_FLOAT(OFS_RETURN) = 2;
131 case key_menu_grabbed:
132 PRVM_G_FLOAT(OFS_RETURN) = 3;
136 // PRVM_G_FLOAT(OFS_RETURN) = 1;
139 PRVM_G_FLOAT(OFS_RETURN) = -1;
147 callfunction(...,string function_name)
151 mfunction_t *PRVM_ED_FindFunction (const char *name);
152 void VM_M_callfunction(void)
157 VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction);
159 s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
161 VM_CheckEmptyString(s);
163 func = PRVM_ED_FindFunction(s);
166 PRVM_ERROR("VM_M_callfunciton: function %s not found !", s);
167 else if (func->first_statement < 0)
169 // negative statements are built in functions
170 int builtinnumber = -func->first_statement;
171 prog->xfunction->builtinsprofile++;
172 if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
173 prog->builtins[builtinnumber]();
175 PRVM_ERROR("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, PRVM_NAME);
177 else if(func - prog->functions > 0)
180 PRVM_ExecuteProgram(func - prog->functions,"");
189 float isfunction(string function_name)
192 mfunction_t *PRVM_ED_FindFunction (const char *name);
193 void VM_M_isfunction(void)
198 VM_SAFEPARMCOUNT(1, VM_M_isfunction);
200 s = PRVM_G_STRING(OFS_PARM0);
202 VM_CheckEmptyString(s);
204 func = PRVM_ED_FindFunction(s);
207 PRVM_G_FLOAT(OFS_RETURN) = false;
209 PRVM_G_FLOAT(OFS_RETURN) = true;
216 vector getresolution(float number)
219 void VM_M_getresolution(void)
222 VM_SAFEPARMCOUNT(1, VM_getresolution);
224 nr = (int)PRVM_G_FLOAT(OFS_PARM0);
226 // FIXME bounds check
227 PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width;
228 PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height;
229 PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
234 VM_M_getserverliststat
236 float getserverliststat(float type)
241 0 serverlist_viewcount
242 1 serverlist_totalcount
250 void VM_M_getserverliststat( void )
253 VM_SAFEPARMCOUNT ( 1, VM_M_getserverliststat );
255 PRVM_G_FLOAT( OFS_RETURN ) = 0;
257 type = (int)PRVM_G_FLOAT( OFS_PARM0 );
261 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_viewcount;
264 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_cachecount;
266 PRVM_G_FLOAT ( OFS_RETURN ) = masterquerycount;
269 PRVM_G_FLOAT ( OFS_RETURN ) = masterreplycount;
272 PRVM_G_FLOAT ( OFS_RETURN ) = serverquerycount;
275 PRVM_G_FLOAT ( OFS_RETURN ) = serverreplycount;
278 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield;
281 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortdescending;
284 VM_Warning( "VM_M_getserverliststat: bad type %i!\n", type );
289 ========================
290 VM_M_resetserverlistmasks
292 resetserverlistmasks()
293 ========================
295 void VM_M_resetserverlistmasks( void )
297 VM_SAFEPARMCOUNT(0, VM_M_resetserverlistmasks);
298 ServerList_ResetMasks();
303 ========================
304 VM_M_setserverlistmaskstring
306 setserverlistmaskstring(float mask, float fld, string str, float op)
309 ========================
311 void VM_M_setserverlistmaskstring( void )
315 serverlist_mask_t *mask;
318 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmaskstring );
319 str = PRVM_G_STRING( OFS_PARM2 );
321 masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
322 if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
323 mask = &serverlist_andmasks[masknr];
324 else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
325 mask = &serverlist_ormasks[masknr - 512 ];
328 VM_Warning( "VM_M_setserverlistmaskstring: invalid mask number %i\n", masknr );
332 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
336 strlcpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) );
339 strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name) );
342 strlcpy( mask->info.qcstatus, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.qcstatus) );
345 strlcpy( mask->info.players, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.players) );
348 strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map) );
351 strlcpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod) );
354 strlcpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game) );
357 VM_Warning( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field );
362 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
366 ========================
367 VM_M_setserverlistmasknumber
369 setserverlistmasknumber(float mask, float fld, float num, float op)
373 ========================
375 void VM_M_setserverlistmasknumber( void )
378 serverlist_mask_t *mask;
381 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
383 masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
384 if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
385 mask = &serverlist_andmasks[masknr];
386 else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
387 mask = &serverlist_ormasks[masknr - 512 ];
390 VM_Warning( "VM_M_setserverlistmasknumber: invalid mask number %i\n", masknr );
394 number = (int)PRVM_G_FLOAT( OFS_PARM2 );
395 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
398 case SLIF_MAXPLAYERS:
399 mask->info.maxplayers = number;
401 case SLIF_NUMPLAYERS:
402 mask->info.numplayers = number;
405 mask->info.numbots = number;
408 mask->info.numhumans = number;
411 mask->info.ping = number;
414 mask->info.protocol = number;
417 mask->info.freeslots = number;
420 VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
425 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
430 ========================
431 VM_M_resortserverlist
434 ========================
436 void VM_M_resortserverlist( void )
438 VM_SAFEPARMCOUNT(0, VM_M_resortserverlist);
439 ServerList_RebuildViewList();
444 VM_M_getserverliststring
446 string getserverliststring(float field, float hostnr)
449 void VM_M_getserverliststring(void)
451 serverlist_entry_t *cache;
454 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
456 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
458 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
460 if(hostnr < 0 || hostnr >= serverlist_viewcount)
462 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
465 cache = serverlist_viewlist[hostnr];
466 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
468 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname );
471 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
474 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.qcstatus );
477 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.players );
480 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
483 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod );
486 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map );
488 // TODO remove this again
490 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 );
493 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 );
496 Con_Print("VM_M_getserverliststring: bad field number passed!\n");
502 VM_M_getserverlistnumber
504 float getserverlistnumber(float field, float hostnr)
507 void VM_M_getserverlistnumber(void)
509 serverlist_entry_t *cache;
512 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
514 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
516 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
518 if(hostnr < 0 || hostnr >= serverlist_viewcount)
520 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
523 cache = serverlist_viewlist[hostnr];
524 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
525 case SLIF_MAXPLAYERS:
526 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers;
528 case SLIF_NUMPLAYERS:
529 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numplayers;
532 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numbots;
535 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numhumans;
538 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.freeslots;
541 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.ping;
544 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol;
547 Con_Print("VM_M_getserverlistnumber: bad field number passed!\n");
552 ========================
553 VM_M_setserverlistsort
555 setserverlistsort(float field, float descending)
556 ========================
558 void VM_M_setserverlistsort( void )
560 VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
562 serverlist_sortbyfield = (serverlist_infofield_t)((int)PRVM_G_FLOAT( OFS_PARM0 ));
563 serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 );
567 ========================
568 VM_M_refreshserverlist
571 ========================
573 void VM_M_refreshserverlist( void )
575 VM_SAFEPARMCOUNT( 0, VM_M_refreshserverlist );
576 ServerList_QueryList(false, true, false, false);
580 ========================
581 VM_M_getserverlistindexforkey
583 float getserverlistindexforkey(string key)
584 ========================
586 void VM_M_getserverlistindexforkey( void )
589 VM_SAFEPARMCOUNT( 1, VM_M_getserverlistindexforkey );
591 key = PRVM_G_STRING( OFS_PARM0 );
592 VM_CheckEmptyString( key );
594 if( !strcmp( key, "cname" ) )
595 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_CNAME;
596 else if( !strcmp( key, "ping" ) )
597 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PING;
598 else if( !strcmp( key, "game" ) )
599 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_GAME;
600 else if( !strcmp( key, "mod" ) )
601 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MOD;
602 else if( !strcmp( key, "map" ) )
603 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
604 else if( !strcmp( key, "name" ) )
605 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
606 else if( !strcmp( key, "qcstatus" ) )
607 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_QCSTATUS;
608 else if( !strcmp( key, "players" ) )
609 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PLAYERS;
610 else if( !strcmp( key, "maxplayers" ) )
611 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
612 else if( !strcmp( key, "numplayers" ) )
613 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMPLAYERS;
614 else if( !strcmp( key, "numbots" ) )
615 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMBOTS;
616 else if( !strcmp( key, "numhumans" ) )
617 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMHUMANS;
618 else if( !strcmp( key, "freeslots" ) )
619 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_FREESLOTS;
620 else if( !strcmp( key, "protocol" ) )
621 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL;
623 PRVM_G_FLOAT( OFS_RETURN ) = -1;
627 ========================
628 VM_M_addwantedserverlistkey
630 addwantedserverlistkey(string key)
631 ========================
633 void VM_M_addwantedserverlistkey( void )
635 VM_SAFEPARMCOUNT( 1, VM_M_addwantedserverlistkey );
639 ===============================================================================
642 used only for client and menu
643 server uses VM_SV_...
645 Write*(* data, float type, float to)
647 ===============================================================================
650 #define MSG_BROADCAST 0 // unreliable to all
651 #define MSG_ONE 1 // reliable to one (msg_entity)
652 #define MSG_ALL 2 // reliable to all
653 #define MSG_INIT 3 // write to the init string
655 sizebuf_t *VM_M_WriteDest (void)
661 PRVM_ERROR("VM_M_WriteDest: game is not server (%s)", PRVM_NAME);
663 dest = (int)PRVM_G_FLOAT(OFS_PARM1);
670 destclient = (int) PRVM_G_FLOAT(OFS_PARM2);
671 if (destclient < 0 || destclient >= svs.maxclients || !svs.clients[destclient].active || !svs.clients[destclient].netconnection)
672 PRVM_ERROR("VM_clientcommand: %s: invalid client !", PRVM_NAME);
674 return &svs.clients[destclient].netconnection->message;
677 return &sv.reliable_datagram;
683 PRVM_ERROR ("WriteDest: bad destination");
690 void VM_M_WriteByte (void)
692 VM_SAFEPARMCOUNT(1, VM_M_WriteByte);
693 MSG_WriteByte (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
696 void VM_M_WriteChar (void)
698 VM_SAFEPARMCOUNT(1, VM_M_WriteChar);
699 MSG_WriteChar (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
702 void VM_M_WriteShort (void)
704 VM_SAFEPARMCOUNT(1, VM_M_WriteShort);
705 MSG_WriteShort (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
708 void VM_M_WriteLong (void)
710 VM_SAFEPARMCOUNT(1, VM_M_WriteLong);
711 MSG_WriteLong (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
714 void VM_M_WriteAngle (void)
716 VM_SAFEPARMCOUNT(1, VM_M_WriteAngle);
717 MSG_WriteAngle (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
720 void VM_M_WriteCoord (void)
722 VM_SAFEPARMCOUNT(1, VM_M_WriteCoord);
723 MSG_WriteCoord (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
726 void VM_M_WriteString (void)
728 VM_SAFEPARMCOUNT(1, VM_M_WriteString);
729 MSG_WriteString (VM_M_WriteDest(), PRVM_G_STRING(OFS_PARM0));
732 void VM_M_WriteEntity (void)
734 VM_SAFEPARMCOUNT(1, VM_M_WriteEntity);
735 MSG_WriteShort (VM_M_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
738 //string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
739 void VM_M_getextresponse (void)
741 VM_SAFEPARMCOUNT(0,VM_argv);
743 if (net_extresponse_count <= 0)
744 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
748 --net_extresponse_count;
749 first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX;
750 PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
758 copies data from one entity to another
760 copyentity(entity src, entity dst)
763 static void VM_M_copyentity (void)
765 prvm_edict_t *in, *out;
766 VM_SAFEPARMCOUNT(2,VM_M_copyentity);
767 in = PRVM_G_EDICT(OFS_PARM0);
768 out = PRVM_G_EDICT(OFS_PARM1);
769 memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
772 //#66 vector() getmousepos (EXT_CSQC)
773 static void VM_M_getmousepos(void)
775 VM_SAFEPARMCOUNT(0,VM_M_getmousepos);
777 if (key_consoleactive || (key_dest != key_menu && key_dest != key_menu_grabbed))
778 VectorSet(PRVM_G_VECTOR(OFS_RETURN), 0, 0, 0);
779 else if (in_client_mouse)
780 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
782 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
785 prvm_builtin_t vm_m_builtins[] = {
786 NULL, // #0 NULL function (not callable)
787 VM_checkextension, // #1
793 VM_centerprint, // #7
797 VM_vectoangles, // #11
813 VM_findchainfloat, // #27
814 VM_precache_file, // #28
815 VM_precache_sound, // #29
828 VM_registercvar, // #42
833 VM_M_copyentity, // #47
847 VM_clientcount, // #61
848 VM_clientstate, // #62
850 VM_changelevel, // #64
851 VM_localsound, // #65
852 VM_M_getmousepos, // #66
854 VM_loadfromdata, // #68
855 VM_loadfromfile, // #69
857 VM_cvar_string, // #71
860 VM_search_begin, // #74
861 VM_search_end, // #75
862 VM_search_getsize, // #76
863 VM_search_getfilename, // #77
867 VM_itof, // #81 isString
868 VM_altstr_count, // #82
869 VM_altstr_prepare, // #83
870 VM_altstr_get, // #84
871 VM_altstr_set, // #85
872 VM_altstr_ins, // #86
874 VM_findchainflags, // #88
875 VM_cvar_defstring, // #89
876 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
878 VM_CL_setmodel, // #90 void(entity e, string m) setmodel (QUAKE)
879 VM_CL_precache_model, // #91 void(string s) precache_model (QUAKE)
880 VM_CL_setorigin, // #92 void(entity e, vector o) setorigin (QUAKE)
1014 VM_strstrofs, // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
1015 VM_str2chr, // #222 float(string str, float ofs) str2chr (FTE_STRINGS)
1016 VM_chr2str, // #223 string(float c, ...) chr2str (FTE_STRINGS)
1017 VM_strconv, // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS)
1018 VM_strpad, // #225 string(float chars, string s, ...) strpad (FTE_STRINGS)
1019 VM_infoadd, // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS)
1020 VM_infoget, // #227 string(string info, string key) infoget (FTE_STRINGS)
1021 VM_strncmp, // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
1022 VM_strncasecmp, // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
1023 VM_strncasecmp, // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
1093 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
1095 // CSQC range #300-#399
1096 VM_CL_R_ClearScene, // #300 void() clearscene (DP_QC_RENDER_SCENE)
1097 VM_CL_R_AddEntities, // #301 void(float mask) addentities (DP_QC_RENDER_SCENE)
1098 VM_CL_R_AddEntity, // #302 void(entity ent) addentity (DP_QC_RENDER_SCENE)
1099 VM_CL_R_SetView, // #303 float(float property, ...) setproperty (DP_QC_RENDER_SCENE)
1100 VM_CL_R_RenderScene, // #304 void() renderscene (DP_QC_RENDER_SCENE)
1101 VM_CL_R_AddDynamicLight, // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (DP_QC_RENDER_SCENE)
1102 VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon (DP_QC_RENDER_SCENE)
1103 VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (DP_QC_RENDER_SCENE)
1104 VM_CL_R_PolygonEnd, // #308 void() R_EndPolygon
1105 NULL/*VM_CL_R_LoadWorldModel*/, // #309 void(string modelname) R_LoadWorldModel
1106 // TODO: rearrange and merge all builtin lists and share as many extensions as possible between all VM instances [1/27/2008 Andreas]
1107 VM_CL_setattachment, // #310 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) (DP_QC_RENDER_SCENE)
1108 VM_CL_gettagindex, // #311 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1109 VM_CL_gettaginfo, // #312 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1111 // CSQC range #300-#399
1214 VM_M_WriteByte, // #401
1215 VM_M_WriteChar, // #402
1216 VM_M_WriteShort, // #403
1217 VM_M_WriteLong, // #404
1218 VM_M_WriteAngle, // #405
1219 VM_M_WriteCoord, // #406
1220 VM_M_WriteString, // #407
1221 VM_M_WriteEntity, // #408
1253 VM_buf_create, // #440 float() buf_create (DP_QC_STRINGBUFFERS)
1254 VM_buf_del, // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
1255 VM_buf_getsize, // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
1256 VM_buf_copy, // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
1257 VM_buf_sort, // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
1258 VM_buf_implode, // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
1259 VM_bufstr_get, // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
1260 VM_bufstr_set, // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
1261 VM_bufstr_add, // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
1262 VM_bufstr_free, // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
1264 VM_iscachedpic, // #451 draw functions...
1265 VM_precache_pic, // #452
1267 VM_drawcharacter, // #454
1268 VM_drawstring, // #455
1270 VM_drawfill, // #457
1271 VM_drawsetcliparea, // #458
1272 VM_drawresetcliparea, // #459
1273 VM_getimagesize, // #460
1274 VM_cin_open, // #461
1275 VM_cin_close, // #462
1276 VM_cin_setstate, // #463
1277 VM_cin_getstate, // #464
1278 VM_cin_restart, // #465
1279 VM_drawline, // #466
1280 VM_drawcolorcodedstring, // #467
1281 VM_stringwidth, // #468
1282 VM_drawsubpic, // #469
1284 VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
1285 VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
1286 VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
1287 VM_atan2, // #474 float(float c, float s) VM_atan2 (DP_QC_ASINACOSATANATAN2TAN)
1288 VM_tan, // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
1289 VM_strlennocol, // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
1290 VM_strdecolorize, // #477 string(string s) : DRESK - Decolorized String (DP_QC_STRINGCOLORFUNCTIONS)
1291 VM_strftime, // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME)
1292 VM_tokenizebyseparator, // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR)
1293 VM_strtolower, // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase
1294 VM_strtoupper, // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase
1297 VM_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
1298 VM_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
1300 VM_gecko_create, // #487 float gecko_create( string name )
1301 VM_gecko_destroy, // #488 void gecko_destroy( string name )
1302 VM_gecko_navigate, // #489 void gecko_navigate( string name, string URI )
1303 VM_gecko_keyevent, // #490 float gecko_keyevent( string name, float key, float eventtype )
1304 VM_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y )
1305 VM_gecko_resize, // #492 void gecko_resize( string name, float w, float h )
1306 VM_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name )
1307 VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
1308 VM_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE)
1316 VM_whichpack, // #503 string(string) whichpack = #503;
1323 VM_uri_escape, // #510 string(string in) uri_escape = #510;
1324 VM_uri_unescape, // #511 string(string in) uri_unescape = #511;
1325 VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
1326 VM_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET)
1414 VM_M_setkeydest, // #601 void setkeydest(float dest)
1415 VM_M_getkeydest, // #602 float getkeydest(void)
1416 VM_M_setmousetarget, // #603 void setmousetarget(float trg)
1417 VM_M_getmousetarget, // #604 float getmousetarget(void)
1418 VM_M_callfunction, // #605 void callfunction(...)
1419 VM_writetofile, // #606 void writetofile(float fhandle, entity ent)
1420 VM_M_isfunction, // #607 float isfunction(string function_name)
1421 VM_M_getresolution, // #608 vector getresolution(float number)
1422 VM_keynumtostring, // #609 string keynumtostring(float keynum)
1423 VM_findkeysforcommand, // #610 string findkeysforcommand(string command)
1424 VM_M_getserverliststat, // #611 float gethostcachevalue(float type)
1425 VM_M_getserverliststring, // #612 string gethostcachestring(float type, float hostnr)
1426 VM_parseentitydata, // #613 void parseentitydata(entity ent, string data)
1427 VM_stringtokeynum, // #614 float stringtokeynum(string key)
1428 VM_M_resetserverlistmasks, // #615 void resethostcachemasks(void)
1429 VM_M_setserverlistmaskstring, // #616 void sethostcachemaskstring(float mask, float fld, string str, float op)
1430 VM_M_setserverlistmasknumber, // #617 void sethostcachemasknumber(float mask, float fld, float num, float op)
1431 VM_M_resortserverlist, // #618 void resorthostcache(void)
1432 VM_M_setserverlistsort, // #619 void sethostcachesort(float fld, float descending)
1433 VM_M_refreshserverlist, // #620 void refreshhostcache(void)
1434 VM_M_getserverlistnumber, // #621 float gethostcachenumber(float fld, float hostnr)
1435 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
1436 VM_M_addwantedserverlistkey, // #623 void addwantedhostcachekey(string key)
1437 VM_M_getextresponse // #624 string getextresponse(void)
1440 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
1442 void VM_M_Cmd_Init(void)
1444 r_refdef_scene_t *scene;
1447 VM_Polygons_Reset();
1449 scene = R_GetScenePointer( RST_MENU );
1451 memset (scene, 0, sizeof (*scene));
1453 scene->maxtempentities = 128;
1454 scene->tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * scene->maxtempentities);
1456 scene->maxentities = MAX_EDICTS + 256 + 512;
1457 scene->entities = (entity_render_t **)Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t *) * scene->maxentities);
1459 scene->ambient = 32.0f;
1462 void VM_M_Cmd_Reset(void)
1464 // note: the menu's render entities are automatically freed when the prog's pool is freed
1468 VM_Polygons_Reset();