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