From a7bca3a1ec6d8b8fe2cedbc3a90009ffefa43a27 Mon Sep 17 00:00:00 2001 From: staphen Date: Mon, 17 Jan 2022 22:38:45 -0500 Subject: [PATCH] Extend window focus mute to cinematic audio --- Source/diablo.cpp | 5 ++++- Source/storm/storm_svid.cpp | 16 ++++++++++++++++ Source/storm/storm_svid.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 4e2a59dff..0c34703d6 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -63,6 +63,7 @@ #include "sound.h" #include "stores.h" #include "storm/storm_net.hpp" +#include "storm/storm_svid.h" #include "themes.h" #include "town.h" #include "towners.h" @@ -1829,7 +1830,7 @@ bool MinimizePaused = false; void diablo_focus_pause() { - if (gbIsMultiplayer || MinimizePaused) { + if (!movie_playing && (gbIsMultiplayer || MinimizePaused)) { return; } @@ -1841,6 +1842,7 @@ void diablo_focus_pause() LastMouseButtonAction = MouseActionType::None; } + SVidMute(); music_mute(); MinimizePaused = true; @@ -1852,6 +1854,7 @@ void diablo_focus_unpause() PauseMode = 0; } + SVidUnmute(); music_unmute(); MinimizePaused = false; diff --git a/Source/storm/storm_svid.cpp b/Source/storm/storm_svid.cpp index 77c170436..f6a442d21 100644 --- a/Source/storm/storm_svid.cpp +++ b/Source/storm/storm_svid.cpp @@ -393,4 +393,20 @@ void SVidPlayEnd() #endif } +void SVidMute() +{ +#ifndef NOSOUND + if (SVidAudioStream) + SVidAudioStream->mute(); +#endif +} + +void SVidUnmute() +{ +#ifndef NOSOUND + if (SVidAudioStream) + SVidAudioStream->unmute(); +#endif +} + } // namespace devilution diff --git a/Source/storm/storm_svid.h b/Source/storm/storm_svid.h index 54d82e89c..d0b272936 100644 --- a/Source/storm/storm_svid.h +++ b/Source/storm/storm_svid.h @@ -5,5 +5,7 @@ namespace devilution { bool SVidPlayBegin(const char *filename, int flags); bool SVidPlayContinue(); void SVidPlayEnd(); +void SVidMute(); +void SVidUnmute(); } // namespace devilution