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