From 446c0a4fa8636c40f0bf95d7679f67dcc0d6e5c8 Mon Sep 17 00:00:00 2001 From: Allofich Date: Wed, 31 Aug 2016 18:25:59 +0900 Subject: [PATCH] Play all of a spell's casting effects --- apps/openmw/mwmechanics/spellcasting.cpp | 50 ++++++++++++------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index b228f6dcd..4478c6bd0 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -880,7 +880,6 @@ namespace MWMechanics inflict(mTarget, mCaster, spell->mEffects, ESM::RT_Touch); } - std::string projectileModel; std::string sound; float speed = 0; @@ -970,36 +969,39 @@ namespace MWMechanics const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Spell *spell = store.get().find(spellid); - const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0); - const ESM::MagicEffect *effect; - effect = store.get().find(effectentry.mEffectID); + for (std::vector::const_iterator iter = spell->mEffects.mList.begin(); + iter != spell->mEffects.mList.end(); ++iter) + { + const ESM::MagicEffect *effect; + effect = store.get().find(iter->mEffectID); - MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster); + MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster); - if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a spell cast vfx - { - const ESM::Static* castStatic; - if (!effect->mCasting.empty()) - castStatic = store.get().find (effect->mCasting); - else - castStatic = store.get().find ("VFX_DefaultCast"); + if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a spell cast vfx + { + const ESM::Static* castStatic; + if (!effect->mCasting.empty()) + castStatic = store.get().find (effect->mCasting); + else + castStatic = store.get().find ("VFX_DefaultCast"); - animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex); - } + animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex); + } - if (!mCaster.getClass().isActor()) - animation->addSpellCastGlow(effect); + if (!mCaster.getClass().isActor()) + animation->addSpellCastGlow(effect); - static const std::string schools[] = { - "alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration" - }; + static const std::string schools[] = { + "alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration" + }; - MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); - if(!effect->mCastSound.empty()) - sndMgr->playSound3D(mCaster, effect->mCastSound, 1.0f, 1.0f); - else - sndMgr->playSound3D(mCaster, schools[effect->mData.mSchool]+" cast", 1.0f, 1.0f); + MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); + if(!effect->mCastSound.empty()) + sndMgr->playSound3D(mCaster, effect->mCastSound, 1.0f, 1.0f); + else + sndMgr->playSound3D(mCaster, schools[effect->mData.mSchool]+" cast", 1.0f, 1.0f); + } } int getEffectiveEnchantmentCastCost(float castCost, const MWWorld::Ptr &actor)