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