Merge branch 'shut_it' into 'master'

Make the Sound magic effect make noise

Closes #6986

See merge request OpenMW/openmw!2369
crashfix_debugdraw
psi29a 2 years ago
commit 8e7cee5861

@ -13,6 +13,7 @@
Bug #6949: Sun Damage effect doesn't work in quasi exteriors
Bug #6964: Nerasa Dralor Won't Follow
Bug #6974: Only harmful effects are reflected
Bug #6986: Sound magic effect does not make noise
Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData
Feature #6979: Add support of loading and displaying LOD assets purely based on their filename extension

@ -530,6 +530,14 @@ void applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster, co
case ESM::MagicEffect::RallyHumanoid:
modifyAiSetting(target, effect, ESM::MagicEffect::RallyCreature, AiSetting::Flee, -effect.mMagnitude, invalid);
break;
case ESM::MagicEffect::Sound:
if(target == getPlayer())
{
const auto& magnitudes = target.getClass().getCreatureStats(target).getMagicEffects();
float volume = std::clamp((magnitudes.get(effect.mEffectId).getModifier() + effect.mMagnitude) / 100.f, 0.f, 1.f);
MWBase::Environment::get().getSoundManager()->playSound3D(target, "magic sound", volume, 1.f, MWSound::Type::Sfx, MWSound::PlayMode::LoopNoEnv);
}
break;
case ESM::MagicEffect::SummonScamp:
case ESM::MagicEffect::SummonClannfear:
case ESM::MagicEffect::SummonDaedroth:
@ -1031,6 +1039,10 @@ void removeMagicEffect(const MWWorld::Ptr& target, ActiveSpells::ActiveSpellPara
case ESM::MagicEffect::RallyHumanoid:
modifyAiSetting(target, effect, ESM::MagicEffect::RallyCreature, AiSetting::Flee, effect.mMagnitude, invalid);
break;
case ESM::MagicEffect::Sound:
if(magnitudes.get(effect.mEffectId).getModifier() <= 0.f && target == getPlayer())
MWBase::Environment::get().getSoundManager()->stopSound3D(target, "magic sound");
break;
case ESM::MagicEffect::SummonScamp:
case ESM::MagicEffect::SummonClannfear:
case ESM::MagicEffect::SummonDaedroth:

Loading…
Cancel
Save