]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
host, csqc: Remove cl.csqc_paused. Use new global host.paused instead.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jul 2020 16:00:11 +0000 (16:00 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jul 2020 16:00:11 +0000 (16:00 +0000)
This removes some client/server-only code in the client/server frames.
This also cleans up the cl struct a bit by only having one source of
knowing if we should pause for both CSQC and opening the console or menu

These changes will help eventually move the client and server frame code
to their own functions (CL_Frame and SV_Frame respectively).

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

cl_screen.c
client.h
clvm_cmds.c
host.c
quakedef.h
sv_main.c

index ac6b64307b41311c3786b0a6cd9f5e25bed906b7..208b6303668ee24438b6d07cefb792868c349f3f 100644 (file)
@@ -2259,6 +2259,14 @@ static void SCR_DrawScreen (void)
                if ((key_dest == key_game || key_dest == key_message) && !r_letterbox.value && !scr_loading)
                        Con_DrawNotify ();      // only draw notify in game
 
+       if(cl.islocalgame)
+       {
+               if (key_dest != key_game || key_consoleactive)
+                       host.paused = true;
+               else
+                       host.paused = false;
+       }
+       
        if (cls.signon == SIGNONS)
        {
                SCR_DrawNet ();
index 885b234bfabb3765325cb69ac41e1e7d6e7b32e2..7050932da3cc67f5b677e858fcfb7960a5b02d94 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1158,7 +1158,6 @@ typedef struct client_state_s
        float sensitivityscale;
        csqc_vidvars_t csqc_vidvars;    //[515]: these parms must be set to true by default
        qboolean csqc_wantsmousemove;
-       qboolean csqc_paused; // vortex: int because could be flags
        struct model_s *csqc_model_precache[MAX_MODELS];
 
        // local amount for smoothing stepups
index 987862d69cb1c333e5699081b9fc1f3e4c586e9d..a216cf7ffbaad02da24a5d08d70472ec35cfef3a 100644 (file)
@@ -1414,10 +1414,13 @@ static void VM_CL_boxparticles (prvm_prog_t *prog)
 static void VM_CL_setpause(prvm_prog_t *prog)
 {
        VM_SAFEPARMCOUNT(1, VM_CL_setpause);
-       if ((int)PRVM_G_FLOAT(OFS_PARM0) != 0)
-               cl.csqc_paused = true;
-       else
-               cl.csqc_paused = false;
+       if(cl.islocalgame)
+       {
+               if ((int)PRVM_G_FLOAT(OFS_PARM0) != 0)
+                       host.paused = true;
+               else
+                       host.paused = false;
+       }
 }
 
 //#343 void(float usecursor) setcursormode (DP_CSQC)
diff --git a/host.c b/host.c
index b134a9234bd1c86a6e1bce5ee08c2c4fc9e32063..18d986299358c85c1e26a06a92dff455c09bb214 100644 (file)
--- a/host.c
+++ b/host.c
@@ -617,7 +617,7 @@ void Host_Main(void)
                        sv.frametime = advancetime * host_timescale.value;
                        if (host_framerate.value)
                                sv.frametime = host_framerate.value;
-                       if (sv.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
+                       if (sv.paused || host.paused)
                                sv.frametime = 0;
 
                        for (framecount = 0;framecount < framelimit && sv_timer > 0;framecount++)
@@ -716,7 +716,7 @@ void Host_Main(void)
                                if (host_framerate.value)
                                        clframetime = host_framerate.value;
 
-                               if (cl.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
+                               if (cl.paused || host.paused)
                                        clframetime = 0;
                        }
 
index 9ade07f699b72e0bfe2d68caa784ede54b888288..3aefc0601459924d400300f61dbeece87a50eeca 100644 (file)
@@ -535,6 +535,7 @@ typedef struct host_s
        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
+       qboolean paused; // global paused state, pauses both client and server
 } host_t;
 
 extern host_t host;
index 5551acb51b9660bf919465bf001445bad0bc9ef8..8750bac1ebbd7e72beff2be32ec688202a234e32 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -4210,7 +4210,7 @@ static int SV_ThreadFunc(void *voiddata)
                        sv.frametime = advancetime * host_timescale.value;
                        if (host_framerate.value)
                                sv.frametime = host_framerate.value;
-                       if (sv.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
+                       if (sv.paused || host.paused)
                                sv.frametime = 0;
 
                        sv_timer -= advancetime;