Merge pull request #947 from devnexen/sound_pause_option

Introduces new cvar cl_audiopaused to control if the audio loop
This commit is contained in:
Yamagi 2023-01-08 10:45:55 +01:00 committed by GitHub
commit 6c18d819d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 12 deletions

View file

@ -275,6 +275,8 @@ Set `0` by default.
`-1`: Disable reverb effect,
`>=0`: select predefined effect.
* **cl_audiopaused**: If set to `1` the sounds pause when the game does.
## Graphics (all renderers)
* **cin_force43**: If set to `1` (the default) cinematics are displayed

View file

@ -56,6 +56,7 @@ cvar_t *cl_showclamp;
cvar_t *cl_paused;
cvar_t *cl_loadpaused;
cvar_t *cl_audiopaused;
cvar_t *cl_lightlevel;
cvar_t *cl_r1q2_lightstyle;
@ -516,6 +517,7 @@ CL_InitLocal(void)
cl_timeout = Cvar_Get("cl_timeout", "120", 0);
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);
gl1_stereo = Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE );
gl1_stereo_separation = Cvar_Get( "gl1_stereo_separation", "1", CVAR_ARCHIVE );

View file

@ -305,6 +305,7 @@ extern cvar_t *freelook;
extern cvar_t *cl_lightlevel;
extern cvar_t *cl_paused;
extern cvar_t *cl_loadpaused;
extern cvar_t *cl_audiopaused;
extern cvar_t *cl_timedemo;
extern cvar_t *cl_vwep;
extern cvar_t *horplus;

View file

@ -854,11 +854,12 @@ AL_AddLoopSounds(void)
int num;
entity_state_t *ent;
if ((cls.state != ca_active) || cl_paused->value || !s_ambient->value)
if ((cls.state != ca_active) || (cl_paused->value && cl_audiopaused->value) || !s_ambient->value)
{
return;
}
memset(&sounds, 0, sizeof(int) * MAX_EDICTS);
S_BuildSoundList(sounds);
for (i = 0; i < cl.frame.num_entities; i++)

View file

@ -687,17 +687,8 @@ SDL_AddLoopSounds(void)
int num;
entity_state_t *ent;
if (cl_paused->value)
{
return;
}
if (cls.state != ca_active)
{
return;
}
if (!cl.sound_prepped || !s_ambient->value)
if ((cls.state != ca_active) || (cl_paused->value && cl_audiopaused->value) ||
!cl.sound_prepped || !s_ambient->value)
{
return;
}