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 ac6b643..208b630 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 885b234..7050932 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 987862d..a216cf7 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 b134a92..18d9862 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 9ade07f..3aefc06 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 5551acb..8750bac 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;