add DP_FONT_VARIABLEWIDTH to menu extensions list; later plan: find a builtin number...
[divverent/darkplaces.git] / mvm_cmds.c
1 #include "quakedef.h"
2
3 #include "prvm_cmds.h"
4 #include "menu.h"
5
6 //============================================================================
7 // Menu
8
9 char *vm_m_extensions =
10 "BX_WAL_SUPPORT "
11 "DP_CINEMATIC_DPV "
12 "DP_MENU_EXTRESPONSEPACKET "
13 "DP_QC_ASINACOSATANATAN2TAN "
14 "DP_QC_STRFTIME "
15 "DP_QC_STRING_CASE_FUNCTIONS "
16 "DP_QC_STRINGCOLORFUNCTIONS "
17 "DP_QC_TOKENIZEBYSEPARATOR "
18 "DP_QC_UNLIMITEDTEMPSTRINGS "
19 "DP_QC_CMD "
20 "DP_QC_STRREPLACE "
21 "DP_FONT_VARIABLEWIDTH "
22 ;
23
24 /*
25 =========
26 VM_M_setmousetarget
27
28 setmousetarget(float target)
29 =========
30 */
31 void VM_M_setmousetarget(void)
32 {
33         VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
34
35         switch((int)PRVM_G_FLOAT(OFS_PARM0))
36         {
37         case 1:
38                 in_client_mouse = false;
39                 break;
40         case 2:
41                 in_client_mouse = true;
42                 break;
43         default:
44                 PRVM_ERROR("VM_M_setmousetarget: wrong destination %f !",PRVM_G_FLOAT(OFS_PARM0));
45         }
46 }
47
48 /*
49 =========
50 VM_M_getmousetarget
51
52 float   getmousetarget
53 =========
54 */
55 void VM_M_getmousetarget(void)
56 {
57         VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
58
59         if(in_client_mouse)
60                 PRVM_G_FLOAT(OFS_RETURN) = 2;
61         else
62                 PRVM_G_FLOAT(OFS_RETURN) = 1;
63 }
64
65
66
67 /*
68 =========
69 VM_M_setkeydest
70
71 setkeydest(float dest)
72 =========
73 */
74 void VM_M_setkeydest(void)
75 {
76         VM_SAFEPARMCOUNT(1,VM_M_setkeydest);
77
78         switch((int)PRVM_G_FLOAT(OFS_PARM0))
79         {
80         case 0:
81                 // key_game
82                 key_dest = key_game;
83                 break;
84         case 2:
85                 // key_menu
86                 key_dest = key_menu;
87                 break;
88         case 1:
89                 // key_message
90                 // key_dest = key_message
91                 // break;
92         default:
93                 PRVM_ERROR("VM_M_setkeydest: wrong destination %f !", PRVM_G_FLOAT(OFS_PARM0));
94         }
95 }
96
97 /*
98 =========
99 VM_M_getkeydest
100
101 float   getkeydest
102 =========
103 */
104 void VM_M_getkeydest(void)
105 {
106         VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
107
108         // key_game = 0, key_message = 1, key_menu = 2, unknown = 3
109         switch(key_dest)
110         {
111         case key_game:
112                 PRVM_G_FLOAT(OFS_RETURN) = 0;
113                 break;
114         case key_menu:
115                 PRVM_G_FLOAT(OFS_RETURN) = 2;
116                 break;
117         case key_message:
118                 // not supported
119                 // PRVM_G_FLOAT(OFS_RETURN) = 1;
120                 // break;
121         default:
122                 PRVM_G_FLOAT(OFS_RETURN) = 3;
123         }
124 }
125
126 /*
127 =========
128 VM_M_callfunction
129
130         callfunction(...,string function_name)
131 Extension: pass
132 =========
133 */
134 mfunction_t *PRVM_ED_FindFunction (const char *name);
135 void VM_M_callfunction(void)
136 {
137         mfunction_t *func;
138         const char *s;
139
140         VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction);
141
142         s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
143
144         VM_CheckEmptyString(s);
145
146         func = PRVM_ED_FindFunction(s);
147
148         if(!func)
149                 PRVM_ERROR("VM_M_callfunciton: function %s not found !", s);
150         else if (func->first_statement < 0)
151         {
152                 // negative statements are built in functions
153                 int builtinnumber = -func->first_statement;
154                 prog->xfunction->builtinsprofile++;
155                 if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
156                         prog->builtins[builtinnumber]();
157                 else
158                         PRVM_ERROR("No such builtin #%i in %s", builtinnumber, PRVM_NAME);
159         }
160         else if(func - prog->functions > 0)
161         {
162                 prog->argc--;
163                 PRVM_ExecuteProgram(func - prog->functions,"");
164                 prog->argc++;
165         }
166 }
167
168 /*
169 =========
170 VM_M_isfunction
171
172 float   isfunction(string function_name)
173 =========
174 */
175 mfunction_t *PRVM_ED_FindFunction (const char *name);
176 void VM_M_isfunction(void)
177 {
178         mfunction_t *func;
179         const char *s;
180
181         VM_SAFEPARMCOUNT(1, VM_M_isfunction);
182
183         s = PRVM_G_STRING(OFS_PARM0);
184
185         VM_CheckEmptyString(s);
186
187         func = PRVM_ED_FindFunction(s);
188
189         if(!func)
190                 PRVM_G_FLOAT(OFS_RETURN) = false;
191         else
192                 PRVM_G_FLOAT(OFS_RETURN) = true;
193 }
194
195 /*
196 =========
197 VM_M_getresolution
198
199 vector  getresolution(float number)
200 =========
201 */
202 void VM_M_getresolution(void)
203 {
204         int nr;
205         VM_SAFEPARMCOUNT(1, VM_getresolution);
206
207         nr = (int)PRVM_G_FLOAT(OFS_PARM0);
208
209         // FIXME bounds check
210         PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width;
211         PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height;
212         PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
213 }
214
215 /*
216 =========
217 VM_M_findkeysforcommand
218
219 string  findkeysforcommand(string command)
220
221 the returned string is an altstring
222 =========
223 */
224 #define NUMKEYS 5 // TODO: merge the constant in keys.c with this one somewhen
225
226 void M_FindKeysForCommand(const char *command, int *keys);
227 void VM_M_findkeysforcommand(void)
228 {
229         const char *cmd;
230         char ret[VM_STRINGTEMP_LENGTH];
231         int keys[NUMKEYS];
232         int i;
233
234         VM_SAFEPARMCOUNT(1, VM_M_findkeysforcommand);
235
236         cmd = PRVM_G_STRING(OFS_PARM0);
237
238         VM_CheckEmptyString(cmd);
239
240         M_FindKeysForCommand(cmd, keys);
241
242         ret[0] = 0;
243         for(i = 0; i < NUMKEYS; i++)
244                 strlcat(ret, va(" \'%i\'", keys[i]), sizeof(ret));
245
246         PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(ret);
247 }
248
249 /*
250 =========
251 VM_M_getserverliststat
252
253 float   getserverliststat(float type)
254 =========
255 */
256 /*
257         type:
258 0       serverlist_viewcount
259 1   serverlist_totalcount
260 2       masterquerycount
261 3       masterreplycount
262 4       serverquerycount
263 5       serverreplycount
264 6       sortfield
265 7       sortdescending
266 */
267 void VM_M_getserverliststat( void )
268 {
269         int type;
270         VM_SAFEPARMCOUNT ( 1, VM_M_getserverliststat );
271
272         PRVM_G_FLOAT( OFS_RETURN ) = 0;
273
274         type = (int)PRVM_G_FLOAT( OFS_PARM0 );
275         switch(type)
276         {
277         case 0:
278                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_viewcount;
279                 return;
280         case 1:
281                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_cachecount;
282         case 2:
283                 PRVM_G_FLOAT ( OFS_RETURN ) = masterquerycount;
284                 return;
285         case 3:
286                 PRVM_G_FLOAT ( OFS_RETURN ) = masterreplycount;
287                 return;
288         case 4:
289                 PRVM_G_FLOAT ( OFS_RETURN ) = serverquerycount;
290                 return;
291         case 5:
292                 PRVM_G_FLOAT ( OFS_RETURN ) = serverreplycount;
293                 return;
294         case 6:
295                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortbyfield;
296                 return;
297         case 7:
298                 PRVM_G_FLOAT ( OFS_RETURN ) = serverlist_sortdescending;
299                 return;
300         default:
301                 VM_Warning( "VM_M_getserverliststat: bad type %i!\n", type );
302         }
303 }
304
305 /*
306 ========================
307 VM_M_resetserverlistmasks
308
309 resetserverlistmasks()
310 ========================
311 */
312 void VM_M_resetserverlistmasks( void )
313 {
314         VM_SAFEPARMCOUNT(0, VM_M_resetserverlistmasks);
315         ServerList_ResetMasks();
316 }
317
318
319 /*
320 ========================
321 VM_M_setserverlistmaskstring
322
323 setserverlistmaskstring(float mask, float fld, string str, float op)
324 0-511           and
325 512 - 1024      or
326 ========================
327 */
328 void VM_M_setserverlistmaskstring( void )
329 {
330         const char *str;
331         int masknr;
332         serverlist_mask_t *mask;
333         int field;
334
335         VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmaskstring );
336         str = PRVM_G_STRING( OFS_PARM2 );
337
338         masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
339         if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
340                 mask = &serverlist_andmasks[masknr];
341         else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
342                 mask = &serverlist_ormasks[masknr - 512 ];
343         else
344         {
345                 VM_Warning( "VM_M_setserverlistmaskstring: invalid mask number %i\n", masknr );
346                 return;
347         }
348
349         field = (int) PRVM_G_FLOAT( OFS_PARM1 );
350
351         switch( field ) {
352                 case SLIF_CNAME:
353                         strlcpy( mask->info.cname, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.cname) );
354                         break;
355                 case SLIF_NAME:
356                         strlcpy( mask->info.name, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.name)  );
357                         break;
358                 case SLIF_MAP:
359                         strlcpy( mask->info.map, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.map)  );
360                         break;
361                 case SLIF_MOD:
362                         strlcpy( mask->info.mod, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.mod)  );
363                         break;
364                 case SLIF_GAME:
365                         strlcpy( mask->info.game, PRVM_G_STRING( OFS_PARM2 ), sizeof(mask->info.game)  );
366                         break;
367                 default:
368                         VM_Warning( "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field );
369                         return;
370         }
371
372         mask->active = true;
373         mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
374 }
375
376 /*
377 ========================
378 VM_M_setserverlistmasknumber
379
380 setserverlistmasknumber(float mask, float fld, float num, float op)
381
382 0-511           and
383 512 - 1024      or
384 ========================
385 */
386 void VM_M_setserverlistmasknumber( void )
387 {
388         int number;
389         serverlist_mask_t *mask;
390         int     masknr;
391         int field;
392         VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
393
394         masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
395         if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
396                 mask = &serverlist_andmasks[masknr];
397         else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
398                 mask = &serverlist_ormasks[masknr - 512 ];
399         else
400         {
401                 VM_Warning( "VM_M_setserverlistmasknumber: invalid mask number %i\n", masknr );
402                 return;
403         }
404
405         number = (int)PRVM_G_FLOAT( OFS_PARM2 );
406         field = (int) PRVM_G_FLOAT( OFS_PARM1 );
407
408         switch( field ) {
409                 case SLIF_MAXPLAYERS:
410                         mask->info.maxplayers = number;
411                         break;
412                 case SLIF_NUMPLAYERS:
413                         mask->info.numplayers = number;
414                         break;
415                 case SLIF_NUMBOTS:
416                         mask->info.numbots = number;
417                         break;
418                 case SLIF_NUMHUMANS:
419                         mask->info.numhumans = number;
420                         break;
421                 case SLIF_PING:
422                         mask->info.ping = number;
423                         break;
424                 case SLIF_PROTOCOL:
425                         mask->info.protocol = number;
426                         break;
427                 case SLIF_FREESLOTS:
428                         mask->info.freeslots = number;
429                         break;
430                 default:
431                         VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
432                         return;
433         }
434
435         mask->active = true;
436         mask->tests[field] = (serverlist_maskop_t)((int)PRVM_G_FLOAT( OFS_PARM3 ));
437 }
438
439
440 /*
441 ========================
442 VM_M_resortserverlist
443
444 resortserverlist
445 ========================
446 */
447 void VM_M_resortserverlist( void )
448 {
449         VM_SAFEPARMCOUNT(0, VM_M_resortserverlist);
450         ServerList_RebuildViewList();
451 }
452
453 /*
454 =========
455 VM_M_getserverliststring
456
457 string  getserverliststring(float field, float hostnr)
458 =========
459 */
460 void VM_M_getserverliststring(void)
461 {
462         serverlist_entry_t *cache;
463         int hostnr;
464
465         VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
466
467         PRVM_G_INT(OFS_RETURN) = OFS_NULL;
468
469         hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
470
471         if(hostnr < 0 || hostnr >= serverlist_viewcount)
472         {
473                 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
474                 return;
475         }
476         cache = serverlist_viewlist[hostnr];
477         switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
478                 case SLIF_CNAME:
479                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.cname );
480                         break;
481                 case SLIF_NAME:
482                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.name );
483                         break;
484                 case SLIF_GAME:
485                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.game );
486                         break;
487                 case SLIF_MOD:
488                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.mod );
489                         break;
490                 case SLIF_MAP:
491                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->info.map );
492                         break;
493                 // TODO remove this again
494                 case 1024:
495                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line1 );
496                         break;
497                 case 1025:
498                         PRVM_G_INT( OFS_RETURN ) = PRVM_SetEngineString( cache->line2 );
499                         break;
500                 default:
501                         Con_Print("VM_M_getserverliststring: bad field number passed!\n");
502         }
503 }
504
505 /*
506 =========
507 VM_M_getserverlistnumber
508
509 float   getserverlistnumber(float field, float hostnr)
510 =========
511 */
512 void VM_M_getserverlistnumber(void)
513 {
514         serverlist_entry_t *cache;
515         int hostnr;
516
517         VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);
518
519         PRVM_G_INT(OFS_RETURN) = OFS_NULL;
520
521         hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
522
523         if(hostnr < 0 || hostnr >= serverlist_viewcount)
524         {
525                 Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
526                 return;
527         }
528         cache = serverlist_viewlist[hostnr];
529         switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
530                 case SLIF_MAXPLAYERS:
531                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.maxplayers;
532                         break;
533                 case SLIF_NUMPLAYERS:
534                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numplayers;
535                         break;
536                 case SLIF_NUMBOTS:
537                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numbots;
538                         break;
539                 case SLIF_NUMHUMANS:
540                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.numhumans;
541                         break;
542                 case SLIF_FREESLOTS:
543                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.freeslots;
544                         break;
545                 case SLIF_PING:
546                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.ping;
547                         break;
548                 case SLIF_PROTOCOL:
549                         PRVM_G_FLOAT( OFS_RETURN ) = cache->info.protocol;
550                         break;
551                 default:
552                         Con_Print("VM_M_getserverlistnumber: bad field number passed!\n");
553         }
554 }
555
556 /*
557 ========================
558 VM_M_setserverlistsort
559
560 setserverlistsort(float field, float descending)
561 ========================
562 */
563 void VM_M_setserverlistsort( void )
564 {
565         VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
566
567         serverlist_sortbyfield = (serverlist_infofield_t)((int)PRVM_G_FLOAT( OFS_PARM0 ));
568         serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 );
569 }
570
571 /*
572 ========================
573 VM_M_refreshserverlist
574
575 refreshserverlist()
576 ========================
577 */
578 void VM_M_refreshserverlist( void )
579 {
580         VM_SAFEPARMCOUNT( 0, VM_M_refreshserverlist );
581         ServerList_QueryList(false, true, false, false);
582 }
583
584 /*
585 ========================
586 VM_M_getserverlistindexforkey
587
588 float getserverlistindexforkey(string key)
589 ========================
590 */
591 void VM_M_getserverlistindexforkey( void )
592 {
593         const char *key;
594         VM_SAFEPARMCOUNT( 1, VM_M_getserverlistindexforkey );
595
596         key = PRVM_G_STRING( OFS_PARM0 );
597         VM_CheckEmptyString( key );
598
599         if( !strcmp( key, "cname" ) )
600                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_CNAME;
601         else if( !strcmp( key, "ping" ) )
602                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PING;
603         else if( !strcmp( key, "game" ) )
604                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_GAME;
605         else if( !strcmp( key, "mod" ) )
606                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MOD;
607         else if( !strcmp( key, "map" ) )
608                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAP;
609         else if( !strcmp( key, "name" ) )
610                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NAME;
611         else if( !strcmp( key, "maxplayers" ) )
612                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_MAXPLAYERS;
613         else if( !strcmp( key, "numplayers" ) )
614                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMPLAYERS;
615         else if( !strcmp( key, "numbots" ) )
616                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMBOTS;
617         else if( !strcmp( key, "numhumans" ) )
618                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_NUMHUMANS;
619         else if( !strcmp( key, "freeslots" ) )
620                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_FREESLOTS;
621         else if( !strcmp( key, "protocol" ) )
622                 PRVM_G_FLOAT( OFS_RETURN ) = SLIF_PROTOCOL;
623         else
624                 PRVM_G_FLOAT( OFS_RETURN ) = -1;
625 }
626
627 /*
628 ========================
629 VM_M_addwantedserverlistkey
630
631 addwantedserverlistkey(string key)
632 ========================
633 */
634 void VM_M_addwantedserverlistkey( void )
635 {
636         VM_SAFEPARMCOUNT( 1, VM_M_addwantedserverlistkey );
637 }
638
639 /*
640 ===============================================================================
641 MESSAGE WRITING
642
643 used only for client and menu
644 server uses VM_SV_...
645
646 Write*(* data, float type, float to)
647
648 ===============================================================================
649 */
650
651 #define MSG_BROADCAST   0               // unreliable to all
652 #define MSG_ONE                 1               // reliable to one (msg_entity)
653 #define MSG_ALL                 2               // reliable to all
654 #define MSG_INIT                3               // write to the init string
655
656 sizebuf_t *VM_M_WriteDest (void)
657 {
658         int             dest;
659         int             destclient;
660
661         if(!sv.active)
662                 PRVM_ERROR("VM_M_WriteDest: game is not server (%s)", PRVM_NAME);
663
664         dest = (int)PRVM_G_FLOAT(OFS_PARM1);
665         switch (dest)
666         {
667         case MSG_BROADCAST:
668                 return &sv.datagram;
669
670         case MSG_ONE:
671                 destclient = (int) PRVM_G_FLOAT(OFS_PARM2);
672                 if (destclient < 0 || destclient >= svs.maxclients || !svs.clients[destclient].active || !svs.clients[destclient].netconnection)
673                         PRVM_ERROR("VM_clientcommand: %s: invalid client !", PRVM_NAME);
674
675                 return &svs.clients[destclient].netconnection->message;
676
677         case MSG_ALL:
678                 return &sv.reliable_datagram;
679
680         case MSG_INIT:
681                 return &sv.signon;
682
683         default:
684                 PRVM_ERROR ("WriteDest: bad destination");
685                 break;
686         }
687
688         return NULL;
689 }
690
691 void VM_M_WriteByte (void)
692 {
693         VM_SAFEPARMCOUNT(1, VM_M_WriteByte);
694         MSG_WriteByte (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
695 }
696
697 void VM_M_WriteChar (void)
698 {
699         VM_SAFEPARMCOUNT(1, VM_M_WriteChar);
700         MSG_WriteChar (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
701 }
702
703 void VM_M_WriteShort (void)
704 {
705         VM_SAFEPARMCOUNT(1, VM_M_WriteShort);
706         MSG_WriteShort (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
707 }
708
709 void VM_M_WriteLong (void)
710 {
711         VM_SAFEPARMCOUNT(1, VM_M_WriteLong);
712         MSG_WriteLong (VM_M_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
713 }
714
715 void VM_M_WriteAngle (void)
716 {
717         VM_SAFEPARMCOUNT(1, VM_M_WriteAngle);
718         MSG_WriteAngle (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
719 }
720
721 void VM_M_WriteCoord (void)
722 {
723         VM_SAFEPARMCOUNT(1, VM_M_WriteCoord);
724         MSG_WriteCoord (VM_M_WriteDest(), PRVM_G_FLOAT(OFS_PARM0), sv.protocol);
725 }
726
727 void VM_M_WriteString (void)
728 {
729         VM_SAFEPARMCOUNT(1, VM_M_WriteString);
730         MSG_WriteString (VM_M_WriteDest(), PRVM_G_STRING(OFS_PARM0));
731 }
732
733 void VM_M_WriteEntity (void)
734 {
735         VM_SAFEPARMCOUNT(1, VM_M_WriteEntity);
736         MSG_WriteShort (VM_M_WriteDest(), PRVM_G_EDICTNUM(OFS_PARM0));
737 }
738
739 //string(void) getextresponse = #624; // returns the next extResponse packet that was sent to this client
740 void VM_M_getextresponse (void)
741 {
742         VM_SAFEPARMCOUNT(0,VM_argv);
743
744         if (net_extresponse_count <= 0)
745                 PRVM_G_INT(OFS_RETURN) = OFS_NULL;
746         else
747         {
748                 int first;
749                 --net_extresponse_count;
750                 first = (net_extresponse_last + NET_EXTRESPONSE_MAX - net_extresponse_count) % NET_EXTRESPONSE_MAX;
751                 PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(net_extresponse[first]);
752         }
753 }
754
755 /*
756 =================
757 VM_M_copyentity
758
759 copies data from one entity to another
760
761 copyentity(entity src, entity dst)
762 =================
763 */
764 static void VM_M_copyentity (void)
765 {
766         prvm_edict_t *in, *out;
767         VM_SAFEPARMCOUNT(2,VM_M_copyentity);
768         in = PRVM_G_EDICT(OFS_PARM0);
769         out = PRVM_G_EDICT(OFS_PARM1);
770         memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
771 }
772
773 prvm_builtin_t vm_m_builtins[] = {
774 NULL,                                           //   #0 NULL function (not callable)
775 VM_checkextension,                      //   #1
776 VM_error,                                       //   #2
777 VM_objerror,                            //   #3
778 VM_print,                                       //   #4
779 VM_bprint,                                      //   #5
780 VM_sprint,                                      //   #6
781 VM_centerprint,                         //   #7
782 VM_normalize,                           //   #8
783 VM_vlen,                                        //   #9
784 VM_vectoyaw,                            //  #10
785 VM_vectoangles,                         //  #11
786 VM_random,                                      //  #12
787 VM_localcmd,                            //  #13
788 VM_cvar,                                        //  #14
789 VM_cvar_set,                            //  #15
790 VM_dprint,                                      //  #16
791 VM_ftos,                                        //  #17
792 VM_fabs,                                        //  #18
793 VM_vtos,                                        //  #19
794 VM_etos,                                        //  #20
795 VM_stof,                                        //  #21
796 VM_spawn,                                       //  #22
797 VM_remove,                                      //  #23
798 VM_find,                                        //  #24
799 VM_findfloat,                           //  #25
800 VM_findchain,                           //  #26
801 VM_findchainfloat,                      //  #27
802 VM_precache_file,                       //  #28
803 VM_precache_sound,                      //  #29
804 VM_coredump,                            //  #30
805 VM_traceon,                                     //  #31
806 VM_traceoff,                            //  #32
807 VM_eprint,                                      //  #33
808 VM_rint,                                        //  #34
809 VM_floor,                                       //  #35
810 VM_ceil,                                        //  #36
811 VM_nextent,                                     //  #37
812 VM_sin,                                         //  #38
813 VM_cos,                                         //  #39
814 VM_sqrt,                                        //  #40
815 VM_randomvec,                           //  #41
816 VM_registercvar,                        //  #42
817 VM_min,                                         //  #43
818 VM_max,                                         //  #44
819 VM_bound,                                       //  #45
820 VM_pow,                                         //  #46
821 VM_M_copyentity,                        //  #47
822 VM_fopen,                                       //  #48
823 VM_fclose,                                      //  #49
824 VM_fgets,                                       //  #50
825 VM_fputs,                                       //  #51
826 VM_strlen,                                      //  #52
827 VM_strcat,                                      //  #53
828 VM_substring,                           //  #54
829 VM_stov,                                        //  #55
830 VM_strzone,                                     //  #56
831 VM_strunzone,                           //  #57
832 VM_tokenize,                            //  #58
833 VM_argv,                                        //  #59
834 VM_isserver,                            //  #60
835 VM_clientcount,                         //  #61
836 VM_clientstate,                         //  #62
837 VM_clcommand,                           //  #63
838 VM_changelevel,                         //  #64
839 VM_localsound,                          //  #65
840 VM_getmousepos,                         //  #66
841 VM_gettime,                                     //  #67
842 VM_loadfromdata,                        //  #68
843 VM_loadfromfile,                        //  #69
844 VM_modulo,                                      //  #70
845 VM_cvar_string,                         //  #71
846 VM_crash,                                       //  #72
847 VM_stackdump,                           //  #73
848 VM_search_begin,                        //  #74
849 VM_search_end,                          //  #75
850 VM_search_getsize,                      //  #76
851 VM_search_getfilename,          //  #77
852 VM_chr,                                         //  #78
853 VM_itof,                                        //  #79
854 VM_ftoe,                                        //  #80
855 VM_itof,                                        //  #81 isString
856 VM_altstr_count,                        //  #82
857 VM_altstr_prepare,                      //  #83
858 VM_altstr_get,                          //  #84
859 VM_altstr_set,                          //  #85
860 VM_altstr_ins,                          //  #86
861 VM_findflags,                           //  #87
862 VM_findchainflags,                      //  #88
863 VM_cvar_defstring,                      //  #89
864 NULL,                                           //  #90
865 NULL,                                           //  #91
866 NULL,                                           //  #92
867 NULL,                                           //  #93
868 NULL,                                           //  #94
869 NULL,                                           //  #95
870 NULL,                                           //  #96
871 NULL,                                           //  #97
872 NULL,                                           //  #98
873 NULL,                                           //  #99
874 NULL,                                           // #100
875 NULL,                                           // #101
876 NULL,                                           // #102
877 NULL,                                           // #103
878 NULL,                                           // #104
879 NULL,                                           // #105
880 NULL,                                           // #106
881 NULL,                                           // #107
882 NULL,                                           // #108
883 NULL,                                           // #109
884 NULL,                                           // #110
885 NULL,                                           // #111
886 NULL,                                           // #112
887 NULL,                                           // #113
888 NULL,                                           // #114
889 NULL,                                           // #115
890 NULL,                                           // #116
891 NULL,                                           // #117
892 NULL,                                           // #118
893 NULL,                                           // #119
894 NULL,                                           // #120
895 NULL,                                           // #121
896 NULL,                                           // #122
897 NULL,                                           // #123
898 NULL,                                           // #124
899 NULL,                                           // #125
900 NULL,                                           // #126
901 NULL,                                           // #127
902 NULL,                                           // #128
903 NULL,                                           // #129
904 NULL,                                           // #130
905 NULL,                                           // #131
906 NULL,                                           // #132
907 NULL,                                           // #133
908 NULL,                                           // #134
909 NULL,                                           // #135
910 NULL,                                           // #136
911 NULL,                                           // #137
912 NULL,                                           // #138
913 NULL,                                           // #139
914 NULL,                                           // #140
915 NULL,                                           // #141
916 NULL,                                           // #142
917 NULL,                                           // #143
918 NULL,                                           // #144
919 NULL,                                           // #145
920 NULL,                                           // #146
921 NULL,                                           // #147
922 NULL,                                           // #148
923 NULL,                                           // #149
924 NULL,                                           // #150
925 NULL,                                           // #151
926 NULL,                                           // #152
927 NULL,                                           // #153
928 NULL,                                           // #154
929 NULL,                                           // #155
930 NULL,                                           // #156
931 NULL,                                           // #157
932 NULL,                                           // #158
933 NULL,                                           // #159
934 NULL,                                           // #160
935 NULL,                                           // #161
936 NULL,                                           // #162
937 NULL,                                           // #163
938 NULL,                                           // #164
939 NULL,                                           // #165
940 NULL,                                           // #166
941 NULL,                                           // #167
942 NULL,                                           // #168
943 NULL,                                           // #169
944 NULL,                                           // #170
945 NULL,                                           // #171
946 NULL,                                           // #172
947 NULL,                                           // #173
948 NULL,                                           // #174
949 NULL,                                           // #175
950 NULL,                                           // #176
951 NULL,                                           // #177
952 NULL,                                           // #178
953 NULL,                                           // #179
954 NULL,                                           // #180
955 NULL,                                           // #181
956 NULL,                                           // #182
957 NULL,                                           // #183
958 NULL,                                           // #184
959 NULL,                                           // #185
960 NULL,                                           // #186
961 NULL,                                           // #187
962 NULL,                                           // #188
963 NULL,                                           // #189
964 NULL,                                           // #190
965 NULL,                                           // #191
966 NULL,                                           // #192
967 NULL,                                           // #193
968 NULL,                                           // #194
969 NULL,                                           // #195
970 NULL,                                           // #196
971 NULL,                                           // #197
972 NULL,                                           // #198
973 NULL,                                           // #199
974 NULL,                                           // #200
975 NULL,                                           // #201
976 NULL,                                           // #202
977 NULL,                                           // #203
978 NULL,                                           // #204
979 NULL,                                           // #205
980 NULL,                                           // #206
981 NULL,                                           // #207
982 NULL,                                           // #208
983 NULL,                                           // #209
984 NULL,                                           // #210
985 NULL,                                           // #211
986 NULL,                                           // #212
987 NULL,                                           // #213
988 NULL,                                           // #214
989 NULL,                                           // #215
990 NULL,                                           // #216
991 NULL,                                           // #217
992 NULL,                                           // #218
993 NULL,                                           // #219
994 NULL,                                           // #220
995 VM_strstrofs,                           // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
996 NULL,                                           // #222
997 NULL,                                           // #223
998 NULL,                                           // #224
999 NULL,                                           // #225
1000 NULL,                                           // #226
1001 NULL,                                           // #227
1002 VM_strncmp,                                     // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
1003 VM_strncasecmp,                         // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
1004 VM_strncasecmp,                         // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
1005 NULL,                                           // #231
1006 NULL,                                           // #232
1007 NULL,                                           // #233
1008 NULL,                                           // #234
1009 NULL,                                           // #235
1010 NULL,                                           // #236
1011 NULL,                                           // #237
1012 NULL,                                           // #238
1013 NULL,                                           // #239
1014 NULL,                                           // #240
1015 NULL,                                           // #241
1016 NULL,                                           // #242
1017 NULL,                                           // #243
1018 NULL,                                           // #244
1019 NULL,                                           // #245
1020 NULL,                                           // #246
1021 NULL,                                           // #247
1022 NULL,                                           // #248
1023 NULL,                                           // #249
1024 NULL,                                           // #250
1025 NULL,                                           // #251
1026 NULL,                                           // #252
1027 NULL,                                           // #253
1028 NULL,                                           // #254
1029 NULL,                                           // #255
1030 NULL,                                           // #256
1031 NULL,                                           // #257
1032 NULL,                                           // #258
1033 NULL,                                           // #259
1034 NULL,                                           // #260
1035 NULL,                                           // #261
1036 NULL,                                           // #262
1037 NULL,                                           // #263
1038 NULL,                                           // #264
1039 NULL,                                           // #265
1040 NULL,                                           // #266
1041 NULL,                                           // #267
1042 NULL,                                           // #268
1043 NULL,                                           // #269
1044 NULL,                                           // #270
1045 NULL,                                           // #271
1046 NULL,                                           // #272
1047 NULL,                                           // #273
1048 NULL,                                           // #274
1049 NULL,                                           // #275
1050 NULL,                                           // #276
1051 NULL,                                           // #277
1052 NULL,                                           // #278
1053 NULL,                                           // #279
1054 NULL,                                           // #280
1055 NULL,                                           // #281
1056 NULL,                                           // #282
1057 NULL,                                           // #283
1058 NULL,                                           // #284
1059 NULL,                                           // #285
1060 NULL,                                           // #286
1061 NULL,                                           // #287
1062 NULL,                                           // #288
1063 NULL,                                           // #289
1064 NULL,                                           // #290
1065 NULL,                                           // #291
1066 NULL,                                           // #292
1067 NULL,                                           // #293
1068 NULL,                                           // #294
1069 NULL,                                           // #295
1070 NULL,                                           // #296
1071 NULL,                                           // #297
1072 NULL,                                           // #298
1073 NULL,                                           // #299
1074 NULL,                                           // #300
1075 NULL,                                           // #301
1076 NULL,                                           // #302
1077 NULL,                                           // #303
1078 NULL,                                           // #304
1079 NULL,                                           // #305
1080 NULL,                                           // #306
1081 NULL,                                           // #307
1082 NULL,                                           // #308
1083 NULL,                                           // #309
1084 NULL,                                           // #310
1085 NULL,                                           // #311
1086 NULL,                                           // #312
1087 NULL,                                           // #313
1088 NULL,                                           // #314
1089 NULL,                                           // #315
1090 NULL,                                           // #316
1091 NULL,                                           // #317
1092 NULL,                                           // #318
1093 NULL,                                           // #319
1094 NULL,                                           // #320
1095 NULL,                                           // #321
1096 NULL,                                           // #322
1097 NULL,                                           // #323
1098 NULL,                                           // #324
1099 NULL,                                           // #325
1100 NULL,                                           // #326
1101 NULL,                                           // #327
1102 NULL,                                           // #328
1103 NULL,                                           // #329
1104 NULL,                                           // #330
1105 NULL,                                           // #331
1106 NULL,                                           // #332
1107 NULL,                                           // #333
1108 NULL,                                           // #334
1109 NULL,                                           // #335
1110 NULL,                                           // #336
1111 NULL,                                           // #337
1112 NULL,                                           // #338
1113 NULL,                                           // #339
1114 NULL,                                           // #340
1115 NULL,                                           // #341
1116 NULL,                                           // #342
1117 NULL,                                           // #343
1118 NULL,                                           // #344
1119 NULL,                                           // #345
1120 NULL,                                           // #346
1121 NULL,                                           // #347
1122 NULL,                                           // #348
1123 NULL,                                           // #349
1124 NULL,                                           // #350
1125 NULL,                                           // #351
1126 NULL,                                           // #352
1127 NULL,                                           // #353
1128 NULL,                                           // #354
1129 NULL,                                           // #355
1130 NULL,                                           // #356
1131 NULL,                                           // #357
1132 NULL,                                           // #358
1133 NULL,                                           // #359
1134 NULL,                                           // #360
1135 NULL,                                           // #361
1136 NULL,                                           // #362
1137 NULL,                                           // #363
1138 NULL,                                           // #364
1139 NULL,                                           // #365
1140 NULL,                                           // #366
1141 NULL,                                           // #367
1142 NULL,                                           // #368
1143 NULL,                                           // #369
1144 NULL,                                           // #370
1145 NULL,                                           // #371
1146 NULL,                                           // #372
1147 NULL,                                           // #373
1148 NULL,                                           // #374
1149 NULL,                                           // #375
1150 NULL,                                           // #376
1151 NULL,                                           // #377
1152 NULL,                                           // #378
1153 NULL,                                           // #379
1154 NULL,                                           // #380
1155 NULL,                                           // #381
1156 NULL,                                           // #382
1157 NULL,                                           // #383
1158 NULL,                                           // #384
1159 NULL,                                           // #385
1160 NULL,                                           // #386
1161 NULL,                                           // #387
1162 NULL,                                           // #388
1163 NULL,                                           // #389
1164 NULL,                                           // #390
1165 NULL,                                           // #391
1166 NULL,                                           // #392
1167 NULL,                                           // #393
1168 NULL,                                           // #394
1169 NULL,                                           // #395
1170 NULL,                                           // #396
1171 NULL,                                           // #397
1172 NULL,                                           // #398
1173 NULL,                                           // #399
1174 NULL,                                           // #400
1175 VM_M_WriteByte,                         // #401
1176 VM_M_WriteChar,                         // #402
1177 VM_M_WriteShort,                        // #403
1178 VM_M_WriteLong,                         // #404
1179 VM_M_WriteAngle,                        // #405
1180 VM_M_WriteCoord,                        // #406
1181 VM_M_WriteString,                       // #407
1182 VM_M_WriteEntity,                       // #408
1183 NULL,                                           // #409
1184 NULL,                                           // #410
1185 NULL,                                           // #411
1186 NULL,                                           // #412
1187 NULL,                                           // #413
1188 NULL,                                           // #414
1189 NULL,                                           // #415
1190 NULL,                                           // #416
1191 NULL,                                           // #417
1192 NULL,                                           // #418
1193 NULL,                                           // #419
1194 NULL,                                           // #420
1195 NULL,                                           // #421
1196 NULL,                                           // #422
1197 NULL,                                           // #423
1198 NULL,                                           // #424
1199 NULL,                                           // #425
1200 NULL,                                           // #426
1201 NULL,                                           // #427
1202 NULL,                                           // #428
1203 NULL,                                           // #429
1204 NULL,                                           // #430
1205 NULL,                                           // #431
1206 NULL,                                           // #432
1207 NULL,                                           // #433
1208 NULL,                                           // #434
1209 NULL,                                           // #435
1210 NULL,                                           // #436
1211 NULL,                                           // #437
1212 NULL,                                           // #438
1213 NULL,                                           // #439
1214 NULL,                                           // #440
1215 NULL,                                           // #441
1216 NULL,                                           // #442
1217 NULL,                                           // #443
1218 NULL,                                           // #444
1219 NULL,                                           // #445
1220 NULL,                                           // #446
1221 NULL,                                           // #447
1222 NULL,                                           // #448
1223 NULL,                                           // #449
1224 NULL,                                           // #450
1225 VM_iscachedpic,                         // #451 draw functions...
1226 VM_precache_pic,                        // #452
1227 VM_freepic,                                     // #453
1228 VM_drawcharacter,                       // #454
1229 VM_drawstring,                          // #455
1230 VM_drawpic,                                     // #456
1231 VM_drawfill,                            // #457
1232 VM_drawsetcliparea,                     // #458
1233 VM_drawresetcliparea,           // #459
1234 VM_getimagesize,                        // #460
1235 VM_cin_open,                            // #461
1236 VM_cin_close,                           // #462
1237 VM_cin_setstate,                        // #463
1238 VM_cin_getstate,                        // #464
1239 VM_cin_restart,                         // #465
1240 VM_drawline,                            // #466
1241 VM_drawcolorcodedstring,        // #467
1242 VM_stringwidth,                         // #468
1243 VM_drawsubpic,                  // #469
1244 NULL,                                           // #470
1245 VM_asin,                                        // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
1246 VM_acos,                                        // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
1247 VM_atan,                                        // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
1248 VM_atan2,                                       // #474 float(float c, float s) VM_atan2 (DP_QC_ASINACOSATANATAN2TAN)
1249 VM_tan,                                         // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
1250 VM_strlennocol,                         // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
1251 VM_strdecolorize,                       // #477 string(string s) : DRESK - Decolorized String (DP_QC_STRINGCOLORFUNCTIONS)
1252 VM_strftime,                            // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME)
1253 VM_tokenizebyseparator,         // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR)
1254 VM_strtolower,                          // #480 string(string s) VM_strtolower : DRESK - Return string as lowercase
1255 VM_strtoupper,                          // #481 string(string s) VM_strtoupper : DRESK - Return string as uppercase
1256 NULL,                                           // #482
1257 NULL,                                           // #483
1258 VM_strreplace,                          // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
1259 VM_strireplace,                         // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
1260 NULL,                                           // #486
1261 NULL,                                           // #487
1262 NULL,                                           // #488
1263 NULL,                                           // #489
1264 NULL,                                           // #490
1265 NULL,                                           // #491
1266 NULL,                                           // #492
1267 NULL,                                           // #493
1268 NULL,                                           // #494
1269 NULL,                                           // #495
1270 NULL,                                           // #496
1271 NULL,                                           // #497
1272 NULL,                                           // #498
1273 NULL,                                           // #499
1274 NULL,                                           // #500
1275 NULL,                                           // #501
1276 NULL,                                           // #502
1277 NULL,                                           // #503
1278 NULL,                                           // #504
1279 NULL,                                           // #505
1280 NULL,                                           // #506
1281 NULL,                                           // #507
1282 NULL,                                           // #508
1283 NULL,                                           // #509
1284 NULL,                                           // #510
1285 NULL,                                           // #511
1286 NULL,                                           // #512
1287 NULL,                                           // #513
1288 NULL,                                           // #514
1289 NULL,                                           // #515
1290 NULL,                                           // #516
1291 NULL,                                           // #517
1292 NULL,                                           // #518
1293 NULL,                                           // #519
1294 NULL,                                           // #520
1295 NULL,                                           // #521
1296 NULL,                                           // #522
1297 NULL,                                           // #523
1298 NULL,                                           // #524
1299 NULL,                                           // #525
1300 NULL,                                           // #526
1301 NULL,                                           // #527
1302 NULL,                                           // #528
1303 NULL,                                           // #529
1304 NULL,                                           // #530
1305 NULL,                                           // #531
1306 NULL,                                           // #532
1307 NULL,                                           // #533
1308 NULL,                                           // #534
1309 NULL,                                           // #535
1310 NULL,                                           // #536
1311 NULL,                                           // #537
1312 NULL,                                           // #538
1313 NULL,                                           // #539
1314 NULL,                                           // #540
1315 NULL,                                           // #541
1316 NULL,                                           // #542
1317 NULL,                                           // #543
1318 NULL,                                           // #544
1319 NULL,                                           // #545
1320 NULL,                                           // #546
1321 NULL,                                           // #547
1322 NULL,                                           // #548
1323 NULL,                                           // #549
1324 NULL,                                           // #550
1325 NULL,                                           // #551
1326 NULL,                                           // #552
1327 NULL,                                           // #553
1328 NULL,                                           // #554
1329 NULL,                                           // #555
1330 NULL,                                           // #556
1331 NULL,                                           // #557
1332 NULL,                                           // #558
1333 NULL,                                           // #559
1334 NULL,                                           // #560
1335 NULL,                                           // #561
1336 NULL,                                           // #562
1337 NULL,                                           // #563
1338 NULL,                                           // #564
1339 NULL,                                           // #565
1340 NULL,                                           // #566
1341 NULL,                                           // #567
1342 NULL,                                           // #568
1343 NULL,                                           // #569
1344 NULL,                                           // #570
1345 NULL,                                           // #571
1346 NULL,                                           // #572
1347 NULL,                                           // #573
1348 NULL,                                           // #574
1349 NULL,                                           // #575
1350 NULL,                                           // #576
1351 NULL,                                           // #577
1352 NULL,                                           // #578
1353 NULL,                                           // #579
1354 NULL,                                           // #580
1355 NULL,                                           // #581
1356 NULL,                                           // #582
1357 NULL,                                           // #583
1358 NULL,                                           // #584
1359 NULL,                                           // #585
1360 NULL,                                           // #586
1361 NULL,                                           // #587
1362 NULL,                                           // #588
1363 NULL,                                           // #589
1364 NULL,                                           // #590
1365 NULL,                                           // #591
1366 NULL,                                           // #592
1367 NULL,                                           // #593
1368 NULL,                                           // #594
1369 NULL,                                           // #595
1370 NULL,                                           // #596
1371 NULL,                                           // #597
1372 NULL,                                           // #598
1373 NULL,                                           // #599
1374 NULL,                                           // #600
1375 VM_M_setkeydest,                        // #601 menu functions...
1376 VM_M_getkeydest,                        // #602
1377 VM_M_setmousetarget,            // #603
1378 VM_M_getmousetarget,            // #604
1379 VM_M_callfunction,                      // #605
1380 VM_writetofile,                         // #606
1381 VM_M_isfunction,                        // #607
1382 VM_M_getresolution,                     // #608
1383 VM_keynumtostring,                      // #609
1384 VM_M_findkeysforcommand,        // #610
1385 VM_M_getserverliststat,         // #611
1386 VM_M_getserverliststring,       // #612
1387 VM_parseentitydata,                     // #613
1388 VM_stringtokeynum,                      // #614
1389 VM_M_resetserverlistmasks,      // #615
1390 VM_M_setserverlistmaskstring,// #616
1391 VM_M_setserverlistmasknumber,// #617
1392 VM_M_resortserverlist,          // #618
1393 VM_M_setserverlistsort,         // #619
1394 VM_M_refreshserverlist,         // #620
1395 VM_M_getserverlistnumber,       // #621
1396 VM_M_getserverlistindexforkey,// #622
1397 VM_M_addwantedserverlistkey,// #623
1398 VM_M_getextresponse                     // #624
1399 };
1400
1401 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
1402
1403 void VM_M_Cmd_Init(void)
1404 {
1405         VM_Cmd_Init();
1406 }
1407
1408 void VM_M_Cmd_Reset(void)
1409 {
1410         //VM_Cmd_Init();
1411         VM_Cmd_Reset();
1412 }