]> icculus.org git repositories - divverent/darkplaces.git/blob - host_cmd.c
7510ee753673dbbc5974a34e645ed826c1c6ecd5
[divverent/darkplaces.git] / host_cmd.c
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 #include "quakedef.h"
22
23 extern cvar_t   pausable;
24
25 int     current_skill;
26
27 void Mod_Print (void);
28
29 dfunction_t *ED_FindFunction (char *name);
30
31 /*
32 ==================
33 Host_Quit_f
34 ==================
35 */
36
37 // LordHavoc: didn't like it asking me if I wanted to quit
38 //extern void M_Menu_Quit_f (void);
39
40 void Host_Quit_f (void)
41 {
42         /*
43         if (key_dest != key_console && cls.state != ca_dedicated)
44         {
45                 M_Menu_Quit_f ();
46                 return;
47         }
48         */
49         CL_Disconnect ();
50         Host_ShutdownServer(false);             
51
52         Sys_Quit ();
53 }
54
55
56 /*
57 ==================
58 Host_Status_f
59 ==================
60 */
61 void Host_Status_f (void)
62 {
63         client_t        *client;
64         int                     seconds;
65         int                     minutes;
66         int                     hours = 0;
67         int                     j;
68         void            (*print) (char *fmt, ...);
69         
70         if (cmd_source == src_command)
71         {
72                 if (!sv.active)
73                 {
74                         Cmd_ForwardToServer ();
75                         return;
76                 }
77                 print = Con_Printf;
78         }
79         else
80                 print = SV_ClientPrintf;
81
82         print ("host:    %s\n", Cvar_VariableString ("hostname"));
83         print ("version: %4.2f (build %i)\n", VERSION, buildnumber);
84         if (tcpipAvailable)
85                 print ("tcp/ip:  %s\n", my_tcpip_address);
86         if (ipxAvailable)
87                 print ("ipx:     %s\n", my_ipx_address);
88         print ("map:     %s\n", sv.name);
89         print ("players: %i active (%i max)\n\n", net_activeconnections, svs.maxclients);
90         for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
91         {
92                 if (!client->active)
93                         continue;
94                 seconds = (int)(net_time - client->netconnection->connecttime);
95                 minutes = seconds / 60;
96                 if (minutes)
97                 {
98                         seconds -= (minutes * 60);
99                         hours = minutes / 60;
100                         if (hours)
101                                 minutes -= (hours * 60);
102                 }
103                 else
104                         hours = 0;
105                 print ("#%-2u %-16.16s  %3i  %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds);
106                 print ("   %s\n", client->netconnection->address);
107         }
108 }
109
110
111 /*
112 ==================
113 Host_God_f
114
115 Sets client to godmode
116 ==================
117 */
118 void Host_God_f (void)
119 {
120         if (cmd_source == src_command)
121         {
122                 Cmd_ForwardToServer ();
123                 return;
124         }
125
126         if (pr_global_struct->deathmatch)
127                 return;
128
129         sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE;
130         if (!((int)sv_player->v.flags & FL_GODMODE) )
131                 SV_ClientPrintf ("godmode OFF\n");
132         else
133                 SV_ClientPrintf ("godmode ON\n");
134 }
135
136 void Host_Notarget_f (void)
137 {
138         if (cmd_source == src_command)
139         {
140                 Cmd_ForwardToServer ();
141                 return;
142         }
143
144         if (pr_global_struct->deathmatch)
145                 return;
146
147         sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET;
148         if (!((int)sv_player->v.flags & FL_NOTARGET) )
149                 SV_ClientPrintf ("notarget OFF\n");
150         else
151                 SV_ClientPrintf ("notarget ON\n");
152 }
153
154 qboolean noclip_anglehack;
155
156 void Host_Noclip_f (void)
157 {
158         if (cmd_source == src_command)
159         {
160                 Cmd_ForwardToServer ();
161                 return;
162         }
163
164         if (pr_global_struct->deathmatch)
165                 return;
166
167         if (sv_player->v.movetype != MOVETYPE_NOCLIP)
168         {
169                 noclip_anglehack = true;
170                 sv_player->v.movetype = MOVETYPE_NOCLIP;
171                 SV_ClientPrintf ("noclip ON\n");
172         }
173         else
174         {
175                 noclip_anglehack = false;
176                 sv_player->v.movetype = MOVETYPE_WALK;
177                 SV_ClientPrintf ("noclip OFF\n");
178         }
179 }
180
181 /*
182 ==================
183 Host_Fly_f
184
185 Sets client to flymode
186 ==================
187 */
188 void Host_Fly_f (void)
189 {
190         if (cmd_source == src_command)
191         {
192                 Cmd_ForwardToServer ();
193                 return;
194         }
195
196         if (pr_global_struct->deathmatch)
197                 return;
198
199         if (sv_player->v.movetype != MOVETYPE_FLY)
200         {
201                 sv_player->v.movetype = MOVETYPE_FLY;
202                 SV_ClientPrintf ("flymode ON\n");
203         }
204         else
205         {
206                 sv_player->v.movetype = MOVETYPE_WALK;
207                 SV_ClientPrintf ("flymode OFF\n");
208         }
209 }
210
211
212 /*
213 ==================
214 Host_Ping_f
215
216 ==================
217 */
218 void Host_Ping_f (void)
219 {
220         int             i, j;
221         float   total;
222         client_t        *client;
223         
224         if (cmd_source == src_command)
225         {
226                 Cmd_ForwardToServer ();
227                 return;
228         }
229
230         SV_ClientPrintf ("Client ping times:\n");
231         for (i=0, client = svs.clients ; i<svs.maxclients ; i++, client++)
232         {
233                 if (!client->active)
234                         continue;
235                 total = 0;
236                 for (j=0 ; j<NUM_PING_TIMES ; j++)
237                         total+=client->ping_times[j];
238                 total /= NUM_PING_TIMES;
239                 SV_ClientPrintf ("%4i %s\n", (int)(total*1000), client->name);
240         }
241 }
242
243 /*
244 ===============================================================================
245
246 SERVER TRANSITIONS
247
248 ===============================================================================
249 */
250
251
252 /*
253 ======================
254 Host_Map_f
255
256 handle a 
257 map <servername>
258 command from the console.  Active clients are kicked off.
259 ======================
260 */
261 void Host_Map_f (void)
262 {
263         int             i;
264         char    name[MAX_QPATH];
265
266         if (cmd_source != src_command)
267                 return;
268
269         cls.demonum = -1;               // stop demo loop in case this fails
270
271 //      SCR_BeginLoadingPlaque ();
272
273         CL_Disconnect ();
274         Host_ShutdownServer(false);             
275
276         key_dest = key_game;                    // remove console or menu
277
278         cls.mapstring[0] = 0;
279         for (i=0 ; i<Cmd_Argc() ; i++)
280         {
281                 strcat (cls.mapstring, Cmd_Argv(i));
282                 strcat (cls.mapstring, " ");
283         }
284         strcat (cls.mapstring, "\n");
285
286         svs.serverflags = 0;                    // haven't completed an episode yet
287         strcpy (name, Cmd_Argv(1));
288         SV_SpawnServer (name);
289         if (!sv.active)
290                 return;
291         
292         if (cls.state != ca_dedicated)
293         {
294                 strcpy (cls.spawnparms, "");
295
296                 for (i=2 ; i<Cmd_Argc() ; i++)
297                 {
298                         strcat (cls.spawnparms, Cmd_Argv(i));
299                         strcat (cls.spawnparms, " ");
300                 }
301                 
302                 Cmd_ExecuteString ("connect local", src_command);
303         }       
304 }
305
306 /*
307 ==================
308 Host_Changelevel_f
309
310 Goes to a new map, taking all clients along
311 ==================
312 */
313 void Host_Changelevel_f (void)
314 {
315         char    level[MAX_QPATH];
316
317         if (Cmd_Argc() != 2)
318         {
319                 Con_Printf ("changelevel <levelname> : continue game on a new level\n");
320                 return;
321         }
322         if (!sv.active || cls.demoplayback)
323         {
324                 Con_Printf ("Only the server may changelevel\n");
325                 return;
326         }
327         SV_SaveSpawnparms ();
328         strcpy (level, Cmd_Argv(1));
329         SV_SpawnServer (level);
330 }
331
332 /*
333 ==================
334 Host_Restart_f
335
336 Restarts the current server for a dead player
337 ==================
338 */
339 void Host_Restart_f (void)
340 {
341         char    mapname[MAX_QPATH];
342
343         if (cls.demoplayback || !sv.active)
344                 return;
345
346         if (cmd_source != src_command)
347                 return;
348         strcpy (mapname, sv.name);      // must copy out, because it gets cleared
349                                                                 // in sv_spawnserver
350         SV_SpawnServer (mapname);
351 }
352
353 /*
354 ==================
355 Host_Reconnect_f
356
357 This command causes the client to wait for the signon messages again.
358 This is sent just before a server changes levels
359 ==================
360 */
361 void Host_Reconnect_f (void)
362 {
363 //      SCR_BeginLoadingPlaque ();
364         cls.signon = 0;         // need new connection messages
365 }
366
367 /*
368 =====================
369 Host_Connect_f
370
371 User command to connect to server
372 =====================
373 */
374 void Host_Connect_f (void)
375 {
376         char    name[MAX_QPATH];
377         
378         cls.demonum = -1;               // stop demo loop in case this fails
379         if (cls.demoplayback)
380         {
381                 CL_StopPlayback ();
382                 CL_Disconnect ();
383         }
384         strcpy (name, Cmd_Argv(1));
385         CL_EstablishConnection (name);
386         Host_Reconnect_f ();
387 }
388
389
390 /*
391 ===============================================================================
392
393 LOAD / SAVE GAME
394
395 ===============================================================================
396 */
397
398 #define SAVEGAME_VERSION        5
399
400 /*
401 ===============
402 Host_SavegameComment
403
404 Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current 
405 ===============
406 */
407 void Host_SavegameComment (char *text)
408 {
409         int             i;
410         char    kills[20];
411
412         for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
413                 text[i] = ' ';
414         memcpy (text, cl.levelname, strlen(cl.levelname));
415         sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
416         memcpy (text+22, kills, strlen(kills));
417 // convert space to _ to make stdio happy
418         for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
419                 if (text[i] == ' ')
420                         text[i] = '_';
421         text[SAVEGAME_COMMENT_LENGTH] = '\0';
422 }
423
424
425 /*
426 ===============
427 Host_Savegame_f
428 ===============
429 */
430 void Host_Savegame_f (void)
431 {
432         char    name[256];
433         FILE    *f;
434         int             i;
435         char    comment[SAVEGAME_COMMENT_LENGTH+1];
436
437         if (cmd_source != src_command)
438                 return;
439
440         if (!sv.active)
441         {
442                 Con_Printf ("Not playing a local game.\n");
443                 return;
444         }
445
446         if (cl.intermission)
447         {
448                 Con_Printf ("Can't save in intermission.\n");
449                 return;
450         }
451
452         if (svs.maxclients != 1)
453         {
454                 Con_Printf ("Can't save multiplayer games.\n");
455                 return;
456         }
457
458         if (Cmd_Argc() != 2)
459         {
460                 Con_Printf ("save <savename> : save a game\n");
461                 return;
462         }
463
464         if (strstr(Cmd_Argv(1), ".."))
465         {
466                 Con_Printf ("Relative pathnames are not allowed.\n");
467                 return;
468         }
469                 
470         for (i=0 ; i<svs.maxclients ; i++)
471         {
472                 if (svs.clients[i].active && (svs.clients[i].edict->v.health <= 0) )
473                 {
474                         Con_Printf ("Can't savegame with a dead player\n");
475                         return;
476                 }
477         }
478
479         sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
480         COM_DefaultExtension (name, ".sav");
481         
482         Con_Printf ("Saving game to %s...\n", name);
483         f = fopen (name, "w");
484         if (!f)
485         {
486                 Con_Printf ("ERROR: couldn't open.\n");
487                 return;
488         }
489         
490         fprintf (f, "%i\n", SAVEGAME_VERSION);
491         Host_SavegameComment (comment);
492         fprintf (f, "%s\n", comment);
493         for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
494                 fprintf (f, "%f\n", svs.clients->spawn_parms[i]);
495         fprintf (f, "%d\n", current_skill);
496         fprintf (f, "%s\n", sv.name);
497         fprintf (f, "%f\n",sv.time);
498
499 // write the light styles
500
501         for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
502         {
503                 if (sv.lightstyles[i])
504                         fprintf (f, "%s\n", sv.lightstyles[i]);
505                 else
506                         fprintf (f,"m\n");
507         }
508
509
510         ED_WriteGlobals (f);
511         for (i=0 ; i<sv.num_edicts ; i++)
512         {
513                 ED_Write (f, EDICT_NUM(i));
514                 fflush (f);
515         }
516         fclose (f);
517         Con_Printf ("done.\n");
518 }
519
520
521 /*
522 ===============
523 Host_Loadgame_f
524 ===============
525 */
526 void Host_Loadgame_f (void)
527 {
528         char    name[MAX_OSPATH];
529         FILE    *f;
530         char    mapname[MAX_QPATH];
531         float   time, tfloat;
532         char    str[32768], *start;
533         int             i, r;
534         edict_t *ent;
535         int             entnum;
536         int             version;
537         float                   spawn_parms[NUM_SPAWN_PARMS];
538
539         if (cmd_source != src_command)
540                 return;
541
542         if (Cmd_Argc() != 2)
543         {
544                 Con_Printf ("load <savename> : load a game\n");
545                 return;
546         }
547
548         cls.demonum = -1;               // stop demo loop in case this fails
549
550         sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
551         COM_DefaultExtension (name, ".sav");
552
553         // LordHavoc: made SCR_UpdateScreen use a great deal less stack space, no longer an issue
554         //// we can't call SCR_BeginLoadingPlaque, because too much stack space has
555         //// been used.  The menu calls it before stuffing loadgame command
556 //      SCR_BeginLoadingPlaque ();
557
558         Con_Printf ("Loading game from %s...\n", name);
559         f = fopen (name, "r");
560         if (!f)
561         {
562                 Con_Printf ("ERROR: couldn't open.\n");
563                 return;
564         }
565
566         fscanf (f, "%i\n", &version);
567         if (version != SAVEGAME_VERSION)
568         {
569                 fclose (f);
570                 Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
571                 return;
572         }
573         fscanf (f, "%s\n", str);
574         for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
575                 fscanf (f, "%f\n", &spawn_parms[i]);
576 // this silliness is so we can load 1.06 save files, which have float skill values
577         fscanf (f, "%f\n", &tfloat);
578         current_skill = (int)(tfloat + 0.1);
579         Cvar_SetValue ("skill", (float)current_skill);
580
581         fscanf (f, "%s\n",mapname);
582         fscanf (f, "%f\n",&time);
583
584         CL_Disconnect_f ();
585         
586         SV_SpawnServer (mapname);
587         if (!sv.active)
588         {
589                 Con_Printf ("Couldn't load map\n");
590                 return;
591         }
592         sv.paused = true;               // pause until all clients connect
593         sv.loadgame = true;
594
595 // load the light styles
596
597         for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
598         {
599                 fscanf (f, "%s\n", str);
600                 sv.lightstyles[i] = Hunk_AllocName (strlen(str)+1, "lightstyles");
601                 strcpy (sv.lightstyles[i], str);
602         }
603
604 // load the edicts out of the savegame file
605         entnum = -1;            // -1 is the globals
606         while (!feof(f))
607         {
608                 for (i=0 ; i<sizeof(str)-1 ; i++)
609                 {
610                         r = fgetc (f);
611                         if (r == EOF || !r)
612                                 break;
613                         str[i] = r;
614                         if (r == '}')
615                         {
616                                 i++;
617                                 break;
618                         }
619                 }
620                 if (i == sizeof(str)-1)
621                         Sys_Error ("Loadgame buffer overflow");
622                 str[i] = 0;
623                 start = str;
624                 start = COM_Parse(str);
625                 if (!com_token[0])
626                         break;          // end of file
627                 if (strcmp(com_token,"{"))
628                         Sys_Error ("First token isn't a brace");
629                         
630                 if (entnum == -1)
631                 {       // parse the global vars
632                         ED_ParseGlobals (start);
633                 }
634                 else
635                 {       // parse an edict
636
637                         ent = EDICT_NUM(entnum);
638                         memset (&ent->v, 0, progs->entityfields * 4);
639                         ent->free = false;
640                         ED_ParseEdict (start, ent);
641         
642                 // link it into the bsp tree
643                         if (!ent->free)
644                                 SV_LinkEdict (ent, false);
645                 }
646
647                 entnum++;
648         }
649         
650         sv.num_edicts = entnum;
651         sv.time = time;
652
653         fclose (f);
654
655         for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
656                 svs.clients->spawn_parms[i] = spawn_parms[i];
657
658         if (cls.state != ca_dedicated)
659         {
660                 CL_EstablishConnection ("local");
661                 Host_Reconnect_f ();
662         }
663 }
664
665 //============================================================================
666
667 /*
668 ======================
669 Host_Name_f
670 ======================
671 */
672 void Host_Name_f (void)
673 {
674         char    *newName;
675
676         if (Cmd_Argc () == 1)
677         {
678                 Con_Printf ("\"name\" is \"%s\"\n", cl_name.string);
679                 return;
680         }
681         if (Cmd_Argc () == 2)
682                 newName = Cmd_Argv(1);  
683         else
684                 newName = Cmd_Args();
685         newName[15] = 0;
686
687         if (cmd_source == src_command)
688         {
689                 if (strcmp(cl_name.string, newName) == 0)
690                         return;
691                 Cvar_Set ("_cl_name", newName);
692                 if (cls.state == ca_connected)
693                         Cmd_ForwardToServer ();
694                 return;
695         }
696
697         if (host_client->name[0] && strcmp(host_client->name, "unconnected") )
698                 if (strcmp(host_client->name, newName) != 0)
699                         Con_Printf ("%s renamed to %s\n", host_client->name, newName);
700         strcpy (host_client->name, newName);
701         host_client->edict->v.netname = host_client->name - pr_strings;
702         
703 // send notification to all clients
704         
705         MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
706         MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
707         MSG_WriteString (&sv.reliable_datagram, host_client->name);
708 }
709
710         
711 void Host_Version_f (void)
712 {
713         Con_Printf ("Version %4.2f (build %i)\n", VERSION, buildnumber);
714         Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
715 }
716
717 void Host_Say(qboolean teamonly)
718 {
719         client_t *client;
720         client_t *save;
721         int             j;
722         char    *p;
723         // LordHavoc: 256 char say messages
724         unsigned char   text[256];
725         qboolean        fromServer = false;
726
727         if (cmd_source == src_command)
728         {
729                 if (cls.state == ca_dedicated)
730                 {
731                         fromServer = true;
732                         teamonly = false;
733                 }
734                 else
735                 {
736                         Cmd_ForwardToServer ();
737                         return;
738                 }
739         }
740
741         if (Cmd_Argc () < 2)
742                 return;
743
744         save = host_client;
745
746         p = Cmd_Args();
747 // remove quotes if present
748         if (*p == '"')
749         {
750                 p++;
751                 p[strlen(p)-1] = 0;
752         }
753
754 // turn on color set 1
755         if (!fromServer)
756                 sprintf (text, "%c%s: ", 1, save->name);
757         else
758                 sprintf (text, "%c<%s> ", 1, hostname.string);
759
760         j = sizeof(text) - 2 - strlen(text);  // -2 for /n and null terminator
761         if (strlen(p) > j)
762                 p[j] = 0;
763
764         strcat (text, p);
765         strcat (text, "\n");
766
767         for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
768         {
769                 if (!client || !client->active || !client->spawned)
770                         continue;
771                 if (teamplay.value && teamonly && client->edict->v.team != save->edict->v.team)
772                         continue;
773                 host_client = client;
774                 SV_ClientPrintf("%s", text);
775         }
776         host_client = save;
777
778         Sys_Printf("%s", &text[1]);
779 }
780
781
782 void Host_Say_f(void)
783 {
784         Host_Say(false);
785 }
786
787
788 void Host_Say_Team_f(void)
789 {
790         Host_Say(true);
791 }
792
793
794 void Host_Tell_f(void)
795 {
796         client_t *client;
797         client_t *save;
798         int             j;
799         char    *p;
800         char    text[1024]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
801
802         if (cmd_source == src_command)
803         {
804                 Cmd_ForwardToServer ();
805                 return;
806         }
807
808         if (Cmd_Argc () < 3)
809                 return;
810
811         strcpy(text, host_client->name);
812         strcat(text, ": ");
813
814         p = Cmd_Args();
815
816 // remove quotes if present
817         if (*p == '"')
818         {
819                 p++;
820                 p[strlen(p)-1] = 0;
821         }
822
823 // check length & truncate if necessary
824         j = sizeof(text) - 2 - strlen(text);  // -2 for /n and null terminator
825         if (strlen(p) > j)
826                 p[j] = 0;
827
828         strcat (text, p);
829         strcat (text, "\n");
830
831         save = host_client;
832         for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
833         {
834                 if (!client->active || !client->spawned)
835                         continue;
836                 if (Q_strcasecmp(client->name, Cmd_Argv(1)))
837                         continue;
838                 host_client = client;
839                 SV_ClientPrintf("%s", text);
840                 break;
841         }
842         host_client = save;
843 }
844
845
846 /*
847 ==================
848 Host_Color_f
849 ==================
850 */
851 void Host_Color_f(void)
852 {
853         int             top, bottom;
854         int             playercolor;
855         dfunction_t *f;
856         func_t  SV_ChangeTeam;
857         
858         if (Cmd_Argc() == 1)
859         {
860                 Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
861                 Con_Printf ("color <0-13> [0-13]\n");
862                 return;
863         }
864
865         if (Cmd_Argc() == 2)
866                 top = bottom = atoi(Cmd_Argv(1));
867         else
868         {
869                 top = atoi(Cmd_Argv(1));
870                 bottom = atoi(Cmd_Argv(2));
871         }
872         
873         top &= 15;
874         // LordHavoc: allow skin colormaps 14 and 15 (was 13)
875         if (top > 15)
876                 top = 15;
877         bottom &= 15;
878         // LordHavoc: allow skin colormaps 14 and 15 (was 13)
879         if (bottom > 15)
880                 bottom = 15;
881         
882         playercolor = top*16 + bottom;
883
884         if (cmd_source == src_command)
885         {
886                 Cvar_SetValue ("_cl_color", playercolor);
887                 if (cls.state == ca_connected)
888                         Cmd_ForwardToServer ();
889                 return;
890         }
891
892         // void(float color) SV_ChangeTeam;
893         if ((f = ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - pr_functions)))
894         {
895                 Con_DPrintf("Calling SV_ChangeTeam\n");
896                 pr_global_struct->time = sv.time;
897                 pr_globals[0] = playercolor;
898                 pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
899                 PR_ExecuteProgram (SV_ChangeTeam, "");
900         }
901         else
902         {
903                 host_client->colors = playercolor;
904                 host_client->edict->v.team = bottom + 1;
905
906                 // send notification to all clients
907                 MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
908                 MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
909                 MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
910         }
911 }
912
913 /*
914 ==================
915 Host_Kill_f
916 ==================
917 */
918 void Host_Kill_f (void)
919 {
920         if (cmd_source == src_command)
921         {
922                 Cmd_ForwardToServer ();
923                 return;
924         }
925
926         if (sv_player->v.health <= 0)
927         {
928                 SV_ClientPrintf ("Can't suicide -- already dead!\n");
929                 return;
930         }
931         
932         pr_global_struct->time = sv.time;
933         pr_global_struct->self = EDICT_TO_PROG(sv_player);
934         PR_ExecuteProgram (pr_global_struct->ClientKill, "QC function ClientKill is missing");
935 }
936
937
938 /*
939 ==================
940 Host_Pause_f
941 ==================
942 */
943 void Host_Pause_f (void)
944 {
945         
946         if (cmd_source == src_command)
947         {
948                 Cmd_ForwardToServer ();
949                 return;
950         }
951         if (!pausable.value)
952                 SV_ClientPrintf ("Pause not allowed.\n");
953         else
954         {
955                 sv.paused ^= 1;
956
957                 if (sv.paused)
958                 {
959                         SV_BroadcastPrintf ("%s paused the game\n", pr_strings + sv_player->v.netname);
960                 }
961                 else
962                 {
963                         SV_BroadcastPrintf ("%s unpaused the game\n",pr_strings + sv_player->v.netname);
964                 }
965
966         // send notification to all clients
967                 MSG_WriteByte (&sv.reliable_datagram, svc_setpause);
968                 MSG_WriteByte (&sv.reliable_datagram, sv.paused);
969         }
970 }
971
972 //===========================================================================
973
974
975 /*
976 ==================
977 Host_PreSpawn_f
978 ==================
979 */
980 void Host_PreSpawn_f (void)
981 {
982         if (cmd_source == src_command)
983         {
984                 Con_Printf ("prespawn is not valid from the console\n");
985                 return;
986         }
987
988         if (host_client->spawned)
989         {
990                 Con_Printf ("prespawn not valid -- already spawned\n");
991                 return;
992         }
993         
994         SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize);
995         MSG_WriteByte (&host_client->message, svc_signonnum);
996         MSG_WriteByte (&host_client->message, 2);
997         host_client->sendsignon = true;
998 }
999
1000 /*
1001 ==================
1002 Host_Spawn_f
1003 ==================
1004 */
1005 void Host_Spawn_f (void)
1006 {
1007         int             i;
1008         client_t        *client;
1009         edict_t *ent;
1010         func_t RestoreGame;
1011         dfunction_t *f;
1012
1013         if (cmd_source == src_command)
1014         {
1015                 Con_Printf ("spawn is not valid from the console\n");
1016                 return;
1017         }
1018
1019         if (host_client->spawned)
1020         {
1021                 Con_Printf ("Spawn not valid -- already spawned\n");
1022                 return;
1023         }
1024
1025         // LordHavoc: moved this above the QC calls at FrikaC's request
1026 // send all current names, colors, and frag counts
1027         SZ_Clear (&host_client->message);
1028
1029 // run the entrance script
1030         if (sv.loadgame)
1031         {       // loaded games are fully inited already
1032                 // if this is the last client to be connected, unpause
1033                 sv.paused = false;
1034
1035                 if ((f = ED_FindFunction ("RestoreGame")))
1036                 if ((RestoreGame = (func_t)(f - pr_functions)))
1037                 {
1038                         Con_DPrintf("Calling RestoreGame\n");
1039                         pr_global_struct->time = sv.time;
1040                         pr_global_struct->self = EDICT_TO_PROG(sv_player);
1041                         PR_ExecuteProgram (RestoreGame, "");
1042                 }
1043         }
1044         else
1045         {
1046                 eval_t *val;
1047                 // set up the edict
1048                 ent = host_client->edict;
1049
1050                 memset (&ent->v, 0, progs->entityfields * 4);
1051                 ent->v.colormap = NUM_FOR_EDICT(ent);
1052                 ent->v.team = (host_client->colors & 15) + 1;
1053                 ent->v.netname = host_client->name - pr_strings;
1054                 if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
1055                         val->_float = host_client->pmodel;
1056
1057                 // copy spawn parms out of the client_t
1058
1059                 for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
1060                         (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
1061
1062                 // call the spawn function
1063
1064                 pr_global_struct->time = sv.time;
1065                 pr_global_struct->self = EDICT_TO_PROG(sv_player);
1066                 PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing");
1067
1068                 if ((Sys_FloatTime() - host_client->netconnection->connecttime) <= sv.time)
1069                         Sys_Printf ("%s entered the game\n", host_client->name);
1070
1071                 PR_ExecuteProgram (pr_global_struct->PutClientInServer, "QC function PutClientInServer is missing");
1072         }
1073
1074
1075 // send time of update
1076         MSG_WriteByte (&host_client->message, svc_time);
1077         MSG_WriteFloat (&host_client->message, sv.time);
1078
1079         for (i=0, client = svs.clients ; i<svs.maxclients ; i++, client++)
1080         {
1081                 MSG_WriteByte (&host_client->message, svc_updatename);
1082                 MSG_WriteByte (&host_client->message, i);
1083                 MSG_WriteString (&host_client->message, client->name);
1084                 MSG_WriteByte (&host_client->message, svc_updatefrags);
1085                 MSG_WriteByte (&host_client->message, i);
1086                 MSG_WriteShort (&host_client->message, client->old_frags);
1087                 MSG_WriteByte (&host_client->message, svc_updatecolors);
1088                 MSG_WriteByte (&host_client->message, i);
1089                 MSG_WriteByte (&host_client->message, client->colors);
1090         }
1091         
1092 // send all current light styles
1093         for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
1094         {
1095                 MSG_WriteByte (&host_client->message, svc_lightstyle);
1096                 MSG_WriteByte (&host_client->message, (char)i);
1097                 MSG_WriteString (&host_client->message, sv.lightstyles[i]);
1098         }
1099
1100 //
1101 // send some stats
1102 //
1103         MSG_WriteByte (&host_client->message, svc_updatestat);
1104         MSG_WriteByte (&host_client->message, STAT_TOTALSECRETS);
1105         MSG_WriteLong (&host_client->message, pr_global_struct->total_secrets);
1106
1107         MSG_WriteByte (&host_client->message, svc_updatestat);
1108         MSG_WriteByte (&host_client->message, STAT_TOTALMONSTERS);
1109         MSG_WriteLong (&host_client->message, pr_global_struct->total_monsters);
1110
1111         MSG_WriteByte (&host_client->message, svc_updatestat);
1112         MSG_WriteByte (&host_client->message, STAT_SECRETS);
1113         MSG_WriteLong (&host_client->message, pr_global_struct->found_secrets);
1114
1115         MSG_WriteByte (&host_client->message, svc_updatestat);
1116         MSG_WriteByte (&host_client->message, STAT_MONSTERS);
1117         MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters);
1118
1119 //
1120 // send a fixangle
1121 // Never send a roll angle, because savegames can catch the server
1122 // in a state where it is expecting the client to correct the angle
1123 // and it won't happen if the game was just loaded, so you wind up
1124 // with a permanent head tilt
1125         ent = EDICT_NUM( 1 + (host_client - svs.clients) );
1126         MSG_WriteByte (&host_client->message, svc_setangle);
1127         for (i=0 ; i < 2 ; i++)
1128                 MSG_WriteAngle (&host_client->message, ent->v.angles[i] );
1129         MSG_WriteAngle (&host_client->message, 0 );
1130
1131         SV_WriteClientdataToMessage (sv_player, &host_client->message);
1132
1133         MSG_WriteByte (&host_client->message, svc_signonnum);
1134         MSG_WriteByte (&host_client->message, 3);
1135         host_client->sendsignon = true;
1136 }
1137
1138 /*
1139 ==================
1140 Host_Begin_f
1141 ==================
1142 */
1143 void Host_Begin_f (void)
1144 {
1145         if (cmd_source == src_command)
1146         {
1147                 Con_Printf ("begin is not valid from the console\n");
1148                 return;
1149         }
1150
1151         host_client->spawned = true;
1152 }
1153
1154 //===========================================================================
1155
1156
1157 /*
1158 ==================
1159 Host_Kick_f
1160
1161 Kicks a user off of the server
1162 ==================
1163 */
1164 void Host_Kick_f (void)
1165 {
1166         char            *who;
1167         char            *message = NULL;
1168         client_t        *save;
1169         int                     i;
1170         qboolean        byNumber = false;
1171
1172         if (cmd_source == src_command)
1173         {
1174                 if (!sv.active)
1175                 {
1176                         Cmd_ForwardToServer ();
1177                         return;
1178                 }
1179         }
1180         else if (pr_global_struct->deathmatch)
1181                 return;
1182
1183         save = host_client;
1184
1185         if (Cmd_Argc() > 2 && strcmp(Cmd_Argv(1), "#") == 0)
1186         {
1187                 i = atof(Cmd_Argv(2)) - 1;
1188                 if (i < 0 || i >= svs.maxclients)
1189                         return;
1190                 if (!svs.clients[i].active)
1191                         return;
1192                 host_client = &svs.clients[i];
1193                 byNumber = true;
1194         }
1195         else
1196         {
1197                 for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++)
1198                 {
1199                         if (!host_client->active)
1200                                 continue;
1201                         if (Q_strcasecmp(host_client->name, Cmd_Argv(1)) == 0)
1202                                 break;
1203                 }
1204         }
1205
1206         if (i < svs.maxclients)
1207         {
1208                 if (cmd_source == src_command)
1209                         if (cls.state == ca_dedicated)
1210                                 who = "Console";
1211                         else
1212                                 who = cl_name.string;
1213                 else
1214                         who = save->name;
1215
1216                 // can't kick yourself!
1217                 if (host_client == save)
1218                         return;
1219
1220                 if (Cmd_Argc() > 2)
1221                 {
1222                         message = COM_Parse(Cmd_Args());
1223                         if (byNumber)
1224                         {
1225                                 message++;                                                      // skip the #
1226                                 while (*message == ' ')                         // skip white space
1227                                         message++;
1228                                 message += strlen(Cmd_Argv(2)); // skip the number
1229                         }
1230                         while (*message && *message == ' ')
1231                                 message++;
1232                 }
1233                 if (message)
1234                         SV_ClientPrintf ("Kicked by %s: %s\n", who, message);
1235                 else
1236                         SV_ClientPrintf ("Kicked by %s\n", who);
1237                 SV_DropClient (false);
1238         }
1239
1240         host_client = save;
1241 }
1242
1243 /*
1244 ===============================================================================
1245
1246 DEBUGGING TOOLS
1247
1248 ===============================================================================
1249 */
1250
1251 /*
1252 ==================
1253 Host_Give_f
1254 ==================
1255 */
1256 void Host_Give_f (void)
1257 {
1258         char    *t;
1259         int             v;
1260         eval_t  *val;
1261
1262         if (cmd_source == src_command)
1263         {
1264                 Cmd_ForwardToServer ();
1265                 return;
1266         }
1267
1268         if (pr_global_struct->deathmatch)
1269                 return;
1270
1271         t = Cmd_Argv(1);
1272         v = atoi (Cmd_Argv(2));
1273         
1274         switch (t[0])
1275         {
1276    case '0':
1277    case '1':
1278    case '2':
1279    case '3':
1280    case '4':
1281    case '5':
1282    case '6':
1283    case '7':
1284    case '8':
1285    case '9':
1286       // MED 01/04/97 added hipnotic give stuff
1287       if (hipnotic)
1288       {
1289          if (t[0] == '6')
1290          {
1291             if (t[1] == 'a')
1292                sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
1293             else
1294                sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
1295          }
1296          else if (t[0] == '9')
1297             sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
1298          else if (t[0] == '0')
1299             sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
1300          else if (t[0] >= '2')
1301             sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
1302       }
1303       else
1304       {
1305          if (t[0] >= '2')
1306             sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
1307       }
1308                 break;
1309         
1310     case 's':
1311                 if (rogue)
1312                 {
1313                     if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_shells1)))
1314                             val->_float = v;
1315                 }
1316
1317         sv_player->v.ammo_shells = v;
1318         break;          
1319     case 'n':
1320                 if (rogue)
1321                 {
1322                     if ((val = GETEDICTFIELDVALUE(sv_player, eval_ammo_nails1)))
1323                         {
1324                             val->_float = v;
1325                                 if (sv_player->v.weapon <= IT_LIGHTNING)
1326                                         sv_player->v.ammo_nails = v;
1327                         }
1328                 }
1329                 else
1330                 {
1331                         sv_player->v.ammo_nails = v;
1332                 }
1333         break;          
1334     case 'l':
1335                 if (rogue)
1336                 {
1337                         val = GETEDICTFIELDVALUE(sv_player, eval_ammo_lava_nails);
1338                         if (val)
1339                         {
1340                                 val->_float = v;
1341                                 if (sv_player->v.weapon > IT_LIGHTNING)
1342                                         sv_player->v.ammo_nails = v;
1343                         }
1344                 }
1345         break;
1346     case 'r':
1347                 if (rogue)
1348                 {
1349                         val = GETEDICTFIELDVALUE(sv_player, eval_ammo_rockets1);
1350                         if (val)
1351                         {
1352                                 val->_float = v;
1353                                 if (sv_player->v.weapon <= IT_LIGHTNING)
1354                                         sv_player->v.ammo_rockets = v;
1355                         }
1356                 }
1357                 else
1358                 {
1359                         sv_player->v.ammo_rockets = v;
1360                 }
1361         break;          
1362     case 'm':
1363                 if (rogue)
1364                 {
1365                         val = GETEDICTFIELDVALUE(sv_player, eval_ammo_multi_rockets);
1366                         if (val)
1367                         {
1368                                 val->_float = v;
1369                                 if (sv_player->v.weapon > IT_LIGHTNING)
1370                                         sv_player->v.ammo_rockets = v;
1371                         }
1372                 }
1373         break;          
1374     case 'h':
1375         sv_player->v.health = v;
1376         break;          
1377     case 'c':
1378                 if (rogue)
1379                 {
1380                         val = GETEDICTFIELDVALUE(sv_player, eval_ammo_cells1);
1381                         if (val)
1382                         {
1383                                 val->_float = v;
1384                                 if (sv_player->v.weapon <= IT_LIGHTNING)
1385                                         sv_player->v.ammo_cells = v;
1386                         }
1387                 }
1388                 else
1389                 {
1390                         sv_player->v.ammo_cells = v;
1391                 }
1392         break;          
1393     case 'p':
1394                 if (rogue)
1395                 {
1396                         val = GETEDICTFIELDVALUE(sv_player, eval_ammo_plasma);
1397                         if (val)
1398                         {
1399                                 val->_float = v;
1400                                 if (sv_player->v.weapon > IT_LIGHTNING)
1401                                         sv_player->v.ammo_cells = v;
1402                         }
1403                 }
1404         break;          
1405     }
1406 }
1407
1408 edict_t *FindViewthing (void)
1409 {
1410         int             i;
1411         edict_t *e;
1412         
1413         for (i=0 ; i<sv.num_edicts ; i++)
1414         {
1415                 e = EDICT_NUM(i);
1416                 if ( !strcmp (pr_strings + e->v.classname, "viewthing") )
1417                         return e;
1418         }
1419         Con_Printf ("No viewthing on map\n");
1420         return NULL;
1421 }
1422
1423 /*
1424 ==================
1425 Host_Viewmodel_f
1426 ==================
1427 */
1428 void Host_Viewmodel_f (void)
1429 {
1430         edict_t *e;
1431         model_t *m;
1432
1433         e = FindViewthing ();
1434         if (!e)
1435                 return;
1436
1437         m = Mod_ForName (Cmd_Argv(1), false);
1438         if (!m)
1439         {
1440                 Con_Printf ("Can't load %s\n", Cmd_Argv(1));
1441                 return;
1442         }
1443         
1444         e->v.frame = 0;
1445         cl.model_precache[(int)e->v.modelindex] = m;
1446 }
1447
1448 /*
1449 ==================
1450 Host_Viewframe_f
1451 ==================
1452 */
1453 void Host_Viewframe_f (void)
1454 {
1455         edict_t *e;
1456         int             f;
1457         model_t *m;
1458
1459         e = FindViewthing ();
1460         if (!e)
1461                 return;
1462         m = cl.model_precache[(int)e->v.modelindex];
1463
1464         f = atoi(Cmd_Argv(1));
1465         if (f >= m->numframes)
1466                 f = m->numframes-1;
1467
1468         e->v.frame = f;         
1469 }
1470
1471
1472 void PrintFrameName (model_t *m, int frame)
1473 {
1474         int data;
1475         data = (int) Mod_Extradata(m);
1476         if (m->ofs_scenes && data)
1477                 Con_Printf("frame %i: %s\n", frame, ((animscene_t *) (m->ofs_scenes + data))[frame].name);
1478         else
1479                 Con_Printf("frame %i\n", frame);
1480 }
1481
1482 /*
1483 ==================
1484 Host_Viewnext_f
1485 ==================
1486 */
1487 void Host_Viewnext_f (void)
1488 {
1489         edict_t *e;
1490         model_t *m;
1491         
1492         e = FindViewthing ();
1493         if (!e)
1494                 return;
1495         m = cl.model_precache[(int)e->v.modelindex];
1496
1497         e->v.frame = e->v.frame + 1;
1498         if (e->v.frame >= m->numframes)
1499                 e->v.frame = m->numframes - 1;
1500
1501         PrintFrameName (m, e->v.frame);         
1502 }
1503
1504 /*
1505 ==================
1506 Host_Viewprev_f
1507 ==================
1508 */
1509 void Host_Viewprev_f (void)
1510 {
1511         edict_t *e;
1512         model_t *m;
1513
1514         e = FindViewthing ();
1515         if (!e)
1516                 return;
1517
1518         m = cl.model_precache[(int)e->v.modelindex];
1519
1520         e->v.frame = e->v.frame - 1;
1521         if (e->v.frame < 0)
1522                 e->v.frame = 0;
1523
1524         PrintFrameName (m, e->v.frame);         
1525 }
1526
1527 /*
1528 ===============================================================================
1529
1530 DEMO LOOP CONTROL
1531
1532 ===============================================================================
1533 */
1534
1535
1536 /*
1537 ==================
1538 Host_Startdemos_f
1539 ==================
1540 */
1541 void Host_Startdemos_f (void)
1542 {
1543         int             i, c;
1544
1545         if (cls.state == ca_dedicated)
1546         {
1547                 if (!sv.active)
1548                         Cbuf_AddText ("map start\n");
1549                 return;
1550         }
1551
1552         c = Cmd_Argc() - 1;
1553         if (c > MAX_DEMOS)
1554         {
1555                 Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS);
1556                 c = MAX_DEMOS;
1557         }
1558         Con_Printf ("%i demo(s) in loop\n", c);
1559
1560         for (i=1 ; i<c+1 ; i++)
1561                 strncpy (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0])-1);
1562
1563         if (!sv.active && cls.demonum != -1 && !cls.demoplayback)
1564         {
1565                 cls.demonum = 0;
1566                 CL_NextDemo ();
1567         }
1568         else
1569                 cls.demonum = -1;
1570 }
1571
1572
1573 /*
1574 ==================
1575 Host_Demos_f
1576
1577 Return to looping demos
1578 ==================
1579 */
1580 void Host_Demos_f (void)
1581 {
1582         if (cls.state == ca_dedicated)
1583                 return;
1584         if (cls.demonum == -1)
1585                 cls.demonum = 1;
1586         CL_Disconnect_f ();
1587         CL_NextDemo ();
1588 }
1589
1590 /*
1591 ==================
1592 Host_Stopdemo_f
1593
1594 Return to looping demos
1595 ==================
1596 */
1597 void Host_Stopdemo_f (void)
1598 {
1599         if (cls.state == ca_dedicated)
1600                 return;
1601         if (!cls.demoplayback)
1602                 return;
1603         CL_StopPlayback ();
1604         CL_Disconnect ();
1605 }
1606
1607 //=============================================================================
1608
1609 /*
1610 ==================
1611 Host_InitCommands
1612 ==================
1613 */
1614 void Host_InitCommands (void)
1615 {
1616         Cmd_AddCommand ("status", Host_Status_f);
1617         Cmd_AddCommand ("quit", Host_Quit_f);
1618         if (nehahra)
1619         {
1620                 Cmd_AddCommand ("max", Host_God_f);
1621                 Cmd_AddCommand ("monster", Host_Notarget_f);
1622                 Cmd_AddCommand ("scrag", Host_Fly_f);
1623                 Cmd_AddCommand ("wraith", Host_Noclip_f);
1624                 Cmd_AddCommand ("gimme", Host_Give_f);
1625         }
1626         else
1627         {
1628                 Cmd_AddCommand ("god", Host_God_f);
1629                 Cmd_AddCommand ("notarget", Host_Notarget_f);
1630                 Cmd_AddCommand ("fly", Host_Fly_f);
1631                 Cmd_AddCommand ("noclip", Host_Noclip_f);
1632                 Cmd_AddCommand ("give", Host_Give_f);
1633         }
1634         Cmd_AddCommand ("map", Host_Map_f);
1635         Cmd_AddCommand ("restart", Host_Restart_f);
1636         Cmd_AddCommand ("changelevel", Host_Changelevel_f);
1637         Cmd_AddCommand ("connect", Host_Connect_f);
1638         Cmd_AddCommand ("reconnect", Host_Reconnect_f);
1639         Cmd_AddCommand ("name", Host_Name_f);
1640         Cmd_AddCommand ("version", Host_Version_f);
1641         Cmd_AddCommand ("say", Host_Say_f);
1642         Cmd_AddCommand ("say_team", Host_Say_Team_f);
1643         Cmd_AddCommand ("tell", Host_Tell_f);
1644         Cmd_AddCommand ("color", Host_Color_f);
1645         Cmd_AddCommand ("kill", Host_Kill_f);
1646         Cmd_AddCommand ("pause", Host_Pause_f);
1647         Cmd_AddCommand ("spawn", Host_Spawn_f);
1648         Cmd_AddCommand ("begin", Host_Begin_f);
1649         Cmd_AddCommand ("prespawn", Host_PreSpawn_f);
1650         Cmd_AddCommand ("kick", Host_Kick_f);
1651         Cmd_AddCommand ("ping", Host_Ping_f);
1652         Cmd_AddCommand ("load", Host_Loadgame_f);
1653         Cmd_AddCommand ("save", Host_Savegame_f);
1654
1655         Cmd_AddCommand ("startdemos", Host_Startdemos_f);
1656         Cmd_AddCommand ("demos", Host_Demos_f);
1657         Cmd_AddCommand ("stopdemo", Host_Stopdemo_f);
1658
1659         Cmd_AddCommand ("viewmodel", Host_Viewmodel_f);
1660         Cmd_AddCommand ("viewframe", Host_Viewframe_f);
1661         Cmd_AddCommand ("viewnext", Host_Viewnext_f);
1662         Cmd_AddCommand ("viewprev", Host_Viewprev_f);
1663
1664         Cmd_AddCommand ("mcache", Mod_Print);
1665 }