From cf03adfc67295bfeff10abafc9505090f527ed48 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Mon, 13 Jul 2020 16:00:11 +0000 Subject: [PATCH] host, csqc: Remove cl.csqc_paused. Use new global host.paused instead. 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 | 8 ++++++++ client.h | 1 - clvm_cmds.c | 11 +++++++---- host.c | 4 ++-- quakedef.h | 1 + sv_main.c | 2 +- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index ac6b6430..208b6303 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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 (); diff --git a/client.h b/client.h index 885b234b..7050932d 100644 --- 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 diff --git a/clvm_cmds.c b/clvm_cmds.c index 987862d6..a216cf7f 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -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 b134a923..18d98629 100644 --- 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; } diff --git a/quakedef.h b/quakedef.h index 9ade07f6..3aefc060 100644 --- a/quakedef.h +++ b/quakedef.h @@ -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; diff --git a/sv_main.c b/sv_main.c index 5551acb5..8750bac1 100644 --- 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; -- 2.39.2