2 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
13 See the GNU General Public License for more details.
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.
20 // host.c -- coordinates spawning and killing of local servers
30 A server can always be started, even if the system started out as a client
33 A client can NOT be started if the system started as a dedicated server.
35 Memory is cleared / released when a server or client begins, not when they end.
39 // how many frames have occurred
40 // (checked by Host_Error and Host_SaveConfig_f)
42 // LordHavoc: set when quit is executed
43 qboolean host_shuttingdown = false;
45 double host_frametime;
46 // LordHavoc: the real frametime, before slowmo and clamping are applied (used for console scrolling)
47 double host_realframetime;
48 // the real time, without any slowmo or clamping
50 // realtime from previous frame
53 // used for -developer commandline parameter, hacky hacky
57 client_t *host_client;
59 jmp_buf host_abortserver;
61 // pretend frames take this amount of time (in seconds), 0 = realtime
62 cvar_t host_framerate = {0, "host_framerate","0"};
63 // shows time used by certain subsystems
64 cvar_t host_speeds = {0, "host_speeds","0"};
65 // LordHavoc: framerate independent slowmo
66 cvar_t slowmo = {0, "slowmo", "1.0"};
67 // LordHavoc: framerate upper cap
68 cvar_t cl_maxfps = {CVAR_SAVE, "cl_maxfps", "1000"};
70 // print broadcast messages in dedicated mode
71 cvar_t sv_echobprint = {CVAR_SAVE, "sv_echobprint", "1"};
73 cvar_t sys_ticrate = {CVAR_SAVE, "sys_ticrate","0.05"};
74 cvar_t serverprofile = {0, "serverprofile","0"};
76 cvar_t fraglimit = {CVAR_NOTIFY, "fraglimit","0"};
77 cvar_t timelimit = {CVAR_NOTIFY, "timelimit","0"};
78 cvar_t teamplay = {CVAR_NOTIFY, "teamplay","0"};
80 cvar_t samelevel = {0, "samelevel","0"};
81 cvar_t noexit = {CVAR_NOTIFY, "noexit","0"};
83 cvar_t developer = {0, "developer","0"};
85 cvar_t skill = {0, "skill","1"};
86 cvar_t deathmatch = {0, "deathmatch","0"};
87 cvar_t coop = {0, "coop","0"};
89 cvar_t pausable = {0, "pausable","1"};
91 cvar_t temp1 = {0, "temp1","0"};
93 cvar_t timestamps = {CVAR_SAVE, "timestamps", "0"};
94 cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%b %e %X] "};
100 This shuts down both the client and server
103 void PRVM_ProcessError(void);
104 static char hosterrorstring1[4096];
105 static char hosterrorstring2[4096];
106 static qboolean hosterror = false;
107 void Host_Error (const char *error, ...)
111 va_start (argptr,error);
112 dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
115 Con_Printf("Host_Error: %s\n", hosterrorstring1);
117 // LordHavoc: if crashing very early, or currently shutting down, do
119 if (host_framecount < 3 || host_shuttingdown)
120 Sys_Error ("Host_Error: %s", hosterrorstring1);
123 Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1);
126 strcpy(hosterrorstring2, hosterrorstring1);
128 CL_Parse_DumpPacket();
132 //PRVM_Crash(); // crash current prog
134 // crash all prvm progs
139 Host_ShutdownServer (false);
141 if (cls.state == ca_dedicated)
142 Sys_Error ("Host_Error: %s\n",hosterrorstring2); // dedicated servers exit
149 longjmp (host_abortserver, 1);
152 void Host_ServerOptions (void)
159 // COMMANDLINEOPTION: Server: -dedicated [playerlimit] starts a dedicated server (with a command console), default playerlimit is 8
160 // COMMANDLINEOPTION: Server: -listen [playerlimit] starts a multiplayer server with graphical client, like singleplayer but other players can connect, default playerlimit is 8
163 // client exists, check what mode the user wants
164 i = COM_CheckParm ("-dedicated");
167 cls.state = ca_dedicated;
168 // default players unless specified
169 if (i + 1 < com_argc && atoi (com_argv[i+1]) >= 1)
170 svs.maxclients = atoi (com_argv[i+1]);
171 if (COM_CheckParm ("-listen"))
172 Sys_Error ("Only one of -dedicated or -listen can be specified");
176 cls.state = ca_disconnected;
177 i = COM_CheckParm ("-listen");
180 // default players unless specified
181 if (i + 1 < com_argc && atoi (com_argv[i+1]) >= 1)
182 svs.maxclients = atoi (com_argv[i+1]);
186 // default players in some games, singleplayer in most
187 if (gamemode != GAME_GOODVSBAD2 && gamemode != GAME_NEXUIZ && gamemode != GAME_BATTLEMECH)
194 // no client in the executable, always start dedicated server
195 if (COM_CheckParm ("-listen"))
196 Sys_Error ("-listen not available in a dedicated server executable");
197 cls.state = ca_dedicated;
198 // check for -dedicated specifying how many players
199 i = COM_CheckParm ("-dedicated");
200 // default players unless specified
201 if (i && i + 1 < com_argc && atoi (com_argv[i+1]) >= 1)
202 svs.maxclients = atoi (com_argv[i+1]);
205 svs.maxclients = bound(1, svs.maxclients, MAX_SCOREBOARD);
207 svs.clients = Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
209 if (svs.maxclients > 1 && !deathmatch.integer)
210 Cvar_SetValueQuick(&deathmatch, 1);
214 =======================
216 ======================
218 void Host_SaveConfig_f(void);
219 void Host_InitLocal (void)
221 Cmd_AddCommand("saveconfig", Host_SaveConfig_f);
223 Cvar_RegisterVariable (&host_framerate);
224 Cvar_RegisterVariable (&host_speeds);
225 Cvar_RegisterVariable (&slowmo);
226 Cvar_RegisterVariable (&cl_maxfps);
228 Cvar_RegisterVariable (&sv_echobprint);
230 Cvar_RegisterVariable (&sys_ticrate);
231 Cvar_RegisterVariable (&serverprofile);
233 Cvar_RegisterVariable (&fraglimit);
234 Cvar_RegisterVariable (&timelimit);
235 Cvar_RegisterVariable (&teamplay);
236 Cvar_RegisterVariable (&samelevel);
237 Cvar_RegisterVariable (&noexit);
238 Cvar_RegisterVariable (&skill);
239 Cvar_RegisterVariable (&developer);
240 if (forcedeveloper) // make it real now that the cvar is registered
241 Cvar_SetValue("developer", 1);
242 Cvar_RegisterVariable (&deathmatch);
243 Cvar_RegisterVariable (&coop);
245 Cvar_RegisterVariable (&pausable);
247 Cvar_RegisterVariable (&temp1);
249 Cvar_RegisterVariable (×tamps);
250 Cvar_RegisterVariable (&timeformat);
258 Writes key bindings and archived cvars to config.cfg
261 void Host_SaveConfig_f(void)
265 // dedicated servers initialize the host but don't parse and set the
267 // LordHavoc: don't save a config if it crashed in startup
268 if (host_framecount >= 3 && cls.state != ca_dedicated)
270 f = FS_Open ("config.cfg", "wb", false, false);
273 Con_Print("Couldn't write config.cfg.\n");
277 Key_WriteBindings (f);
278 Cvar_WriteVariables (f);
289 Sends text across to be displayed
290 FIXME: make this just a stuffed echo?
293 void SV_ClientPrint(const char *msg)
295 MSG_WriteByte(&host_client->message, svc_print);
296 MSG_WriteString(&host_client->message, msg);
303 Sends text across to be displayed
304 FIXME: make this just a stuffed echo?
307 void SV_ClientPrintf(const char *fmt, ...)
312 va_start(argptr,fmt);
313 dpvsnprintf(msg,sizeof(msg),fmt,argptr);
323 Sends text to all active clients
326 void SV_BroadcastPrint(const char *msg)
331 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
335 MSG_WriteByte(&client->message, svc_print);
336 MSG_WriteString(&client->message, msg);
340 if (sv_echobprint.integer && cls.state == ca_dedicated)
348 Sends text to all active clients
351 void SV_BroadcastPrintf(const char *fmt, ...)
356 va_start(argptr,fmt);
357 dpvsnprintf(msg,sizeof(msg),fmt,argptr);
360 SV_BroadcastPrint(msg);
367 Send text over to the client to be executed
370 void Host_ClientCommands(const char *fmt, ...)
375 va_start(argptr,fmt);
376 dpvsnprintf(string, sizeof(string), fmt, argptr);
379 MSG_WriteByte(&host_client->message, svc_stufftext);
380 MSG_WriteString(&host_client->message, string);
384 =====================
387 Called when the player is getting totally kicked off the host
388 if (crash = true), don't bother sending signofs
389 =====================
391 void SV_DropClient(qboolean crash)
394 Con_Printf("Client \"%s\" dropped\n", host_client->name);
396 // make sure edict is not corrupt (from a level change for example)
397 host_client->edict = EDICT_NUM(host_client - svs.clients + 1);
399 if (host_client->netconnection)
401 // free the client (the body stays around)
404 // LordHavoc: no opportunity for resending, so use unreliable
405 MSG_WriteByte(&host_client->message, svc_disconnect);
406 NetConn_SendUnreliableMessage(host_client->netconnection, &host_client->message);
408 // break the net connection
409 NetConn_Close(host_client->netconnection);
410 host_client->netconnection = NULL;
413 // call qc ClientDisconnect function
414 // LordHavoc: don't call QC if server is dead (avoids recursive
415 // Host_Error in some mods when they run out of edicts)
416 if (host_client->active && sv.active && host_client->edict && host_client->spawned)
418 // call the prog function for removing a client
419 // this will set the body to a dead frame, among other things
420 int saveSelf = pr_global_struct->self;
421 pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
422 PR_ExecuteProgram(pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing");
423 pr_global_struct->self = saveSelf;
426 // remove leaving player from scoreboard
427 //host_client->edict->v->netname = PR_SetEngineString(host_client->name);
428 //if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_clientcolors)))
430 //host_client->edict->v->frags = 0;
431 host_client->name[0] = 0;
432 host_client->colors = 0;
433 host_client->frags = 0;
434 // send notification to all clients
435 // get number of client manually just to make sure we get it right...
436 i = host_client - svs.clients;
437 MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
438 MSG_WriteByte (&sv.reliable_datagram, i);
439 MSG_WriteString (&sv.reliable_datagram, host_client->name);
440 MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
441 MSG_WriteByte (&sv.reliable_datagram, i);
442 MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
443 MSG_WriteByte (&sv.reliable_datagram, svc_updatefrags);
444 MSG_WriteByte (&sv.reliable_datagram, i);
445 MSG_WriteShort (&sv.reliable_datagram, host_client->frags);
447 // free the client now
448 if (host_client->entitydatabase)
449 EntityFrame_FreeDatabase(host_client->entitydatabase);
450 if (host_client->entitydatabase4)
451 EntityFrame4_FreeDatabase(host_client->entitydatabase4);
452 if (host_client->entitydatabase5)
453 EntityFrame5_FreeDatabase(host_client->entitydatabase5);
457 // clear a fields that matter to DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS, and also frags
458 ED_ClearEdict(host_client->edict);
461 // clear the client struct (this sets active to false)
462 memset(host_client, 0, sizeof(*host_client));
464 // update server listing on the master because player count changed
465 // (which the master uses for filtering empty/full servers)
466 NetConn_Heartbeat(1);
473 This only happens at the end of a game, not between levels
476 void Host_ShutdownServer(qboolean crash)
482 Con_DPrintf("Host_ShutdownServer\n");
487 // print out where the crash happened, if it was caused by QC
490 NetConn_Heartbeat(2);
491 NetConn_Heartbeat(2);
493 // make sure all the clients know we're disconnecting
497 MSG_WriteByte(&buf, svc_disconnect);
498 count = NetConn_SendToAll(&buf, 5);
500 Con_Printf("Host_ShutdownServer: NetConn_SendToAll failed for %u clients\n", count);
502 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
503 if (host_client->active)
504 SV_DropClient(crash); // server shutdown
506 NetConn_CloseServerPorts();
513 memset(&sv, 0, sizeof(sv));
514 memset(svs.clients, 0, svs.maxclients*sizeof(client_t));
522 This clears all the memory used by both the client and server, but does
523 not reinitialize anything.
526 void Host_ClearMemory (void)
528 Con_DPrint("Clearing memory\n");
532 memset (&sv, 0, sizeof(sv));
533 memset (&cl, 0, sizeof(cl));
537 //============================================================================
543 Returns false if the time is too short to run a frame
546 extern qboolean cl_capturevideo_active;
547 extern double cl_capturevideo_framerate;
548 extern qfile_t *cl_capturevideo_soundfile;
549 qboolean Host_FilterTime (double time)
551 double timecap, timeleft;
554 if (sys_ticrate.value < 0.00999 || sys_ticrate.value > 0.10001)
555 Cvar_SetValue("sys_ticrate", bound(0.01, sys_ticrate.value, 0.1));
556 if (slowmo.value < 0)
557 Cvar_SetValue("slowmo", 0);
558 if (host_framerate.value < 0.00001 && host_framerate.value != 0)
559 Cvar_SetValue("host_framerate", 0);
560 if (cl_maxfps.value < 1)
561 Cvar_SetValue("cl_maxfps", 1);
565 // disable time effects during timedemo
566 cl.frametime = host_realframetime = host_frametime = realtime - oldrealtime;
567 oldrealtime = realtime;
571 // check if framerate is too high
572 // default to sys_ticrate (server framerate - presumably low) unless we
573 // have a good reason to run faster
574 timecap = host_framerate.value;
576 timecap = sys_ticrate.value;
577 if (cls.state != ca_dedicated)
579 if (cl_capturevideo_active)
580 timecap = 1.0 / cl_capturevideo_framerate;
581 else if (vid_activewindow)
582 timecap = 1.0 / cl_maxfps.value;
585 timeleft = timecap - (realtime - oldrealtime);
589 // don't totally hog the CPU
590 if (cls.state == ca_dedicated)
592 // if dedicated, try to use as little cpu as possible by waiting
593 // just a little longer than necessary
594 // (yes this means it doesn't quite keep up with the framerate)
595 msleft = (int)ceil(timeleft * 1000);
599 // if not dedicated, try to hit exactly a steady framerate by not
600 // sleeping the full amount
601 msleft = (int)floor(timeleft * 1000);
608 // LordHavoc: copy into host_realframetime as well
609 host_realframetime = host_frametime = realtime - oldrealtime;
610 oldrealtime = realtime;
612 if (cl_capturevideo_active && !cl_capturevideo_soundfile)
613 host_frametime = timecap;
615 // apply slowmo scaling
616 host_frametime *= slowmo.value;
618 // host_framerate overrides all else
619 if (host_framerate.value)
620 host_frametime = host_framerate.value;
622 // never run a frame longer than 1 second
623 if (host_frametime > 1)
626 cl.frametime = host_frametime;
634 Host_GetConsoleCommands
636 Add them exactly as if they had been typed at the console
639 void Host_GetConsoleCommands (void)
645 cmd = Sys_ConsoleInput ();
659 void Host_ServerFrame (void)
661 // never run more than 5 frames at a time as a sanity limit
662 int framecount, framelimit = 5;
669 sv.timer += host_realframetime;
670 // run the world state
671 // don't allow simulation to run too fast or too slow or logic glitches can occur
672 for (framecount = 0;framecount < framelimit && sv.timer > 0;framecount++)
675 advancetime = min(sv.timer, sys_ticrate.value);
677 advancetime = sys_ticrate.value;
678 sv.timer -= advancetime;
680 // only advance time if not paused
681 // the game also pauses in singleplayer when menu or console is used
682 sv.frametime = advancetime * slowmo.value;
683 if (host_framerate.value)
684 sv.frametime = host_framerate.value;
685 if (sv.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive)))
688 pr_global_struct->frametime = sv.frametime;
690 // set the time and clear the general datagram
693 // check for network packets to the server each world step incase they
694 // come in midframe (particularly if host is running really slow)
695 NetConn_ServerFrame();
697 // read client messages
700 // move things around and think unless paused
704 // send all messages to the clients
705 SV_SendClientMessages();
707 // send an heartbeat if enough time has passed since the last one
708 NetConn_Heartbeat(0);
710 // if we fell behind too many frames just don't worry about it
720 Runs all active servers
723 void _Host_Frame (float time)
725 static double time1 = 0;
726 static double time2 = 0;
727 static double time3 = 0;
728 int pass1, pass2, pass3;
730 if (setjmp(host_abortserver))
731 return; // something bad happened, or the server disconnected
733 // decide the simulation time
734 if (!Host_FilterTime(time))
737 // keep the random time dependent
740 cl.islocalgame = NetConn_IsLocalGame();
742 // get new key events
745 // Collect input into cmd
748 // process console commands
751 // if running the server locally, make intentions now
752 if (cls.state == ca_connected && sv.active)
755 //-------------------
759 //-------------------
761 // check for commands typed to the host
762 Host_GetConsoleCommands();
767 //-------------------
771 //-------------------
773 cl.oldtime = cl.time;
774 cl.time += cl.frametime;
776 NetConn_ClientFrame();
778 if (cls.state == ca_connected)
780 // if running the server remotely, send intentions now after
781 // the incoming messages have been read
792 if (host_speeds.integer)
793 time1 = Sys_DoubleTime();
797 if (host_speeds.integer)
798 time2 = Sys_DoubleTime();
801 if (cls.signon == SIGNONS && cl_entities[cl.viewentity].state_current.active)
803 // LordHavoc: this used to use renderer variables (eww)
804 S_Update(&cl_entities[cl.viewentity].render.matrix);
807 S_Update(&identitymatrix);
811 if (host_speeds.integer)
813 pass1 = (time1 - time3)*1000000;
814 time3 = Sys_DoubleTime();
815 pass2 = (time2 - time1)*1000000;
816 pass3 = (time3 - time2)*1000000;
817 Con_Printf("%6ius total %6ius server %6ius gfx %6ius snd\n",
818 pass1+pass2+pass3, pass1, pass2, pass3);
824 void Host_Frame (float time)
827 static double timetotal;
828 static int timecount;
831 if (!serverprofile.integer)
837 time1 = Sys_DoubleTime ();
839 time2 = Sys_DoubleTime ();
841 timetotal += time2 - time1;
844 if (timecount < 1000)
847 m = timetotal*1000/timecount;
851 for (i=0 ; i<svs.maxclients ; i++)
853 if (svs.clients[i].active)
857 Con_Printf("serverprofile: %2i clients %2i msec\n", c, m);
860 //============================================================================
862 qboolean vid_opened = false;
863 void Host_StartVideo(void)
865 if (!vid_opened && cls.state != ca_dedicated)
870 CL_InitTEnts(); // We must wait after sound startup to load tent sounds
875 char engineversion[128];
877 qboolean sys_nostdout = false;
879 extern void Render_Init(void);
880 extern void Mathlib_Init(void);
881 extern void FS_Init(void);
882 extern void FS_Shutdown(void);
883 extern void PR_Cmd_Init(void);
884 extern void COM_Init_Commands(void);
885 extern void FS_Init_Commands(void);
886 extern void COM_CheckRegistered(void);
887 extern qboolean host_stuffcmdsrun;
894 void Host_Init (void)
899 // LordHavoc: quake never seeded the random number generator before... heh
902 // used by everything
905 // initialize console and logging
908 // initialize console command/cvar/alias/command execution systems
914 // initialize console window (only used by sys_win.c)
917 // detect gamemode from commandline options or executable name
920 // construct a version string for the corner of the console
921 #if defined(__linux__)
925 #elif defined(__FreeBSD__)
927 #elif defined(__NetBSD__)
929 #elif defined(__OpenBSD__)
931 #elif defined(MACOSX)
936 dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
938 // COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
939 if (COM_CheckParm("-nostdout"))
942 Con_Printf("%s\n", engineversion);
944 // FIXME: this is evil, but possibly temporary
945 // COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
946 if (COM_CheckParm("-developer"))
948 forcedeveloper = true;
949 developer.integer = 1;
953 // initialize filesystem (including fs_basedir, fs_gamedir, -path, -game, scr_screenshot_name)
956 // initialize various cvars that could not be initialized earlier
957 Memory_Init_Commands();
963 COM_CheckRegistered();
965 // initialize ixtable
976 Host_ServerOptions();
978 if (cls.state != ca_dedicated)
980 Con_Printf("Initializing client\n");
995 // set up the default startmap_sp and startmap_dm aliases (mods can
996 // override these) and then execute the quake.rc startup script
997 if (gamemode == GAME_NEHAHRA)
998 Cbuf_AddText("alias startmap_sp \"map nehstart\"\nalias startmap_dm \"map nehstart\"\nexec quake.rc\n");
999 else if (gamemode == GAME_TRANSFUSION)
1000 Cbuf_AddText("alias startmap_sp \"map e1m1\"\n""alias startmap_dm \"map bb1\"\nexec quake.rc\n");
1001 else if (gamemode == GAME_NEXUIZ)
1002 Cbuf_AddText("alias startmap_sp \"map nexdm01\"\nalias startmap_dm \"map nexdm01\"\nexec quake.rc\n");
1003 else if (gamemode == GAME_TEU)
1004 Cbuf_AddText("alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec teu.rc\n");
1006 Cbuf_AddText("alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec quake.rc\n");
1009 // if stuffcmds wasn't run, then quake.rc is probably missing, use default
1010 if (!host_stuffcmdsrun)
1012 Cbuf_AddText("exec default.cfg\nexec config.cfg\nexec autoexec.cfg\nstuffcmds\n");
1016 // save console log up to this point to log_file if it was set by configs
1019 // check for special benchmark mode
1020 // COMMANDLINEOPTION: Client: -benchmark <demoname> runs a timedemo and quits, results of any timedemo can be found in gamedir/benchmark.log (for example id1/benchmark.log)
1021 i = COM_CheckParm("-benchmark");
1022 if (i && i + 1 < com_argc)
1023 if (!sv.active && !cls.demoplayback && !cls.connect_trying)
1025 Cbuf_AddText(va("timedemo %s\n", com_argv[i + 1]));
1029 if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
1030 if (!sv.active && !cls.demoplayback && !cls.connect_trying)
1032 Cbuf_AddText("startmap_dm\n");
1036 if (!sv.active && !cls.demoplayback && !cls.connect_trying)
1038 if (gamemode == GAME_NEXUIZ)
1039 Cbuf_AddText("togglemenu\nplayvideo logo\ncd loop 1\n");
1041 Cbuf_AddText("togglemenu\n");
1045 Con_DPrint("========Initialized=========\n");
1055 FIXME: this is a callback from Sys_Quit and Sys_Error. It would be better
1056 to run quit through here before the final handoff to the sys code.
1059 void Host_Shutdown(void)
1061 static qboolean isdown = false;
1065 Con_Print("recursive shutdown\n");
1070 // be quiet while shutting down
1073 // disconnect client from server if active
1076 // shut down local server if active
1077 Host_ShutdownServer (false);
1084 // AK hmm, no PRVM_Shutdown(); yet
1086 CL_Video_Shutdown();
1088 Host_SaveConfig_f();
1090 CDAudio_Shutdown ();
1092 NetConn_Shutdown ();
1095 if (cls.state != ca_dedicated)
1097 R_Modules_Shutdown();