Merge pull request #1333 from akortunov/guidistortionfix

Disable sound distortion for GUI actions and PlaySound command [discussion]
0.6.1
scrawl 8 years ago committed by GitHub
commit 2c95f40640

@ -82,7 +82,7 @@ namespace MWScript
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
MWBase::Environment::get().getSoundManager()->playSound(sound, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv);
}
};
@ -101,7 +101,7 @@ namespace MWScript
Interpreter::Type_Float pitch = runtime[0].mFloat;
runtime.pop();
MWBase::Environment::get().getSoundManager()->playSound (sound, volume, pitch);
MWBase::Environment::get().getSoundManager()->playSound(sound, volume, pitch, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv);
}
};

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

Loading…
Cancel
Save