]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
host: Add "restless" variable to host_t. True means don't sleep (timedemo, etc)
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jul 2020 16:00:10 +0000 (16:00 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jul 2020 16:00:10 +0000 (16:00 +0000)
This is meant to reduce client code in the common Host_Main.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12798 d7cf8633-e32d-0410-b094-e92efae38249

cl_demo.c
cl_main.c
host.c
quakedef.h

index 56c301b38a6c3a4f4f184f6751ea9466b5608c05..b8445419514a6fcaab6394828c46f86319edde8a 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -499,7 +499,7 @@ static void CL_FinishTimeDemo (void)
        static int benchmark_runs = 0;
        char vabuf[1024];
 
-       cls.timedemo = false;
+       cls.timedemo = host.restless = false;
 
        frames = cls.td_frames;
        time = host.realtime - cls.td_starttime;
@@ -614,7 +614,7 @@ void CL_TimeDemo_f(cmd_state_t *cmd)
        key_consoleactive = 0;
        scr_con_current = 0;
 
-       cls.timedemo = true;
+       cls.timedemo = host.restless = true;
        cls.td_frames = -2;             // skip the first frame
        cls.demonum = -1;               // stop demo loop
 }
index c03ff082eed865106b5265008e07f9d613194027..3424e67c14bc663f1eb7a4f169f430c5bbebb9f3 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -403,7 +403,7 @@ void CL_Disconnect(void)
        cls.state = ca_disconnected;
        cl.islocalgame = false;
 
-       cls.demoplayback = cls.timedemo = false;
+       cls.demoplayback = cls.timedemo = host.restless = false;
        cls.signon = 0;
 
        // If we're dropped mid-connection attempt, it won't clear otherwise.
diff --git a/host.c b/host.c
index 3812d49838c98272c92f3810b420bbc26964ecbb..b134a9234bd1c86a6e1bce5ee08c2c4fc9e32063 100644 (file)
--- a/host.c
+++ b/host.c
@@ -407,6 +407,8 @@ void Host_Main(void)
        char vabuf[1024];
        qboolean playing;
 
+       host.restless = false;
+
        Host_Init();
 
        host.realtime = 0;
@@ -518,7 +520,7 @@ void Host_Main(void)
                else
                        wait = max(cl_timer, sv_timer) * -1000000.0;
 
-               if (!cls.timedemo && wait >= 1)
+               if (!host.restless && wait >= 1)
                {
                        double time0, delta;
 
index da2673453195490d70f56ba2f3d6b38460455eec..9ade07f699b72e0bfe2d68caa784ede54b888288 100644 (file)
@@ -534,6 +534,7 @@ typedef struct host_s
        int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f)
        double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping
        double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
+       qboolean restless; // don't sleep
 } host_t;
 
 extern host_t host;