-Split prvm_cmds.c into prvm_cmds.c, prvm_cmds.h and mvm_cmds.c (clvm_cmds.c
[divverent/darkplaces.git] / mvm_cmds.c
1 #include "prvm_cmds.h"
2
3 //============================================================================
4 // Menu
5
6 char *vm_m_extensions =
7 "DP_CINEMATIC_DPV";
8
9 /*
10 =========
11 VM_M_setmousetarget
12
13 setmousetarget(float target)
14 =========
15 */
16 void VM_M_setmousetarget(void)
17 {
18         VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
19
20         switch((int)PRVM_G_FLOAT(OFS_PARM0))
21         {
22         case 1:
23                 in_client_mouse = false;
24                 break;
25         case 2:
26                 in_client_mouse = true;
27                 break;
28         default:
29                 PRVM_ERROR("VM_M_setmousetarget: wrong destination %i !\n",PRVM_G_FLOAT(OFS_PARM0));
30         }
31 }
32
33 /*
34 =========
35 VM_M_getmousetarget
36
37 float   getmousetarget
38 =========
39 */
40 void VM_M_getmousetarget(void)
41 {
42         VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
43
44         if(in_client_mouse)
45                 PRVM_G_FLOAT(OFS_RETURN) = 2;
46         else
47                 PRVM_G_FLOAT(OFS_RETURN) = 1;
48 }
49
50
51
52 /*
53 =========
54 VM_M_setkeydest
55
56 setkeydest(float dest)
57 =========
58 */
59 void VM_M_setkeydest(void)
60 {
61         VM_SAFEPARMCOUNT(1,VM_M_setkeydest);
62
63         switch((int)PRVM_G_FLOAT(OFS_PARM0))
64         {
65         case 0:
66                 // key_game
67                 key_dest = key_game;
68                 break;
69         case 2:
70                 // key_menu
71                 key_dest = key_menu;
72                 break;
73         case 1:
74                 // key_message
75                 // key_dest = key_message
76                 // break;
77         default:
78                 PRVM_ERROR("VM_M_setkeydest: wrong destination %i !\n",prog->globals[OFS_PARM0]);
79         }
80 }
81
82 /*
83 =========
84 VM_M_getkeydest
85
86 float   getkeydest
87 =========
88 */
89 void VM_M_getkeydest(void)
90 {
91         VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
92
93         // key_game = 0, key_message = 1, key_menu = 2, unknown = 3
94         switch(key_dest)
95         {
96         case key_game:
97                 PRVM_G_FLOAT(OFS_RETURN) = 0;
98                 break;
99         case key_menu:
100                 PRVM_G_FLOAT(OFS_RETURN) = 2;
101                 break;
102         case key_message:
103                 // not supported
104                 // PRVM_G_FLOAT(OFS_RETURN) = 1;
105                 // break;
106         default:
107                 PRVM_G_FLOAT(OFS_RETURN) = 3;
108         }
109 }
110
111 /*
112 =========
113 VM_M_callfunction
114
115         callfunction(...,string function_name)
116 Extension: pass
117 =========
118 */
119 mfunction_t *PRVM_ED_FindFunction (const char *name);
120 void VM_M_callfunction(void)
121 {
122         mfunction_t *func;
123         const char *s;
124
125         if(prog->argc == 0)
126                 PRVM_ERROR("VM_M_callfunction: 1 parameter is required !\n");
127
128         s = PRVM_G_STRING(OFS_PARM0 + (prog->argc - 1));
129
130         if(!s)
131                 PRVM_ERROR("VM_M_callfunction: null string !\n");
132
133         VM_CheckEmptyString(s);
134
135         func = PRVM_ED_FindFunction(s);
136
137         if(!func)
138                 PRVM_ERROR("VM_M_callfunciton: function %s not found !\n", s);
139         else if (func->first_statement < 0)
140         {
141                 // negative statements are built in functions
142                 int builtinnumber = -func->first_statement;
143                 prog->xfunction->builtinsprofile++;
144                 if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
145                         prog->builtins[builtinnumber]();
146                 else
147                         PRVM_ERROR("No such builtin #%i in %s", builtinnumber, PRVM_NAME);
148         }
149         else if(func > 0)
150         {
151                 prog->argc--;
152                 PRVM_ExecuteProgram(func - prog->functions,"");
153                 prog->argc++;
154         }
155 }
156
157 /*
158 =========
159 VM_M_isfunction
160
161 float   isfunction(string function_name)
162 =========
163 */
164 mfunction_t *PRVM_ED_FindFunction (const char *name);
165 void VM_M_isfunction(void)
166 {
167         mfunction_t *func;
168         const char *s;
169
170         VM_SAFEPARMCOUNT(1, VM_M_isfunction);
171
172         s = PRVM_G_STRING(OFS_PARM0);
173
174         if(!s)
175                 PRVM_ERROR("VM_M_isfunction: null string !\n");
176
177         VM_CheckEmptyString(s);
178
179         func = PRVM_ED_FindFunction(s);
180
181         if(!func)
182                 PRVM_G_FLOAT(OFS_RETURN) = false;
183         else
184                 PRVM_G_FLOAT(OFS_RETURN) = true;
185 }
186
187 /*
188 =========
189 VM_M_writetofile
190
191         writetofile(float fhandle, entity ent)
192 =========
193 */
194 void VM_M_writetofile(void)
195 {
196         prvm_edict_t * ent;
197         qfile_t *file;
198
199         VM_SAFEPARMCOUNT(2, VM_M_writetofile);
200
201         file = VM_GetFileHandle( PRVM_G_FLOAT(OFS_PARM0) );
202         if( !file ) {
203                 return;
204         }
205         
206         ent = PRVM_G_EDICT(OFS_PARM1);
207         if(ent->priv.required->free)
208         {
209                 Con_Printf("VM_M_writetofile: %s: entity %i is free !\n", PRVM_NAME, PRVM_EDICT_NUM(OFS_PARM1));
210                 return;
211         }
212
213         PRVM_ED_Write (file, ent);
214 }
215
216 /*
217 =========
218 VM_M_getresolution
219
220 vector  getresolution(float number)
221 =========
222 */
223 extern unsigned short video_resolutions[][2];
224 void VM_M_getresolution(void)
225 {
226         int nr;
227         VM_SAFEPARMCOUNT(1, VM_getresolution);
228
229         nr = PRVM_G_FLOAT(OFS_PARM0);
230
231
232         PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr][0];
233         PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr][1];
234         PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
235 }
236
237 /*
238 =========
239 VM_M_keynumtostring
240
241 string keynumtostring(float keynum)
242 =========
243 */
244 void VM_M_keynumtostring(void)
245 {
246         int keynum;
247         char *tmp;
248         VM_SAFEPARMCOUNT(1, VM_M_keynumtostring);
249
250         keynum = PRVM_G_FLOAT(OFS_PARM0);
251
252         tmp = VM_GetTempString();
253
254         strcpy(tmp, Key_KeynumToString(keynum));
255
256         PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(tmp);
257 }
258
259 /*
260 =========
261 VM_M_stringtokeynum
262
263 float stringtokeynum(string key)
264 =========
265 */
266 void VM_M_stringtokeynum( void )
267 {
268         const char *str;
269         VM_SAFEPARMCOUNT( 1, VM_M_keynumtostring );
270
271         str = PRVM_G_STRING( OFS_PARM0 );
272
273         PRVM_G_INT(OFS_RETURN) = Key_StringToKeynum( str );
274 }
275
276 /*
277 =========
278 VM_M_findkeysforcommand
279
280 string  findkeysforcommand(string command)
281
282 the returned string is an altstring
283 =========
284 */
285 #define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
286
287 void M_FindKeysForCommand(const char *command, int *keys);
288 void VM_M_findkeysforcommand(void)
289 {
290         const char *cmd;
291         char *ret;
292         int keys[NUMKEYS];
293         int i;
294
295         VM_SAFEPARMCOUNT(1, VM_M_findkeysforcommand);
296
297         cmd = PRVM_G_STRING(OFS_PARM0);
298
299         VM_CheckEmptyString(cmd);
300
301         (ret = VM_GetTempString())[0] = 0;
302
303         M_FindKeysForCommand(cmd, keys);
304
305         for(i = 0; i < NUMKEYS; i++)
306                 ret = strcat(ret, va(" \'%i\'", keys[i]));
307
308         PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(ret);
309 }
310
311 /*
312 =========
313 VM_M_getserverliststat
314
315 float   getserverliststat(float type)
316 =========
317 */
318 /*
319         type:
320 0       serverlist_viewcount
321 1   serverlist_totalcount
322 2       masterquerycount
323 3       masterreplycount
324 4       serverquerycount
325 5       serverreplycount
326 6       sortfield
327 7       sortdescending
328 */
329 void VM_M_getserverliststat( void )
330 {
331         int type;
332         VM_SAFEPARMCOUNT ( 1, VM_M_getserverliststat );
333
334         PRVM_G_FLOAT( OFS_RETURN ) = 0;
335
336         type = PRVM_G_FLOAT( OFS_PARM0 );
337         switch(type)
338         {
339         case 0:
340                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_viewcount;
341                 return;
342         case 1:
343                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_cachecount;
344         case 2:
345                 PRVM_G_FLOAT ( OFS_RETURN ) = masterquerycount;
346                 return;
347         case 3:
348                 PRVM_G_FLOAT ( OFS_RETURN ) = masterreplycount;
349                 return;
350         case 4:
351                 PRVM_G_FLOAT ( OFS_RETURN ) = serverquerycount;
352                 return;
353         case 5:
354                 PRVM_G_FLOAT ( OFS_RETURN ) = serverreplycount;
355                 return;
356         case 6:
357                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield;
358                 return;
359         case 7:
360                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortdescending;
361                 return;
362         default:
363                 Con_Printf( "VM_M_getserverliststat: bad type %i!\n", type );
364         }
365 }
366
367 /*
368 ========================
369 VM_M_resetserverlistmasks
370
371 resetserverlistmasks()
372 ========================
373 */
374 void VM_M_resetserverlistmasks( void )
375 {
376         ServerList_ResetMasks();
377 }
378
379
380 /*
381 ========================
382 VM_M_setserverlistmaskstring
383
384 setserverlistmaskstring(float mask, float fld, string str, float op)
385 0-511           and
386 512 - 1024      or
387 ========================
388 */
389 void VM_M_setserverlistmaskstring( void )
390 {
391         const char *str;
392         int masknr;
393         serverlist_mask_t *mask;
394         int field;
395
396         VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmaskstring );
397         str = PRVM_G_STRING( OFS_PARM1 );
398         if( !str )
399                 PRVM_ERROR( "VM_M_setserverlistmaskstring: null string passed!" );
400
401         masknr = PRVM_G_FLOAT( OFS_PARM0 );
402         if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
403                 mask = &serverlist_andmasks[masknr];
404         else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
405                 mask = &serverlist_ormasks[masknr - 512 ];
406         else {
407                 Con_Printf( "VM_M_setserverlistmaskstring: invalid mask number %i\n", masknr );
408                 return;
409         }
410
411         field = (int) PRVM_G_FLOAT( OFS_PARM1 );
412
413         switch( field ) {
414                 case SLIF_CNAME:
415                         strncpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) );
416                         break;
417                 case SLIF_NAME:
418                         strncpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name)  );
419                         break;
420                 case SLIF_MAP:
421                         strncpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map)  );
422                         break;
423                 case SLIF_MOD:
424                         strncpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod)  );
425                         break;
426                 case SLIF_GAME:
427                         strncpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game)  );
428                         break;
429                 default:
430                         Con_Printf( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field );
431                         return;
432         }
433
434         mask->active = true;
435         mask->tests[field] = (int) PRVM_G_FLOAT( OFS_PARM3 );
436 }
437
438 /*
439 ========================
440 VM_M_setserverlistmasknumber
441
442 setserverlistmasknumber(float mask, float fld, float num, float op)
443
444 0-511           and
445 512 - 1024      or
446 ========================
447 */
448 void VM_M_setserverlistmasknumber( void )
449 {
450         int number;
451         serverlist_mask_t *mask;
452         int     masknr;
453         int field;
454         VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
455
456         masknr = PRVM_G_FLOAT( OFS_PARM0 );
457         if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
458                 mask = &serverlist_andmasks[masknr];
459         else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
460                 mask = &serverlist_ormasks[masknr - 512 ];
461         else {
462                 Con_Printf( "VM_M_setserverlistmasknumber: invalid mask number %i\n", masknr );
463                 return;
464         }
465
466         number = PRVM_G_FLOAT( OFS_PARM2 );
467         field = (int) PRVM_G_FLOAT( OFS_PARM1 );
468
469         switch( field ) {
470                 case SLIF_MAXPLAYERS:
471                         mask->info.maxplayers = number;
472                         break;
473                 case SLIF_NUMPLAYERS:
474                         mask->info.numplayers = number;
475                         break;
476                 case SLIF_PING:
477                         mask->info.ping = number;
478                         break;
479                 case SLIF_PROTOCOL:
480                         mask->info.protocol = number;
481                         break;
482                 default:
483                         Con_Printf( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
484                         return;
485         }
486
487         mask->active = true;
488         mask->tests[field] = (int) PRVM_G_FLOAT( OFS_PARM3 );
489 }
490
491
492 /*
493 ========================
494 VM_M_resortserverlist
495
496 resortserverlist
497 ========================
498 */
499 void VM_M_resortserverlist( void )
500 {
501         ServerList_RebuildViewList();
502 }
503
504 /*
505 =========
506 VM_M_getserverliststring
507
508 string  getserverliststring(float field, float hostnr)
509 =========
510 */
511 void VM_M_getserverliststring(void)
512 {
513         serverlist_entry_t *cache;
514         int hostnr;
515
516         VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
517
518         PRVM_G_INT(OFS_RETURN) = 0;
519
520         hostnr = PRVM_G_FLOAT(OFS_PARM1);
521
522         if(hostnr < 0 || hostnr >= serverlist_viewcount)
523         {
524                 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
525                 return;
526         }
527         cache = serverlist_viewlist[hostnr];
528         switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
529                 case SLIF_CNAME:
530                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname );
531                         break;
532                 case SLIF_NAME:
533                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
534                         break;
535                 case SLIF_GAME:
536                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
537                         break;
538                 case SLIF_MOD:
539                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod );
540                         break;
541                 case SLIF_MAP:
542                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map );
543                         break;
544                 // TODO remove this again
545                 case 1024:
546                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 );
547                         break;
548                 case 1025:
549                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 );
550                         break;
551                 default:
552                         Con_Print("VM_M_getserverliststring: bad field number passed!\n");
553         }
554 }
555
556 /*
557 =========
558 VM_M_getserverlistnumber
559
560 float   getserverlistnumber(float field, float hostnr)
561 =========
562 */
563 void VM_M_getserverlistnumber(void)
564 {
565         serverlist_entry_t *cache;
566         int hostnr;
567
568         VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
569
570         PRVM_G_INT(OFS_RETURN) = 0;
571
572         hostnr = PRVM_G_FLOAT(OFS_PARM1);
573
574         if(hostnr < 0 || hostnr >= serverlist_viewcount)
575         {
576                 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
577                 return;
578         }
579         cache = serverlist_viewlist[hostnr];
580         switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
581                 case SLIF_MAXPLAYERS:
582                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers;
583                         break;
584                 case SLIF_NUMPLAYERS:
585                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numplayers;
586                         break;
587                 case SLIF_PING:
588                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.ping;
589                         break;
590                 case SLIF_PROTOCOL:
591                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol;
592                         break;
593                 default:
594                         Con_Print("VM_M_getserverlistnumber: bad field number passed!\n");
595         }
596 }
597
598 /*
599 ========================
600 VM_M_setserverlistsort
601
602 setserverlistsort(float field, float descending)
603 ========================
604 */
605 void VM_M_setserverlistsort( void )
606 {
607         VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
608
609         serverlist_sortbyfield = (int) PRVM_G_FLOAT( OFS_PARM0 );
610         serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 );
611 }
612
613 /*
614 ========================
615 VM_M_refreshserverlist
616
617 refreshserverlist()
618 ========================
619 */
620 void VM_M_refreshserverlist( void )
621 {
622         VM_SAFEPARMCOUNT( 0, VM_M_refreshserverlist );
623         ServerList_QueryList();
624 }
625
626 /*
627 ========================
628 VM_M_getserverlistindexforkey
629
630 float getserverlistindexforkey(string key)
631 ========================
632 */
633 void VM_M_getserverlistindexforkey( void )
634 {
635         const char *key;
636         VM_SAFEPARMCOUNT( 1, VM_M_getserverlistindexforkey );
637
638         key = PRVM_G_STRING( OFS_PARM0 );
639         VM_CheckEmptyString( key );
640
641         if( !strcmp( key, "cname" ) )
642                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_CNAME;
643         else if( !strcmp( key, "ping" ) )
644                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PING;
645         else if( !strcmp( key, "game" ) )
646                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_GAME;
647         else if( !strcmp( key, "mod" ) )
648                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MOD;
649         else if( !strcmp( key, "map" ) )
650                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
651         else if( !strcmp( key, "name" ) )
652                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
653         else if( !strcmp( key, "maxplayers" ) )
654                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
655         else if( !strcmp( key, "numplayers" ) )
656                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMPLAYERS;
657         else if( !strcmp( key, "protocol" ) )
658                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL;
659         else
660                 PRVM_G_FLOAT( OFS_RETURN ) = -1;
661 }
662
663 /*
664 ========================
665 VM_M_addwantedserverlistkey
666
667 addwantedserverlistkey(string key)
668 ========================
669 */
670 void VM_M_addwantedserverlistkey( void )
671 {
672         VM_SAFEPARMCOUNT( 1, VM_M_addwantedserverlistkey );
673 }
674
675 prvm_builtin_t vm_m_builtins[] = {
676         0, // to be consistent with the old vm
677         // common builtings (mostly)
678         VM_checkextension,
679         VM_error,
680         VM_objerror,
681         VM_print,
682         VM_bprint,
683         VM_sprint,
684         VM_centerprint,
685         VM_normalize,
686         VM_vlen,
687         VM_vectoyaw,    // #10
688         VM_vectoangles,
689         VM_random,
690         VM_localcmd,
691         VM_cvar,
692         VM_cvar_set,
693         VM_dprint,
694         VM_ftos,
695         VM_fabs,
696         VM_vtos,
697         VM_etos,                // 20
698         VM_stof,
699         VM_spawn,
700         VM_remove,
701         VM_find,
702         VM_findfloat,
703         VM_findchain,
704         VM_findchainfloat,
705         VM_precache_file,
706         VM_precache_sound,
707         VM_coredump,    // 30
708         VM_traceon,
709         VM_traceoff,
710         VM_eprint,
711         VM_rint,
712         VM_floor,
713         VM_ceil,
714         VM_nextent,
715         VM_sin,
716         VM_cos,
717         VM_sqrt,                // 40
718         VM_randomvec,
719         VM_registercvar,
720         VM_min,
721         VM_max,
722         VM_bound,
723         VM_pow,
724         VM_copyentity,
725         VM_fopen,
726         VM_fclose,
727         VM_fgets,               // 50
728         VM_fputs,
729         VM_strlen,
730         VM_strcat,
731         VM_substring,
732         VM_stov,
733         VM_strzone,
734         VM_strunzone,
735         VM_tokenize,
736         VM_argv,
737         VM_isserver,    // 60
738         VM_clientcount,
739         VM_clientstate,
740         VM_clcommand,
741         VM_changelevel,
742         VM_localsound,
743         VM_getmousepos,
744         VM_gettime,
745         VM_loadfromdata,
746         VM_loadfromfile,
747         VM_modulo,              // 70
748         VM_cvar_string,
749         VM_crash,
750         VM_stackdump,   // 73
751         VM_search_begin,
752         VM_search_end,
753         VM_search_getsize,
754         VM_search_getfilename, // 77
755         VM_chr,
756         VM_itof,
757         VM_ftoi,                // 80
758         VM_itof,                // isString
759         VM_altstr_count,
760         VM_altstr_prepare,
761         VM_altstr_get,
762         VM_altstr_set,
763         VM_altstr_ins,  // 86
764         0,0,0,0,        // 90
765         e10,                    // 100
766         e100,                   // 200
767         e100,                   // 300
768         e100,                   // 400
769         // msg functions
770         VM_WriteByte,
771         VM_WriteChar,
772         VM_WriteShort,
773         VM_WriteLong,
774         VM_WriteAngle,
775         VM_WriteCoord,
776         VM_WriteString,
777         VM_WriteEntity, // 408
778         0,
779         0,                              // 410
780         e10,                    // 420
781         e10,                    // 430
782         e10,                    // 440
783         e10,                    // 450
784         // draw functions
785         VM_iscachedpic,
786         VM_precache_pic,
787         VM_freepic,
788         VM_drawcharacter,
789         VM_drawstring,
790         VM_drawpic,
791         VM_drawfill,
792         VM_drawsetcliparea,
793         VM_drawresetcliparea,
794         VM_getimagesize,// 460
795         VM_cin_open,
796         VM_cin_close,
797         VM_cin_setstate,
798         VM_cin_getstate,
799         VM_cin_restart, // 465
800         0,0,0,0,0,      // 470
801         e10,                    // 480
802         e10,                    // 490
803         e10,                    // 500
804         e100,                   // 600
805         // menu functions
806         VM_M_setkeydest,
807         VM_M_getkeydest,
808         VM_M_setmousetarget,
809         VM_M_getmousetarget,
810         VM_M_callfunction,
811         VM_M_writetofile,
812         VM_M_isfunction,
813         VM_M_getresolution,
814         VM_M_keynumtostring,
815         VM_M_findkeysforcommand,// 610
816         VM_M_getserverliststat,
817         VM_M_getserverliststring,
818         VM_parseentitydata,
819         VM_M_stringtokeynum,
820         VM_M_resetserverlistmasks,
821         VM_M_setserverlistmaskstring,
822         VM_M_setserverlistmasknumber,
823         VM_M_resortserverlist,
824         VM_M_setserverlistsort,
825         VM_M_refreshserverlist,
826         VM_M_getserverlistnumber,
827         VM_M_getserverlistindexforkey,
828         VM_M_addwantedserverlistkey // 623
829 };
830
831 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
832
833 void VM_M_Cmd_Init(void)
834 {
835         VM_Cmd_Init();
836 }
837
838 void VM_M_Cmd_Reset(void)
839 {
840         //VM_Cmd_Init();
841         VM_Cmd_Reset();
842 }