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 "
37 setmousetarget(float target)
40 void VM_M_setmousetarget(void)
42 VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
44 switch((int)PRVM_G_FLOAT(OFS_PARM0))
47 in_client_mouse = false;
50 in_client_mouse = true;
53 PRVM_ERROR("VM_M_setmousetarget: wrong destination %f !",PRVM_G_FLOAT(OFS_PARM0));
64 void VM_M_getmousetarget(void)
66 VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
69 PRVM_G_FLOAT(OFS_RETURN) = 2;
71 PRVM_G_FLOAT(OFS_RETURN) = 1;
80 setkeydest(float dest)
83 void VM_M_setkeydest(void)
85 VM_SAFEPARMCOUNT(1,VM_M_setkeydest);
87 switch((int)PRVM_G_FLOAT(OFS_PARM0))
99 key_dest = key_menu_grabbed;
103 // key_dest = key_message
106 PRVM_ERROR("VM_M_setkeydest: wrong destination %f !", PRVM_G_FLOAT(OFS_PARM0));
117 void VM_M_getkeydest(void)
119 VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
121 // key_game = 0, key_message = 1, key_menu = 2, key_menu_grabbed = 3, unknown = -1
125 PRVM_G_FLOAT(OFS_RETURN) = 0;
128 PRVM_G_FLOAT(OFS_RETURN) = 2;
130 case key_menu_grabbed:
131 PRVM_G_FLOAT(OFS_RETURN) = 3;
135 // PRVM_G_FLOAT(OFS_RETURN) = 1;
138 PRVM_G_FLOAT(OFS_RETURN) = -1;
146 callfunction(...,string function_name)
150 mfunction_t *PRVM_ED_FindFunction (const char *name);
151 void VM_M_callfunction(void)
156 VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction);
158 s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
160 VM_CheckEmptyString(s);
162 func = PRVM_ED_FindFunction(s);
165 PRVM_ERROR("VM_M_callfunciton: function %s not found !", s);
166 else if (func->first_statement < 0)
168 // negative statements are built in functions
169 int builtinnumber = -func->first_statement;
170 prog->xfunction->builtinsprofile++;
171 if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
172 prog->builtins[builtinnumber]();
174 PRVM_ERROR("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, PRVM_NAME);
176 else if(func - prog->functions > 0)
179 PRVM_ExecuteProgram(func - prog->functions,"");
188 float isfunction(string function_name)
191 mfunction_t *PRVM_ED_FindFunction (const char *name);
192 void VM_M_isfunction(void)
197 VM_SAFEPARMCOUNT(1, VM_M_isfunction);
199 s = PRVM_G_STRING(OFS_PARM0);
201 VM_CheckEmptyString(s);
203 func = PRVM_ED_FindFunction(s);
206 PRVM_G_FLOAT(OFS_RETURN) = false;
208 PRVM_G_FLOAT(OFS_RETURN) = true;
215 vector getresolution(float number)
218 void VM_M_getresolution(void)
221 VM_SAFEPARMCOUNT(1, VM_getresolution);
223 nr = (int)PRVM_G_FLOAT(OFS_PARM0);
225 // FIXME bounds check
226 PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width;
227 PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height;
228 PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
233 VM_M_findkeysforcommand
235 string findkeysforcommand(string command)
237 the returned string is an altstring
240 #define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
242 void M_FindKeysForCommand(const char *command, int *keys);
243 void VM_M_findkeysforcommand(void)
246 char ret[VM_STRINGTEMP_LENGTH];
250 VM_SAFEPARMCOUNT(1, VM_M_findkeysforcommand);
252 cmd = PRVM_G_STRING(OFS_PARM0);
254 VM_CheckEmptyString(cmd);
256 M_FindKeysForCommand(cmd, keys);
259 for(i = 0; i < NUMKEYS; i++)
260 strlcat(ret, va(" \'%i\'", keys[i]), sizeof(ret));
262 PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(ret);
267 VM_M_getserverliststat
269 float getserverliststat(float type)
274 0 serverlist_viewcount
275 1 serverlist_totalcount
283 void VM_M_getserverliststat( void )
286 VM_SAFEPARMCOUNT ( 1, VM_M_getserverliststat );
288 PRVM_G_FLOAT( OFS_RETURN ) = 0;
290 type = (int)PRVM_G_FLOAT( OFS_PARM0 );
294 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_viewcount;
297 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_cachecount;
299 PRVM_G_FLOAT ( OFS_RETURN ) = masterquerycount;
302 PRVM_G_FLOAT ( OFS_RETURN ) = masterreplycount;
305 PRVM_G_FLOAT ( OFS_RETURN ) = serverquerycount;
308 PRVM_G_FLOAT ( OFS_RETURN ) = serverreplycount;
311 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield;
314 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortdescending;
317 VM_Warning( "VM_M_getserverliststat: bad type %i!\n", type );
322 ========================
323 VM_M_resetserverlistmasks
325 resetserverlistmasks()
326 ========================
328 void VM_M_resetserverlistmasks( void )
330 VM_SAFEPARMCOUNT(0, VM_M_resetserverlistmasks);
331 ServerList_ResetMasks();
336 ========================
337 VM_M_setserverlistmaskstring
339 setserverlistmaskstring(float mask, float fld, string str, float op)
342 ========================
344 void VM_M_setserverlistmaskstring( void )
348 serverlist_mask_t *mask;
351 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmaskstring );
352 str = PRVM_G_STRING( OFS_PARM2 );
354 masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
355 if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
356 mask = &serverlist_andmasks[masknr];
357 else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
358 mask = &serverlist_ormasks[masknr - 512 ];
361 VM_Warning( "VM_M_setserverlistmaskstring: invalid mask number %i\n", masknr );
365 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
369 strlcpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) );
372 strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name) );
375 strlcpy( mask->info.qcstatus, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.qcstatus) );
378 strlcpy( mask->info.players, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.players) );
381 strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map) );
384 strlcpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod) );
387 strlcpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game) );
390 VM_Warning( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field );
395 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
399 ========================
400 VM_M_setserverlistmasknumber
402 setserverlistmasknumber(float mask, float fld, float num, float op)
406 ========================
408 void VM_M_setserverlistmasknumber( void )
411 serverlist_mask_t *mask;
414 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
416 masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
417 if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
418 mask = &serverlist_andmasks[masknr];
419 else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
420 mask = &serverlist_ormasks[masknr - 512 ];
423 VM_Warning( "VM_M_setserverlistmasknumber: invalid mask number %i\n", masknr );
427 number = (int)PRVM_G_FLOAT( OFS_PARM2 );
428 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
431 case SLIF_MAXPLAYERS:
432 mask->info.maxplayers = number;
434 case SLIF_NUMPLAYERS:
435 mask->info.numplayers = number;
438 mask->info.numbots = number;
441 mask->info.numhumans = number;
444 mask->info.ping = number;
447 mask->info.protocol = number;
450 mask->info.freeslots = number;
453 VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
458 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
463 ========================
464 VM_M_resortserverlist
467 ========================
469 void VM_M_resortserverlist( void )
471 VM_SAFEPARMCOUNT(0, VM_M_resortserverlist);
472 ServerList_RebuildViewList();
477 VM_M_getserverliststring
479 string getserverliststring(float field, float hostnr)
482 void VM_M_getserverliststring(void)
484 serverlist_entry_t *cache;
487 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
489 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
491 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
493 if(hostnr < 0 || hostnr >= serverlist_viewcount)
495 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
498 cache = serverlist_viewlist[hostnr];
499 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
501 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname );
504 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
507 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.qcstatus );
510 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.players );
513 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
516 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod );
519 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map );
521 // TODO remove this again
523 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 );
526 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 );
529 Con_Print("VM_M_getserverliststring: bad field number passed!\n");
535 VM_M_getserverlistnumber
537 float getserverlistnumber(float field, float hostnr)
540 void VM_M_getserverlistnumber(void)
542 serverlist_entry_t *cache;
545 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
547 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
549 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
551 if(hostnr < 0 || hostnr >= serverlist_viewcount)
553 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
556 cache = serverlist_viewlist[hostnr];
557 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
558 case SLIF_MAXPLAYERS:
559 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers;
561 case SLIF_NUMPLAYERS:
562 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numplayers;
565 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numbots;
568 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numhumans;
571 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.freeslots;
574 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.ping;
577 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol;
580 Con_Print("VM_M_getserverlistnumber: bad field number passed!\n");
585 ========================
586 VM_M_setserverlistsort
588 setserverlistsort(float field, float descending)
589 ========================
591 void VM_M_setserverlistsort( void )
593 VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
595 serverlist_sortbyfield = (serverlist_infofield_t)((int)PRVM_G_FLOAT( OFS_PARM0 ));
596 serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 );
600 ========================
601 VM_M_refreshserverlist
604 ========================
606 void VM_M_refreshserverlist( void )
608 VM_SAFEPARMCOUNT( 0, VM_M_refreshserverlist );
609 ServerList_QueryList(false, true, false, false);
613 ========================
614 VM_M_getserverlistindexforkey
616 float getserverlistindexforkey(string key)
617 ========================
619 void VM_M_getserverlistindexforkey( void )
622 VM_SAFEPARMCOUNT( 1, VM_M_getserverlistindexforkey );
624 key = PRVM_G_STRING( OFS_PARM0 );
625 VM_CheckEmptyString( key );
627 if( !strcmp( key, "cname" ) )
628 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_CNAME;
629 else if( !strcmp( key, "ping" ) )
630 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PING;
631 else if( !strcmp( key, "game" ) )
632 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_GAME;
633 else if( !strcmp( key, "mod" ) )
634 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MOD;
635 else if( !strcmp( key, "map" ) )
636 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
637 else if( !strcmp( key, "name" ) )
638 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
639 else if( !strcmp( key, "qcstatus" ) )
640 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_QCSTATUS;
641 else if( !strcmp( key, "players" ) )
642 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PLAYERS;
643 else if( !strcmp( key, "maxplayers" ) )
644 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
645 else if( !strcmp( key, "numplayers" ) )
646 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMPLAYERS;
647 else if( !strcmp( key, "numbots" ) )
648 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMBOTS;
649 else if( !strcmp( key, "numhumans" ) )
650 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMHUMANS;
651 else if( !strcmp( key, "freeslots" ) )
652 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_FREESLOTS;
653 else if( !strcmp( key, "protocol" ) )
654 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL;
656 PRVM_G_FLOAT( OFS_RETURN ) = -1;
660 ========================
661 VM_M_addwantedserverlistkey
663 addwantedserverlistkey(string key)
664 ========================
666 void VM_M_addwantedserverlistkey( void )
668 VM_SAFEPARMCOUNT( 1, VM_M_addwantedserverlistkey );
672 ===============================================================================
675 used only for client and menu
676 server uses VM_SV_...
678 Write*(* data, float type, float to)
680 ===============================================================================
683 #define MSG_BROADCAST 0 // unreliable to all
684 #define MSG_ONE 1 // reliable to one (msg_entity)
685 #define MSG_ALL 2 // reliable to all
686 #define MSG_INIT 3 // write to the init string
688 sizebuf_t *VM_M_WriteDest (void)
694 PRVM_ERROR("VM_M_WriteDest: game is not server (%s)", PRVM_NAME);
696 dest = (int)PRVM_G_FLOAT(OFS_PARM1);
703 destclient = (int) PRVM_G_FLOAT(OFS_PARM2);
704 if (destclient < 0 || destclient >= svs.maxclients || !svs.clients[destclient].active || !svs.clients[destclient].netconnection)
705 PRVM_ERROR("VM_clientcommand: %s: invalid client !", PRVM_NAME);
707 return &svs.clients[destclient].netconnection->message;
710 return &sv.reliable_datagram;
716 PRVM_ERROR ("WriteDest: bad destination");
723 void VM_M_WriteByte (void)
725 VM_SAFEPARMCOUNT(1, VM_M_WriteByte);
726 MSG_WriteByte (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
729 void VM_M_WriteChar (void)
731 VM_SAFEPARMCOUNT(1, VM_M_WriteChar);
732 MSG_WriteChar (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
735 void VM_M_WriteShort (void)
737 VM_SAFEPARMCOUNT(1, VM_M_WriteShort);
738 MSG_WriteShort (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
741 void VM_M_WriteLong (void)
743 VM_SAFEPARMCOUNT(1, VM_M_WriteLong);
744 MSG_WriteLong (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
747 void VM_M_WriteAngle (void)
749 VM_SAFEPARMCOUNT(1, VM_M_WriteAngle);
750 MSG_WriteAngle (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
753 void VM_M_WriteCoord (void)
755 VM_SAFEPARMCOUNT(1, VM_M_WriteCoord);
756 MSG_WriteCoord (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
759 void VM_M_WriteString (void)
761 VM_SAFEPARMCOUNT(1, VM_M_WriteString);
762 MSG_WriteString (VM_M_WriteDest(), PRVM_G_STRING(OFS_PARM0));
765 void VM_M_WriteEntity (void)
767 VM_SAFEPARMCOUNT(1, VM_M_WriteEntity);
768 MSG_WriteShort (VM_M_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
771 //string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
772 void VM_M_getextresponse (void)
774 VM_SAFEPARMCOUNT(0,VM_argv);
776 if (net_extresponse_count <= 0)
777 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
781 --net_extresponse_count;
782 first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX;
783 PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
791 copies data from one entity to another
793 copyentity(entity src, entity dst)
796 static void VM_M_copyentity (void)
798 prvm_edict_t *in, *out;
799 VM_SAFEPARMCOUNT(2,VM_M_copyentity);
800 in = PRVM_G_EDICT(OFS_PARM0);
801 out = PRVM_G_EDICT(OFS_PARM1);
802 memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
805 //#66 vector() getmousepos (EXT_CSQC)
806 static void VM_M_getmousepos(void)
808 VM_SAFEPARMCOUNT(0,VM_M_getmousepos);
810 if (key_consoleactive || (key_dest != key_menu && key_dest != key_menu_grabbed))
811 VectorSet(PRVM_G_VECTOR(OFS_RETURN), 0, 0, 0);
812 else if (in_client_mouse)
813 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
815 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
818 prvm_builtin_t vm_m_builtins[] = {
819 NULL, // #0 NULL function (not callable)
820 VM_checkextension, // #1
826 VM_centerprint, // #7
830 VM_vectoangles, // #11
846 VM_findchainfloat, // #27
847 VM_precache_file, // #28
848 VM_precache_sound, // #29
861 VM_registercvar, // #42
866 VM_M_copyentity, // #47
880 VM_clientcount, // #61
881 VM_clientstate, // #62
883 VM_changelevel, // #64
884 VM_localsound, // #65
885 VM_M_getmousepos, // #66
887 VM_loadfromdata, // #68
888 VM_loadfromfile, // #69
890 VM_cvar_string, // #71
893 VM_search_begin, // #74
894 VM_search_end, // #75
895 VM_search_getsize, // #76
896 VM_search_getfilename, // #77
900 VM_itof, // #81 isString
901 VM_altstr_count, // #82
902 VM_altstr_prepare, // #83
903 VM_altstr_get, // #84
904 VM_altstr_set, // #85
905 VM_altstr_ins, // #86
907 VM_findchainflags, // #88
908 VM_cvar_defstring, // #89
909 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
911 VM_CL_setmodel, // #90 void(entity e, string m) setmodel (QUAKE)
912 VM_CL_precache_model, // #91 void(string s) precache_model (QUAKE)
913 VM_CL_setorigin, // #92 void(entity e, vector o) setorigin (QUAKE)
1047 VM_strstrofs, // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
1048 VM_str2chr, // #222 float(string str, float ofs) str2chr (FTE_STRINGS)
1049 VM_chr2str, // #223 string(float c, ...) chr2str (FTE_STRINGS)
1050 VM_strconv, // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS)
1051 VM_strpad, // #225 string(float chars, string s, ...) strpad (FTE_STRINGS)
1052 VM_infoadd, // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS)
1053 VM_infoget, // #227 string(string info, string key) infoget (FTE_STRINGS)
1054 VM_strncmp, // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
1055 VM_strncasecmp, // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
1056 VM_strncasecmp, // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
1126 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
1128 // CSQC range #300-#399
1129 VM_CL_R_ClearScene, // #300 void() clearscene (DP_QC_RENDER_SCENE)
1130 VM_CL_R_AddEntities, // #301 void(float mask) addentities (DP_QC_RENDER_SCENE)
1131 VM_CL_R_AddEntity, // #302 void(entity ent) addentity (DP_QC_RENDER_SCENE)
1132 VM_CL_R_SetView, // #303 float(float property, ...) setproperty (DP_QC_RENDER_SCENE)
1133 VM_CL_R_RenderScene, // #304 void() renderscene (DP_QC_RENDER_SCENE)
1134 VM_CL_R_AddDynamicLight, // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (DP_QC_RENDER_SCENE)
1135 VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon (DP_QC_RENDER_SCENE)
1136 VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (DP_QC_RENDER_SCENE)
1137 VM_CL_R_PolygonEnd, // #308 void() R_EndPolygon
1138 NULL/*VM_CL_R_LoadWorldModel*/, // #309 void(string modelname) R_LoadWorldModel
1139 // TODO: rearrange and merge all builtin lists and share as many extensions as possible between all VM instances [1/27/2008 Andreas]
1140 VM_CL_setattachment, // #310 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) (DP_QC_RENDER_SCENE)
1141 VM_CL_gettagindex, // #311 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1142 VM_CL_gettaginfo, // #312 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1144 // CSQC range #300-#399
1247 VM_M_WriteByte, // #401
1248 VM_M_WriteChar, // #402
1249 VM_M_WriteShort, // #403
1250 VM_M_WriteLong, // #404
1251 VM_M_WriteAngle, // #405
1252 VM_M_WriteCoord, // #406
1253 VM_M_WriteString, // #407
1254 VM_M_WriteEntity, // #408
1286 VM_buf_create, // #440 float() buf_create (DP_QC_STRINGBUFFERS)
1287 VM_buf_del, // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
1288 VM_buf_getsize, // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
1289 VM_buf_copy, // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
1290 VM_buf_sort, // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
1291 VM_buf_implode, // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
1292 VM_bufstr_get, // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
1293 VM_bufstr_set, // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
1294 VM_bufstr_add, // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
1295 VM_bufstr_free, // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
1297 VM_iscachedpic, // #451 draw functions...
1298 VM_precache_pic, // #452
1300 VM_drawcharacter, // #454
1301 VM_drawstring, // #455
1303 VM_drawfill, // #457
1304 VM_drawsetcliparea, // #458
1305 VM_drawresetcliparea, // #459
1306 VM_getimagesize, // #460
1307 VM_cin_open, // #461
1308 VM_cin_close, // #462
1309 VM_cin_setstate, // #463
1310 VM_cin_getstate, // #464
1311 VM_cin_restart, // #465
1312 VM_drawline, // #466
1313 VM_drawcolorcodedstring, // #467
1314 VM_stringwidth, // #468
1315 VM_drawsubpic, // #469
1317 VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
1318 VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
1319 VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
1320 VM_atan2, // #474 float(float c, float s) VM_atan2 (DP_QC_ASINACOSATANATAN2TAN)
1321 VM_tan, // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
1322 VM_strlennocol, // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
1323 VM_strdecolorize, // #477 string(string s) : DRESK - Decolorized String (DP_QC_STRINGCOLORFUNCTIONS)
1324 VM_strftime, // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME)
1325 VM_tokenizebyseparator, // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR)
1326 VM_strtolower, // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase
1327 VM_strtoupper, // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase
1330 VM_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
1331 VM_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
1333 VM_gecko_create, // #487 float gecko_create( string name )
1334 VM_gecko_destroy, // #488 void gecko_destroy( string name )
1335 VM_gecko_navigate, // #489 void gecko_navigate( string name, string URI )
1336 VM_gecko_keyevent, // #490 float gecko_keyevent( string name, float key, float eventtype )
1337 VM_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y )
1338 VM_gecko_resize, // #492 void gecko_resize( string name, float w, float h )
1339 VM_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name )
1340 VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
1341 VM_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE)
1349 VM_whichpack, // #503 string(string) whichpack = #503;
1356 VM_uri_escape, // #510 string(string in) uri_escape = #510;
1357 VM_uri_unescape, // #511 string(string in) uri_unescape = #511;
1358 VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
1447 VM_M_setkeydest, // #601 void setkeydest(float dest)
1448 VM_M_getkeydest, // #602 float getkeydest(void)
1449 VM_M_setmousetarget, // #603 void setmousetarget(float trg)
1450 VM_M_getmousetarget, // #604 float getmousetarget(void)
1451 VM_M_callfunction, // #605 void callfunction(...)
1452 VM_writetofile, // #606 void writetofile(float fhandle, entity ent)
1453 VM_M_isfunction, // #607 float isfunction(string function_name)
1454 VM_M_getresolution, // #608 vector getresolution(float number)
1455 VM_keynumtostring, // #609 string keynumtostring(float keynum)
1456 VM_M_findkeysforcommand, // #610 string findkeysforcommand(string command)
1457 VM_M_getserverliststat, // #611 float gethostcachevalue(float type)
1458 VM_M_getserverliststring, // #612 string gethostcachestring(float type, float hostnr)
1459 VM_parseentitydata, // #613 void parseentitydata(entity ent, string data)
1460 VM_stringtokeynum, // #614 float stringtokeynum(string key)
1461 VM_M_resetserverlistmasks, // #615 void resethostcachemasks(void)
1462 VM_M_setserverlistmaskstring, // #616 void sethostcachemaskstring(float mask, float fld, string str, float op)
1463 VM_M_setserverlistmasknumber, // #617 void sethostcachemasknumber(float mask, float fld, float num, float op)
1464 VM_M_resortserverlist, // #618 void resorthostcache(void)
1465 VM_M_setserverlistsort, // #619 void sethostcachesort(float fld, float descending)
1466 VM_M_refreshserverlist, // #620 void refreshhostcache(void)
1467 VM_M_getserverlistnumber, // #621 float gethostcachenumber(float fld, float hostnr)
1468 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
1469 VM_M_addwantedserverlistkey, // #623 void addwantedhostcachekey(string key)
1470 VM_M_getextresponse // #624 string getextresponse(void)
1473 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
1475 void VM_M_Cmd_Init(void)
1477 r_refdef_scene_t *scene;
1480 VM_Polygons_Reset();
1482 scene = R_GetScenePointer( RST_MENU );
1484 memset (scene, 0, sizeof (*scene));
1486 scene->maxtempentities = 128;
1487 scene->tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * scene->maxtempentities);
1489 scene->maxentities = MAX_EDICTS + 256 + 512;
1490 scene->entities = (entity_render_t **)Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t *) * scene->maxentities);
1492 scene->ambient = 32.0f;
1495 void VM_M_Cmd_Reset(void)
1497 // note: the menu's render entities are automatically freed when the prog's pool is freed
1501 VM_Polygons_Reset();