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