1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-02 20:39:42 +00:00

Repeat title music only in main menu

This commit is contained in:
Andrei Kortunov 2023-09-18 10:11:35 +04:00
parent 18b6eba709
commit 3ef9b850d7

View file

@ -16,6 +16,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/statemanager.hpp" #include "../mwbase/statemanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
@ -1135,7 +1136,10 @@ namespace MWSound
return; return;
MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); 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"; std::string titlefile = "music/special/morrowind title.mp3";
if (mVFS->exists(titlefile)) if (mVFS->exists(titlefile))
@ -1143,7 +1147,7 @@ namespace MWSound
} }
updateSounds(duration); updateSounds(duration);
if (MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame) if (state != MWBase::StateManager::State_NoGame)
{ {
updateRegionSound(duration); updateRegionSound(duration);
updateWaterSound(); updateWaterSound();