engine: client: fix sounds being paused in menu and then blasted all at the same time in multiplayer

This commit is contained in:
Alibek Omarov 2024-05-06 00:41:38 +03:00
parent 433e7de686
commit da578f47f1
2 changed files with 8 additions and 1 deletions

View File

@ -70,6 +70,12 @@ float S_GetMasterVolume( void )
return 0.0f;
}
if( s_listener.inmenu && !ui_renderworld.value && !Host_IsLocalGame( ))
{
// mute sounds in menu when it's not transparent and we're in multiplayer
return 0.0f;
}
if( !s_listener.inmenu && soundfade.percent != 0 )
{
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );

View File

@ -523,6 +523,7 @@ static void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate
wavdata_t *pSource;
int i, sampleCount;
qboolean bZeroVolume;
qboolean local = Host_IsLocalGame();
// mix each channel into paintbuffer
ch = channels;
@ -549,7 +550,7 @@ static void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate
{
// play, playvol
}
else if(( s_listener.inmenu || s_listener.paused ) && !ch->localsound )
else if(( s_listener.inmenu || s_listener.paused ) && !ch->localsound && local )
{
// play only local sounds, keep pause for other
continue;