1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00

Disable sound distortion for player actions in GUI mode

This commit is contained in:
Andrei Kortunov 2017-07-15 10:59:08 +04:00
parent 3b163ce6ce
commit dca8317083

View File

@ -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
);
}
}