]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
patch from div0 that adds a special "extResponse " type of packet that can be returne...
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 15ffddc92334e21508f0cbb520d88627331ad35b..2a26253cb8fb24efc973f93c491f9d48741b48b3 100644 (file)
--- a/host.c
+++ b/host.c
@@ -86,7 +86,7 @@ cvar_t pausable = {0, "pausable","1", "allow players to pause or not"};
 cvar_t temp1 = {0, "temp1","0", "general cvar for mods to use, in stock id1 this selects which death animation to use on players (0 = random death, other values select specific death scenes)"};
 
 cvar_t timestamps = {CVAR_SAVE, "timestamps", "0", "prints timestamps on console messages"};
-cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%b %e %X] ", "time format to use on timestamped console messages"};
+cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%Y-%m-%d %H:%M:%S] ", "time format to use on timestamped console messages"};
 
 /*
 ================
@@ -213,9 +213,11 @@ Host_InitLocal
 ======================
 */
 void Host_SaveConfig_f(void);
+void Host_LoadConfig_f(void);
 static void Host_InitLocal (void)
 {
        Cmd_AddCommand("saveconfig", Host_SaveConfig_f, "save settings to config.cfg immediately (also automatic when quitting)");
+       Cmd_AddCommand("loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
 
        Cvar_RegisterVariable (&host_framerate);
        Cvar_RegisterVariable (&host_speeds);
@@ -278,6 +280,21 @@ void Host_SaveConfig_f(void)
 }
 
 
+/*
+===============
+Host_LoadConfig_f
+
+Resets key bindings and cvars to defaults and then reloads scripts
+===============
+*/
+void Host_LoadConfig_f(void)
+{
+       // unlock the cvar default strings so they can be updated by the new default.cfg
+       Cvar_UnlockDefaults();
+       // reset cvars to their defaults, and then exec startup scripts again
+       Cbuf_InsertText("cvar_resettodefaults_all;exec quake.rc\n");
+}
+
 /*
 =================
 SV_ClientPrint
@@ -738,10 +755,15 @@ void Host_Main(void)
                                // decide the simulation time
                                if (!cls.timedemo)
                                {
-                                       if (cls.capturevideo_active)// && !cls.capturevideo_soundfile)
+                                       if (cls.capturevideo.active)
                                        {
-                                               frametime = 1.0 / cls.capturevideo_framerate;
-                                               cl.realframetime = max(cl.realframetime, frametime);
+                                               if (cls.capturevideo.realtime)
+                                                       frametime = cl.realframetime = max(cl.realframetime, 1.0 / cls.capturevideo.framerate);
+                                               else
+                                               {
+                                                       frametime = 1.0 / cls.capturevideo.framerate;
+                                                       cl.realframetime = max(cl.realframetime, frametime);
+                                               }
                                        }
                                        else if (vid_activewindow)
                                                frametime = cl.realframetime = max(cl.realframetime, 1.0 / cl_maxfps.value);
@@ -841,7 +863,6 @@ extern void FS_Shutdown(void);
 extern void PR_Cmd_Init(void);
 extern void COM_Init_Commands(void);
 extern void FS_Init_Commands(void);
-extern void COM_CheckRegistered(void);
 extern qboolean host_stuffcmdsrun;
 
 /*
@@ -854,6 +875,9 @@ static void Host_Init (void)
        int i;
        const char* os;
 
+       // LordHavoc: quake never seeded the random number generator before... heh
+       srand(time(NULL));
+
        // FIXME: this is evil, but possibly temporary
 // COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
        if (COM_CheckParm("-developer"))
@@ -872,20 +896,28 @@ static void Host_Init (void)
                developer_memorydebug.string = "100";
        }
 
-       // LordHavoc: quake never seeded the random number generator before... heh
-       srand(time(NULL));
+// COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
+       if (COM_CheckParm("-nostdout"))
+               sys_nostdout = 1;
 
        // used by everything
        Memory_Init();
 
-       // initialize console and logging
-       Con_Init();
-
        // initialize console command/cvar/alias/command execution systems
        Cmd_Init();
 
-       // parse commandline
-       COM_InitArgv();
+       // initialize memory subsystem cvars/commands
+       Memory_Init_Commands();
+
+       // initialize console and logging and its cvars/commands
+       Con_Init();
+
+       // initialize various cvars that could not be initialized earlier
+       Curl_Init_Commands();
+       Cmd_Init_Commands();
+       Sys_Init_Commands();
+       COM_Init_Commands();
+       FS_Init_Commands();
 
        // initialize console window (only used by sys_win.c)
        Sys_InitConsole();
@@ -912,29 +944,14 @@ static void Host_Init (void)
        os = "Unknown";
 #endif
        dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
+       Con_Printf("%s\n", engineversion);
 
-// COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
-       if (COM_CheckParm("-nostdout"))
-               sys_nostdout = 1;
-       else
-               Con_Printf("%s\n", engineversion);
+       // initialize ixtable
+       Mathlib_Init();
 
        // initialize filesystem (including fs_basedir, fs_gamedir, -path, -game, scr_screenshot_name)
        FS_Init();
 
-       // initialize various cvars that could not be initialized earlier
-       Memory_Init_Commands();
-       Con_Init_Commands();
-       Curl_Init_Commands();
-       Cmd_Init_Commands();
-       Sys_Init_Commands();
-       COM_Init_Commands();
-       FS_Init_Commands();
-       COM_CheckRegistered();
-
-       // initialize ixtable
-       Mathlib_Init();
-
        NetConn_Init();
        Curl_Init();
        //PR_Init();