7 // TODO check which strings really should be engine strings
9 //============================================================================
12 char *vm_m_extensions =
15 "DP_FONT_VARIABLEWIDTH "
17 "DP_MENU_EXTRESPONSEPACKET "
18 "DP_QC_ASINACOSATANATAN2TAN "
23 "DP_QC_CVAR_DESCRIPTION "
24 "DP_QC_FINDCHAIN_TOFIELD "
29 "DP_QC_STRINGBUFFERS "
30 "DP_QC_STRINGBUFFERS_CVARLIST "
31 "DP_QC_STRINGCOLORFUNCTIONS "
32 "DP_QC_STRING_CASE_FUNCTIONS "
34 "DP_QC_TOKENIZEBYSEPARATOR "
35 "DP_QC_TOKENIZE_CONSOLE "
36 "DP_QC_UNLIMITEDTEMPSTRINGS "
47 setmousetarget(float target)
50 void VM_M_setmousetarget(void)
52 VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
54 switch((int)PRVM_G_FLOAT(OFS_PARM0))
57 in_client_mouse = false;
60 in_client_mouse = true;
63 PRVM_ERROR("VM_M_setmousetarget: wrong destination %f !",PRVM_G_FLOAT(OFS_PARM0));
74 void VM_M_getmousetarget(void)
76 VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
79 PRVM_G_FLOAT(OFS_RETURN) = 2;
81 PRVM_G_FLOAT(OFS_RETURN) = 1;
90 setkeydest(float dest)
93 void VM_M_setkeydest(void)
95 VM_SAFEPARMCOUNT(1,VM_M_setkeydest);
97 switch((int)PRVM_G_FLOAT(OFS_PARM0))
109 key_dest = key_menu_grabbed;
113 // key_dest = key_message
116 PRVM_ERROR("VM_M_setkeydest: wrong destination %f !", PRVM_G_FLOAT(OFS_PARM0));
127 void VM_M_getkeydest(void)
129 VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
131 // key_game = 0, key_message = 1, key_menu = 2, key_menu_grabbed = 3, unknown = -1
135 PRVM_G_FLOAT(OFS_RETURN) = 0;
138 PRVM_G_FLOAT(OFS_RETURN) = 2;
140 case key_menu_grabbed:
141 PRVM_G_FLOAT(OFS_RETURN) = 3;
145 // PRVM_G_FLOAT(OFS_RETURN) = 1;
148 PRVM_G_FLOAT(OFS_RETURN) = -1;
157 vector getresolution(float number)
160 void VM_M_getresolution(void)
163 VM_SAFEPARMCOUNTRANGE(1, 2, VM_getresolution);
165 nr = (int)PRVM_G_FLOAT(OFS_PARM0);
167 fs = ((prog->argc <= 1) || ((int)PRVM_G_FLOAT(OFS_PARM1)));
169 if(nr < 0 || nr >= (fs ? video_resolutions_count : video_resolutions_hardcoded_count))
171 PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
172 PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
173 PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
177 video_resolution_t *r = &((fs ? video_resolutions : video_resolutions_hardcoded)[nr]);
178 PRVM_G_VECTOR(OFS_RETURN)[0] = r->width;
179 PRVM_G_VECTOR(OFS_RETURN)[1] = r->height;
180 PRVM_G_VECTOR(OFS_RETURN)[2] = r->pixelheight;
184 void VM_M_getgamedirinfo(void)
187 VM_SAFEPARMCOUNT(2, VM_getgamedirinfo);
189 nr = (int)PRVM_G_FLOAT(OFS_PARM0);
190 item = (int)PRVM_G_FLOAT(OFS_PARM1);
192 PRVM_G_INT( OFS_RETURN ) = OFS_NULL;
194 if(nr >= 0 && nr < fs_all_gamedirs_count)
197 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( fs_all_gamedirs[nr].name );
199 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( fs_all_gamedirs[nr].description );
205 VM_M_getserverliststat
207 float getserverliststat(float type)
212 0 serverlist_viewcount
213 1 serverlist_totalcount
221 void VM_M_getserverliststat( void )
224 VM_SAFEPARMCOUNT ( 1, VM_M_getserverliststat );
226 PRVM_G_FLOAT( OFS_RETURN ) = 0;
228 type = (int)PRVM_G_FLOAT( OFS_PARM0 );
232 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_viewcount;
235 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_cachecount;
237 PRVM_G_FLOAT ( OFS_RETURN ) = masterquerycount;
240 PRVM_G_FLOAT ( OFS_RETURN ) = masterreplycount;
243 PRVM_G_FLOAT ( OFS_RETURN ) = serverquerycount;
246 PRVM_G_FLOAT ( OFS_RETURN ) = serverreplycount;
249 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield;
252 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortflags;
255 VM_Warning( "VM_M_getserverliststat: bad type %i!\n", type );
260 ========================
261 VM_M_resetserverlistmasks
263 resetserverlistmasks()
264 ========================
266 void VM_M_resetserverlistmasks( void )
268 VM_SAFEPARMCOUNT(0, VM_M_resetserverlistmasks);
269 ServerList_ResetMasks();
274 ========================
275 VM_M_setserverlistmaskstring
277 setserverlistmaskstring(float mask, float fld, string str, float op)
280 ========================
282 void VM_M_setserverlistmaskstring( void )
286 serverlist_mask_t *mask;
289 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmaskstring );
290 str = PRVM_G_STRING( OFS_PARM2 );
292 masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
293 if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
294 mask = &serverlist_andmasks[masknr];
295 else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
296 mask = &serverlist_ormasks[masknr - 512 ];
299 VM_Warning( "VM_M_setserverlistmaskstring: invalid mask number %i\n", masknr );
303 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
307 strlcpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) );
310 strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name) );
313 strlcpy( mask->info.qcstatus, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.qcstatus) );
316 strlcpy( mask->info.players, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.players) );
319 strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map) );
322 strlcpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod) );
325 strlcpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game) );
328 VM_Warning( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field );
333 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
337 ========================
338 VM_M_setserverlistmasknumber
340 setserverlistmasknumber(float mask, float fld, float num, float op)
344 ========================
346 void VM_M_setserverlistmasknumber( void )
349 serverlist_mask_t *mask;
352 VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
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_setserverlistmasknumber: invalid mask number %i\n", masknr );
365 number = (int)PRVM_G_FLOAT( OFS_PARM2 );
366 field = (int) PRVM_G_FLOAT( OFS_PARM1 );
369 case SLIF_MAXPLAYERS:
370 mask->info.maxplayers = number;
372 case SLIF_NUMPLAYERS:
373 mask->info.numplayers = number;
376 mask->info.numbots = number;
379 mask->info.numhumans = number;
382 mask->info.ping = number;
385 mask->info.protocol = number;
388 mask->info.freeslots = number;
390 case SLIF_ISFAVORITE:
391 mask->info.isfavorite = number != 0;
394 VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
399 mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
404 ========================
405 VM_M_resortserverlist
408 ========================
410 void VM_M_resortserverlist( void )
412 VM_SAFEPARMCOUNT(0, VM_M_resortserverlist);
413 ServerList_RebuildViewList();
418 VM_M_getserverliststring
420 string getserverliststring(float field, float hostnr)
423 void VM_M_getserverliststring(void)
425 serverlist_entry_t *cache;
428 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
430 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
432 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
434 if(hostnr < 0 || hostnr >= serverlist_viewcount)
436 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
439 cache = serverlist_viewlist[hostnr];
440 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
442 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname );
445 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
448 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.qcstatus );
451 PRVM_G_INT (OFS_RETURN ) = PRVM_SetEngineString (cache->info.players );
454 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
457 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod );
460 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map );
462 // TODO remove this again
464 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 );
467 PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 );
470 Con_Print("VM_M_getserverliststring: bad field number passed!\n");
476 VM_M_getserverlistnumber
478 float getserverlistnumber(float field, float hostnr)
481 void VM_M_getserverlistnumber(void)
483 serverlist_entry_t *cache;
486 VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
488 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
490 hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
492 if(hostnr < 0 || hostnr >= serverlist_viewcount)
494 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
497 cache = serverlist_viewlist[hostnr];
498 switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
499 case SLIF_MAXPLAYERS:
500 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers;
502 case SLIF_NUMPLAYERS:
503 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numplayers;
506 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numbots;
509 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numhumans;
512 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.freeslots;
515 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.ping;
518 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol;
520 case SLIF_ISFAVORITE:
521 PRVM_G_FLOAT( OFS_RETURN ) = cache->info.isfavorite;
524 Con_Print("VM_M_getserverlistnumber: bad field number passed!\n");
529 ========================
530 VM_M_setserverlistsort
532 setserverlistsort(float field, float flags)
533 ========================
535 void VM_M_setserverlistsort( void )
537 VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
539 serverlist_sortbyfield = (serverlist_infofield_t)((int)PRVM_G_FLOAT( OFS_PARM0 ));
540 serverlist_sortflags = (int) PRVM_G_FLOAT( OFS_PARM1 );
544 ========================
545 VM_M_refreshserverlist
548 ========================
550 void VM_M_refreshserverlist( void )
552 VM_SAFEPARMCOUNT( 0, VM_M_refreshserverlist );
553 ServerList_QueryList(false, true, false, false);
557 ========================
558 VM_M_getserverlistindexforkey
560 float getserverlistindexforkey(string key)
561 ========================
563 void VM_M_getserverlistindexforkey( void )
566 VM_SAFEPARMCOUNT( 1, VM_M_getserverlistindexforkey );
568 key = PRVM_G_STRING( OFS_PARM0 );
569 VM_CheckEmptyString( key );
571 if( !strcmp( key, "cname" ) )
572 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_CNAME;
573 else if( !strcmp( key, "ping" ) )
574 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PING;
575 else if( !strcmp( key, "game" ) )
576 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_GAME;
577 else if( !strcmp( key, "mod" ) )
578 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MOD;
579 else if( !strcmp( key, "map" ) )
580 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
581 else if( !strcmp( key, "name" ) )
582 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
583 else if( !strcmp( key, "qcstatus" ) )
584 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_QCSTATUS;
585 else if( !strcmp( key, "players" ) )
586 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PLAYERS;
587 else if( !strcmp( key, "maxplayers" ) )
588 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
589 else if( !strcmp( key, "numplayers" ) )
590 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMPLAYERS;
591 else if( !strcmp( key, "numbots" ) )
592 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMBOTS;
593 else if( !strcmp( key, "numhumans" ) )
594 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMHUMANS;
595 else if( !strcmp( key, "freeslots" ) )
596 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_FREESLOTS;
597 else if( !strcmp( key, "protocol" ) )
598 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL;
599 else if( !strcmp( key, "isfavorite" ) )
600 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_ISFAVORITE;
602 PRVM_G_FLOAT( OFS_RETURN ) = -1;
606 ========================
607 VM_M_addwantedserverlistkey
609 addwantedserverlistkey(string key)
610 ========================
612 void VM_M_addwantedserverlistkey( void )
614 VM_SAFEPARMCOUNT( 1, VM_M_addwantedserverlistkey );
618 ===============================================================================
621 used only for client and menu
622 server uses VM_SV_...
624 Write*(* data, float type, float to)
626 ===============================================================================
629 #define MSG_BROADCAST 0 // unreliable to all
630 #define MSG_ONE 1 // reliable to one (msg_entity)
631 #define MSG_ALL 2 // reliable to all
632 #define MSG_INIT 3 // write to the init string
634 sizebuf_t *VM_M_WriteDest (void)
640 PRVM_ERROR("VM_M_WriteDest: game is not server (%s)", PRVM_NAME);
642 dest = (int)PRVM_G_FLOAT(OFS_PARM1);
649 destclient = (int) PRVM_G_FLOAT(OFS_PARM2);
650 if (destclient < 0 || destclient >= svs.maxclients || !svs.clients[destclient].active || !svs.clients[destclient].netconnection)
651 PRVM_ERROR("VM_clientcommand: %s: invalid client !", PRVM_NAME);
653 return &svs.clients[destclient].netconnection->message;
656 return &sv.reliable_datagram;
662 PRVM_ERROR ("WriteDest: bad destination");
669 void VM_M_WriteByte (void)
671 VM_SAFEPARMCOUNT(1, VM_M_WriteByte);
672 MSG_WriteByte (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
675 void VM_M_WriteChar (void)
677 VM_SAFEPARMCOUNT(1, VM_M_WriteChar);
678 MSG_WriteChar (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
681 void VM_M_WriteShort (void)
683 VM_SAFEPARMCOUNT(1, VM_M_WriteShort);
684 MSG_WriteShort (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
687 void VM_M_WriteLong (void)
689 VM_SAFEPARMCOUNT(1, VM_M_WriteLong);
690 MSG_WriteLong (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
693 void VM_M_WriteAngle (void)
695 VM_SAFEPARMCOUNT(1, VM_M_WriteAngle);
696 MSG_WriteAngle (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
699 void VM_M_WriteCoord (void)
701 VM_SAFEPARMCOUNT(1, VM_M_WriteCoord);
702 MSG_WriteCoord (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
705 void VM_M_WriteString (void)
707 VM_SAFEPARMCOUNT(1, VM_M_WriteString);
708 MSG_WriteString (VM_M_WriteDest(), PRVM_G_STRING(OFS_PARM0));
711 void VM_M_WriteEntity (void)
713 VM_SAFEPARMCOUNT(1, VM_M_WriteEntity);
714 MSG_WriteShort (VM_M_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
721 copies data from one entity to another
723 copyentity(entity src, entity dst)
726 static void VM_M_copyentity (void)
728 prvm_edict_t *in, *out;
729 VM_SAFEPARMCOUNT(2,VM_M_copyentity);
730 in = PRVM_G_EDICT(OFS_PARM0);
731 out = PRVM_G_EDICT(OFS_PARM1);
732 memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
735 //#66 vector() getmousepos (EXT_CSQC)
736 static void VM_M_getmousepos(void)
738 VM_SAFEPARMCOUNT(0,VM_M_getmousepos);
740 if (key_consoleactive || (key_dest != key_menu && key_dest != key_menu_grabbed))
741 VectorSet(PRVM_G_VECTOR(OFS_RETURN), 0, 0, 0);
742 else if (in_client_mouse)
743 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
745 VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
748 //#349 float() isdemo (EXT_CSQC)
749 static void VM_M_isdemo (void)
751 VM_SAFEPARMCOUNT(0, VM_M_isdemo);
752 PRVM_G_FLOAT(OFS_RETURN) = cls.demoplayback;
755 prvm_builtin_t vm_m_builtins[] = {
756 NULL, // #0 NULL function (not callable)
757 VM_checkextension, // #1
763 VM_centerprint, // #7
767 VM_vectoangles, // #11
783 VM_findchainfloat, // #27
784 VM_precache_file, // #28
785 VM_precache_sound, // #29
798 VM_registercvar, // #42
803 VM_M_copyentity, // #47
817 VM_clientcount, // #61
818 VM_clientstate, // #62
820 VM_changelevel, // #64
821 VM_localsound, // #65
822 VM_M_getmousepos, // #66
824 VM_loadfromdata, // #68
825 VM_loadfromfile, // #69
827 VM_cvar_string, // #71
830 VM_search_begin, // #74
831 VM_search_end, // #75
832 VM_search_getsize, // #76
833 VM_search_getfilename, // #77
837 VM_itof, // #81 isString
838 VM_altstr_count, // #82
839 VM_altstr_prepare, // #83
840 VM_altstr_get, // #84
841 VM_altstr_set, // #85
842 VM_altstr_ins, // #86
844 VM_findchainflags, // #88
845 VM_cvar_defstring, // #89
846 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
848 VM_CL_setmodel, // #90 void(entity e, string m) setmodel (QUAKE)
849 VM_CL_precache_model, // #91 void(string s) precache_model (QUAKE)
850 VM_CL_setorigin, // #92 void(entity e, vector o) setorigin (QUAKE)
984 VM_strstrofs, // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
985 VM_str2chr, // #222 float(string str, float ofs) str2chr (FTE_STRINGS)
986 VM_chr2str, // #223 string(float c, ...) chr2str (FTE_STRINGS)
987 VM_strconv, // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS)
988 VM_strpad, // #225 string(float chars, string s, ...) strpad (FTE_STRINGS)
989 VM_infoadd, // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS)
990 VM_infoget, // #227 string(string info, string key) infoget (FTE_STRINGS)
991 VM_strncmp, // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
992 VM_strncasecmp, // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
993 VM_strncasecmp, // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
1063 // deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
1065 // CSQC range #300-#399
1066 VM_CL_R_ClearScene, // #300 void() clearscene (DP_QC_RENDER_SCENE)
1067 VM_CL_R_AddEntities, // #301 void(float mask) addentities (DP_QC_RENDER_SCENE)
1068 VM_CL_R_AddEntity, // #302 void(entity ent) addentity (DP_QC_RENDER_SCENE)
1069 VM_CL_R_SetView, // #303 float(float property, ...) setproperty (DP_QC_RENDER_SCENE)
1070 VM_CL_R_RenderScene, // #304 void() renderscene (DP_QC_RENDER_SCENE)
1071 VM_CL_R_AddDynamicLight, // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (DP_QC_RENDER_SCENE)
1072 VM_CL_R_PolygonBegin, // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon (DP_QC_RENDER_SCENE)
1073 VM_CL_R_PolygonVertex, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (DP_QC_RENDER_SCENE)
1074 VM_CL_R_PolygonEnd, // #308 void() R_EndPolygon
1075 NULL/*VM_CL_R_LoadWorldModel*/, // #309 void(string modelname) R_LoadWorldModel
1076 // TODO: rearrange and merge all builtin lists and share as many extensions as possible between all VM instances [1/27/2008 Andreas]
1077 VM_CL_setattachment, // #310 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) (DP_QC_RENDER_SCENE)
1078 VM_CL_gettagindex, // #311 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1079 VM_CL_gettaginfo, // #312 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
1081 // CSQC range #300-#399
1132 VM_M_isdemo, // #349
1184 VM_M_WriteByte, // #401
1185 VM_M_WriteChar, // #402
1186 VM_M_WriteShort, // #403
1187 VM_M_WriteLong, // #404
1188 VM_M_WriteAngle, // #405
1189 VM_M_WriteCoord, // #406
1190 VM_M_WriteString, // #407
1191 VM_M_WriteEntity, // #408
1223 VM_buf_create, // #440 float() buf_create (DP_QC_STRINGBUFFERS)
1224 VM_buf_del, // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
1225 VM_buf_getsize, // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
1226 VM_buf_copy, // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
1227 VM_buf_sort, // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
1228 VM_buf_implode, // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
1229 VM_bufstr_get, // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
1230 VM_bufstr_set, // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
1231 VM_bufstr_add, // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
1232 VM_bufstr_free, // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
1234 VM_iscachedpic, // #451 draw functions...
1235 VM_precache_pic, // #452
1237 VM_drawcharacter, // #454
1238 VM_drawstring, // #455
1240 VM_drawfill, // #457
1241 VM_drawsetcliparea, // #458
1242 VM_drawresetcliparea, // #459
1243 VM_getimagesize, // #460
1244 VM_cin_open, // #461
1245 VM_cin_close, // #462
1246 VM_cin_setstate, // #463
1247 VM_cin_getstate, // #464
1248 VM_cin_restart, // #465
1249 VM_drawline, // #466
1250 VM_drawcolorcodedstring, // #467
1251 VM_stringwidth, // #468
1252 VM_drawsubpic, // #469
1253 VM_drawrotpic, // #470
1254 VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
1255 VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
1256 VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
1257 VM_atan2, // #474 float(float c, float s) VM_atan2 (DP_QC_ASINACOSATANATAN2TAN)
1258 VM_tan, // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
1259 VM_strlennocol, // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
1260 VM_strdecolorize, // #477 string(string s) : DRESK - Decolorized String (DP_QC_STRINGCOLORFUNCTIONS)
1261 VM_strftime, // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME)
1262 VM_tokenizebyseparator, // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR)
1263 VM_strtolower, // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase
1264 VM_strtoupper, // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase
1267 VM_strreplace, // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
1268 VM_strireplace, // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
1270 VM_gecko_create, // #487 float gecko_create( string name )
1271 VM_gecko_destroy, // #488 void gecko_destroy( string name )
1272 VM_gecko_navigate, // #489 void gecko_navigate( string name, string URI )
1273 VM_gecko_keyevent, // #490 float gecko_keyevent( string name, float key, float eventtype )
1274 VM_gecko_movemouse, // #491 void gecko_mousemove( string name, float x, float y )
1275 VM_gecko_resize, // #492 void gecko_resize( string name, float w, float h )
1276 VM_gecko_get_texture_extent, // #493 vector gecko_get_texture_extent( string name )
1277 VM_crc16, // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
1278 VM_cvar_type, // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE)
1286 VM_whichpack, // #503 string(string) whichpack = #503;
1293 VM_uri_escape, // #510 string(string in) uri_escape = #510;
1294 VM_uri_unescape, // #511 string(string in) uri_unescape = #511;
1295 VM_etof, // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
1296 VM_uri_get, // #513 float(string uril, float id) uri_get = #513; (DP_QC_URI_GET)
1297 VM_tokenize_console, // #514 float(string str) tokenize_console = #514; (DP_QC_TOKENIZE_CONSOLE)
1298 VM_argv_start_index, // #515 float(float idx) argv_start_index = #515; (DP_QC_TOKENIZE_CONSOLE)
1299 VM_argv_end_index, // #516 float(float idx) argv_end_index = #516; (DP_QC_TOKENIZE_CONSOLE)
1300 VM_buf_cvarlist, // #517 void(float buf, string prefix, string antiprefix) buf_cvarlist = #517; (DP_QC_STRINGBUFFERS_CVARLIST)
1301 VM_cvar_description, // #518 float(string name) cvar_description = #518; (DP_QC_CVAR_DESCRIPTION)
1384 VM_M_setkeydest, // #601 void setkeydest(float dest)
1385 VM_M_getkeydest, // #602 float getkeydest(void)
1386 VM_M_setmousetarget, // #603 void setmousetarget(float trg)
1387 VM_M_getmousetarget, // #604 float getmousetarget(void)
1388 VM_callfunction, // #605 void callfunction(...)
1389 VM_writetofile, // #606 void writetofile(float fhandle, entity ent)
1390 VM_isfunction, // #607 float isfunction(string function_name)
1391 VM_M_getresolution, // #608 vector getresolution(float number, [float forfullscreen])
1392 VM_keynumtostring, // #609 string keynumtostring(float keynum)
1393 VM_findkeysforcommand, // #610 string findkeysforcommand(string command)
1394 VM_M_getserverliststat, // #611 float gethostcachevalue(float type)
1395 VM_M_getserverliststring, // #612 string gethostcachestring(float type, float hostnr)
1396 VM_parseentitydata, // #613 void parseentitydata(entity ent, string data)
1397 VM_stringtokeynum, // #614 float stringtokeynum(string key)
1398 VM_M_resetserverlistmasks, // #615 void resethostcachemasks(void)
1399 VM_M_setserverlistmaskstring, // #616 void sethostcachemaskstring(float mask, float fld, string str, float op)
1400 VM_M_setserverlistmasknumber, // #617 void sethostcachemasknumber(float mask, float fld, float num, float op)
1401 VM_M_resortserverlist, // #618 void resorthostcache(void)
1402 VM_M_setserverlistsort, // #619 void sethostcachesort(float fld, float descending)
1403 VM_M_refreshserverlist, // #620 void refreshhostcache(void)
1404 VM_M_getserverlistnumber, // #621 float gethostcachenumber(float fld, float hostnr)
1405 VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
1406 VM_M_addwantedserverlistkey, // #623 void addwantedhostcachekey(string key)
1407 VM_CL_getextresponse, // #624 string getextresponse(void)
1408 VM_netaddress_resolve, // #625 string netaddress_resolve(string, float)
1409 VM_M_getgamedirinfo, // #626 string getgamedirinfo(float n, float prop)
1410 VM_sprintf, // #627 string sprintf(string format, ...)
1414 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
1416 void VM_M_Cmd_Init(void)
1418 r_refdef_scene_t *scene;
1421 VM_Polygons_Reset();
1423 scene = R_GetScenePointer( RST_MENU );
1425 memset (scene, 0, sizeof (*scene));
1427 scene->maxtempentities = 128;
1428 scene->tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * scene->maxtempentities);
1430 scene->maxentities = MAX_EDICTS + 256 + 512;
1431 scene->entities = (entity_render_t **)Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t *) * scene->maxentities);
1433 scene->ambient = 32.0f;
1436 void VM_M_Cmd_Reset(void)
1438 // note: the menu's render entities are automatically freed when the prog's pool is freed
1442 VM_Polygons_Reset();