va_list argptr;
va_start (argptr,error);
- vsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
+ dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
va_end (argptr);
Con_Printf("Host_Error: %s\n", hosterrorstring1);
void Host_InitLocal (void)
{
Host_InitCommands ();
-
+
Cmd_AddCommand("saveconfig", Host_SaveConfig_f);
Cvar_RegisterVariable (&host_framerate);
// dedicated servers initialize the host but don't parse and set the
// config.cfg cvars
- if (host_initialized && cls.state != ca_dedicated)
+ // LordHavoc: save a config only after Host_Frame finished the first frame
+ if (host_initialized && host_loopactive && cls.state != ca_dedicated)
{
- f = FS_Open ("config.cfg", "w", false);
+ f = FS_Open ("config.cfg", "wb", false, false);
if (!f)
{
Con_Print("Couldn't write config.cfg.\n");
char msg[4096];
va_start(argptr,fmt);
- vsnprintf(msg,sizeof(msg),fmt,argptr);
+ dpvsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
SV_ClientPrint(msg);
char msg[4096];
va_start(argptr,fmt);
- vsnprintf(msg,sizeof(msg),fmt,argptr);
+ dpvsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
SV_BroadcastPrint(msg);
char string[1024];
va_start(argptr,fmt);
- vsnprintf(string, sizeof(string), fmt, argptr);
+ dpvsnprintf(string, sizeof(string), fmt, argptr);
va_end(argptr);
MSG_WriteByte(&host_client->message, svc_stufftext);
EntityFrame4_FreeDatabase(host_client->entitydatabase4);
if (host_client->entitydatabase5)
EntityFrame5_FreeDatabase(host_client->entitydatabase5);
-
+
if (sv.active)
{
// clear a fields that matter to DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS, and also frags
ED_ClearEdict(host_client->edict);
}
-
+
// clear the client struct (this sets active to false)
memset(host_client, 0, sizeof(*host_client));
double timecap, timeleft;
realtime += time;
- if (sys_ticrate.value < 0.01 || sys_ticrate.value > 0.10001)
+ if (sys_ticrate.value < 0.00999 || sys_ticrate.value > 0.10001)
Cvar_SetValue("sys_ticrate", bound(0.01, sys_ticrate.value, 0.1));
if (slowmo.value < 0)
Cvar_SetValue("slowmo", 0);
if (cls.state != ca_dedicated)
{
VID_Open();
+ CDAudio_Startup();
CL_InitTEnts (); // We must wait after sound startup to load tent sounds
SCR_BeginLoadingPlaque();
MR_Init();
}
+ // set up the default startmap_sp and startmap_dm aliases, mods can
+ // override these
+ if (gamemode == GAME_NEHAHRA)
+ {
+ Cbuf_InsertText ("alias startmap_sp \"map nehstart\"\n");
+ Cbuf_InsertText ("alias startmap_dm \"map nehstart\"\n");
+ }
+ else if (gamemode == GAME_TRANSFUSION)
+ {
+ Cbuf_InsertText ("alias startmap_sp \"map e1m1\"\n");
+ Cbuf_InsertText ("alias startmap_dm \"map bb1\"\n");
+ }
+ else if (gamemode == GAME_NEXUIZ)
+ {
+ Cbuf_InsertText ("alias startmap_sp \"map nexdm01\"\n");
+ Cbuf_InsertText ("alias startmap_dm \"map nexdm01\"\n");
+ }
+ else
+ {
+ Cbuf_InsertText ("alias startmap_sp \"map start\"\n");
+ Cbuf_InsertText ("alias startmap_dm \"map start\"\n");
+ }
+
// stuff it again so the first host frame will execute it again, this time
// in its entirety
if (gamemode == GAME_TEU)
else
Cbuf_InsertText("exec quake.rc\n");
+ Cbuf_Execute();
+ Cbuf_Execute();
+ Cbuf_Execute();
+
if (!sv.active && (cls.state == ca_dedicated || COM_CheckParm("-listen")))
- {
- if (gamemode == GAME_TRANSFUSION)
- Cbuf_InsertText ("map bb1\n");
- else if (gamemode == GAME_NEXUIZ)
- Cbuf_InsertText ("map nexdm01\n");
- else
- Cbuf_InsertText ("map start\n");
- }
+ Cbuf_InsertText ("startmap_dm\n");
// check for special benchmark mode
// 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)
i = COM_CheckParm("-benchmark");
- if (i && i + 1 < com_argc)
+ if (i && i + 1 < com_argc && !sv.active)
Cbuf_InsertText(va("timedemo %s\n", com_argv[i + 1]));
+ if (!sv.active && !cls.demoplayback && !cls.connect_trying)
+ Cbuf_InsertText("togglemenu\n");
+
Cbuf_Execute();
// We must wait for the log_file cvar to be initialized to start the log
S_Terminate ();
NetConn_Shutdown ();
PR_Shutdown ();
- COM_Shutdown ();
Cbuf_Shutdown ();
if (cls.state != ca_dedicated)
CL_Shutdown();
Sys_Shutdown();
Log_Close ();
+ COM_Shutdown ();
Memory_Shutdown();
}