From f394209c751b319fe4d01c072bcb659d736e5a62 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 7 Jan 2023 21:10:07 +0000 Subject: [PATCH] introduces a new cl_unpaused_scvis cvar to unpause the cli. --- doc/040_cvarlist.md | 3 +++ src/client/cl_main.c | 2 ++ src/client/header/client.h | 1 + src/client/input/sdl.c | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index e7fa9d44..653cf9f6 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -133,6 +133,9 @@ Set `0` by default. loading. If set to `0` pause mode is never entered, this is the Vanilla Quake II behaviour. +* **cl_unpaused_scvis**: If set to `1` (the default) the client unpause + when the screen becomes visible. + * **cl_r1q2_lightstyle**: Since the first release Yamagi Quake II used the R1Q2 colors for the dynamic lights of rockets. Set to `0` to get the Vanilla Quake II colors. Defaults to `1`. diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 2be1673b..f91da3c9 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -57,6 +57,7 @@ cvar_t *cl_showclamp; cvar_t *cl_paused; cvar_t *cl_loadpaused; cvar_t *cl_audiopaused; +cvar_t *cl_unpaused_scvis; cvar_t *cl_lightlevel; cvar_t *cl_r1q2_lightstyle; @@ -518,6 +519,7 @@ CL_InitLocal(void) cl_paused = Cvar_Get("paused", "0", 0); cl_loadpaused = Cvar_Get("cl_loadpaused", "1", CVAR_ARCHIVE); cl_audiopaused = Cvar_Get("cl_audiopaused", "1", CVAR_ARCHIVE); + cl_unpaused_scvis = Cvar_Get("cl_unpaused_scvis", "1", CVAR_ARCHIVE); gl1_stereo = Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); gl1_stereo_separation = Cvar_Get( "gl1_stereo_separation", "1", CVAR_ARCHIVE ); diff --git a/src/client/header/client.h b/src/client/header/client.h index d199e748..9f57d3d5 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -306,6 +306,7 @@ extern cvar_t *cl_lightlevel; extern cvar_t *cl_paused; extern cvar_t *cl_loadpaused; extern cvar_t *cl_audiopaused; +extern cvar_t *cl_unpaused_scvis; extern cvar_t *cl_timedemo; extern cvar_t *cl_vwep; extern cvar_t *horplus; diff --git a/src/client/input/sdl.c b/src/client/input/sdl.c index 79bb49cc..0ff9fa8a 100644 --- a/src/client/input/sdl.c +++ b/src/client/input/sdl.c @@ -681,6 +681,13 @@ IN_Update(void) // be on another display now! glimp_refreshRate = -1; } + else if (event.window.event == SDL_WINDOWEVENT_SHOWN) + { + if (cl_unpaused_scvis->value > 0) + { + Cvar_SetValue("paused", 0); + } + } else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED || event.window.event == SDL_WINDOWEVENT_HIDDEN) {