From c4d77b6a8b3a8454a2ada65f97ea9b8b0de85b06 Mon Sep 17 00:00:00 2001 From: Allofich <rickywd@gmail.com> Date: Fri, 2 Sep 2016 20:10:13 +0900 Subject: [PATCH] Casting animation comes from the first effect --- apps/openmw/mwmechanics/character.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 782e59696..2c21fb17f 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1236,19 +1236,27 @@ bool CharacterController::updateWeaponState() cast.playSpellCastingEffects(spellid); const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid); - const ESM::ENAMstruct &lasteffect = spell->mEffects.mList.at(spell->mEffects.mList.size() - 1); + + const ESM::ENAMstruct &lastEffect = spell->mEffects.mList.at(spell->mEffects.mList.size() - 1); const ESM::MagicEffect *effect; - effect = store.get<ESM::MagicEffect>().find(lasteffect.mEffectID); + + effect = store.get<ESM::MagicEffect>().find(lastEffect.mEffectID); // use last effect of list for color of VFX_Hands const ESM::Static* castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_Hands"); - if (mAnimation->getNode("Bip01 L Hand")) - mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 L Hand", effect->mParticle); - if (mAnimation->getNode("Bip01 R Hand")) - mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 R Hand", effect->mParticle); + for (int iter = 0; iter < spell->mEffects.mList.size(); ++iter) // play hands vfx for each effect + { + if (mAnimation->getNode("Bip01 L Hand")) + mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 L Hand", effect->mParticle); - switch(lasteffect.mRange) + if (mAnimation->getNode("Bip01 R Hand")) + mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 R Hand", effect->mParticle); + } + + const ESM::ENAMstruct &firstEffect = spell->mEffects.mList.at(0); // first effect used for casting animation + + switch(firstEffect.mRange) { case 0: mAttackType = "self"; break; case 1: mAttackType = "touch"; break;