From dca83170831e66a2b0d088b0ee3a8ee63092e0b1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 10:59:08 +0400 Subject: [PATCH] Disable sound distortion for player actions in GUI mode --- apps/openmw/mwworld/action.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/action.cpp b/apps/openmw/mwworld/action.cpp index 92e959e41f..468207e810 100644 --- a/apps/openmw/mwworld/action.cpp +++ b/apps/openmw/mwworld/action.cpp @@ -4,6 +4,7 @@ #include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -26,9 +27,18 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) { if(!mSoundId.empty() && !noSound) { + MWBase::SoundManager::PlayMode envType = MWBase::SoundManager::Play_Normal; + + // Action sounds should not have a distortion in GUI mode + // example: take an item or drink a potion underwater + if (actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWindowManager()->isGuiMode()) + { + envType = MWBase::SoundManager::Play_NoEnv; + } + if(mKeepSound && actor == MWMechanics::getPlayer()) MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, - MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal, mSoundOffset + MWBase::SoundManager::Play_TypeSfx, envType, mSoundOffset ); else { @@ -37,12 +47,12 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) MWBase::Environment::get().getSoundManager()->playSound3D( (local ? actor : mTarget).getRefData().getPosition().asVec3(), mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); else MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget, mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); } }