diff --git a/src/cvars.cpp b/src/cvars.cpp index 9d53d533b..e20014c2c 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -420,7 +420,11 @@ consvar_t cv_bgaudio = Player("bgaudio", "Nothing").onchange_noinit(BGAudio_OnCh {0, "Nothing"}, {1, "Music"}, {2, "Sounds"}, + {4, "Voices"}, {3, "Music&Sounds"}, + {5, "Music&Voices"}, + {6, "Sounds&Voices"}, + {7, "MusicSounds&Voices"} }); // Pause game upon window losing focus diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a28754c77..7d3fbfe60 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5396,7 +5396,7 @@ static void PT_HandleVoiceClient(SINT8 node, boolean isserver) { continue; } - if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0]) + if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0] && !g_voice_disabled) { S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), false); } @@ -5410,7 +5410,7 @@ static void PT_HandleVoiceClient(SINT8 node, boolean isserver) return; } - if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0]) + if (cv_voice_selfdeafen.value != 1 && playernum != g_localplayers[0] && !g_voice_disabled) { S_QueueVoiceFrameFromPlayer(playernum, (void*)decoded_out, decoded_samples * sizeof(float), terminal); } @@ -7680,7 +7680,7 @@ void NetVoiceUpdate(void) continue; } - if (cv_voice_selfdeafen.value == 1) + if (cv_voice_selfdeafen.value == 1 || g_voice_disabled) { continue; } diff --git a/src/k_grandprix.cpp b/src/k_grandprix.cpp index 7891306b2..f994f786c 100644 --- a/src/k_grandprix.cpp +++ b/src/k_grandprix.cpp @@ -858,7 +858,12 @@ void K_RetireBots(void) std::stable_sort(humans.begin(), humans.end(), CompareReplacements); std::stable_sort(bots.begin(), bots.end(), CompareReplacements); - if (G_GametypeHasSpectators() == true && grandprixinfo.gp == false && cv_shuffleloser.value != 0) + // If a player spectated mid-race or mid-duel, they will be placed in-game by K_CheckSpectateStatus, + // and their position will be set to 0. Since we're only replacing one player as of now, there's no need + // to do anything; a player has already been replaced. + bool player_already_joined = (!humans.empty() && humans[0]->position == 0); + + if (G_GametypeHasSpectators() == true && grandprixinfo.gp == false && !player_already_joined && cv_shuffleloser.value != 0) { // While joiners and players still exist, insert joiners. diff --git a/src/s_sound.c b/src/s_sound.c index 19afbdf86..2f5218f85 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2858,6 +2858,9 @@ void BGAudio_OnChange(void) if (window_notinfocus && !(cv_bgaudio.value & 2)) S_StopSounds(); + + if (window_notinfocus && !(cv_bgaudio.value & 4)) + g_voice_disabled = true; } @@ -2889,7 +2892,7 @@ void S_QueueVoiceFrameFromPlayer(INT32 playernum, void *data, UINT32 len, boolea { return; } - if (cv_voice_selfdeafen.value != 1) + if (cv_voice_selfdeafen.value != 1 && !g_voice_disabled) { I_QueueVoiceFrameFromPlayer(playernum, data, len, terminal); } diff --git a/src/sdl/i_video.cpp b/src/sdl/i_video.cpp index 4cac6d48d..7fa8e0c3f 100644 --- a/src/sdl/i_video.cpp +++ b/src/sdl/i_video.cpp @@ -523,6 +523,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) window_notinfocus = false; S_SetMusicVolume(); + g_voice_disabled = cv_voice_selfdeafen.value; if (!firsttimeonmouse) { @@ -537,6 +538,8 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) I_SetMusicVolume(0); if (!(cv_bgaudio.value & 2)) S_StopSounds(); + if (!(cv_bgaudio.value & 4)) + g_voice_disabled = true; G_ResetAllDeviceGameKeyDown(); G_ResetAllDeviceResponding();