From 3ef9b850d7559268eadfbf632d0c4b6831a7cc50 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 18 Sep 2023 10:11:35 +0400 Subject: [PATCH] Repeat title music only in main menu --- apps/openmw/mwsound/soundmanagerimp.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index be8bae20a6..73cfeba3db 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -16,6 +16,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/statemanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwbase/world.hpp" #include "../mwworld/cellstore.hpp" @@ -1135,7 +1136,10 @@ namespace MWSound return; MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); - if (state == MWBase::StateManager::State_NoGame && !isMusicPlaying()) + bool isMainMenu = MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) + && state == MWBase::StateManager::State_NoGame; + + if (isMainMenu && !isMusicPlaying()) { std::string titlefile = "music/special/morrowind title.mp3"; if (mVFS->exists(titlefile)) @@ -1143,7 +1147,7 @@ namespace MWSound } updateSounds(duration); - if (MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame) + if (state != MWBase::StateManager::State_NoGame) { updateRegionSound(duration); updateWaterSound();