1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00

Use VFX_DefaultCast / VFX_DefaultHit if the magic effect does not specify any

This commit is contained in:
scrawl 2014-01-11 05:58:05 +01:00
parent ce6aab89cf
commit 3896c88403
3 changed files with 17 additions and 10 deletions

View File

@ -525,7 +525,7 @@ namespace MWMechanics
ref.getPtr().getCellRef().mPos = ipos; ref.getPtr().getCellRef().mPos = ipos;
// TODO: Add AI to follow player and fight for him // TODO: Add AI to follow player and fight for him
// TODO: VFX_SummonStart, VFX_SummonEnd
creatureStats.mSummonedCreatures.insert(std::make_pair(it->first, creatureStats.mSummonedCreatures.insert(std::make_pair(it->first,
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos).getRefData().getHandle())); MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos).getRefData().getHandle()));
} }

View File

@ -592,7 +592,12 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
const ESM::MagicEffect *effect; const ESM::MagicEffect *effect;
effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID); effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID);
const ESM::Static* castStatic = store.get<ESM::Static>().find (effect->mCasting); const ESM::Static* castStatic;
if (!effect->mCasting.empty())
castStatic = store.get<ESM::Static>().find (effect->mCasting);
else
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
mAnimation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex); mAnimation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex);
castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_Hands"); castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_Hands");

View File

@ -200,15 +200,17 @@ namespace MWMechanics
} }
// Add VFX // Add VFX
const ESM::Static* castStatic;
if (!magicEffect->mHit.empty()) if (!magicEffect->mHit.empty())
{ castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find (magicEffect->mHit);
const ESM::Static* castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find (magicEffect->mHit); else
bool loop = magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx; castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_DefaultHit");
// Note: in case of non actor, a free effect should be fine as well
MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(target); bool loop = magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx;
if (anim) // Note: in case of non actor, a free effect should be fine as well
anim->addEffect("meshes\\" + castStatic->mModel, magicEffect->mIndex, loop, ""); MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(target);
} if (anim)
anim->addEffect("meshes\\" + castStatic->mModel, magicEffect->mIndex, loop, "");
} }
// TODO: For Area effects, launch a growing particle effect that applies the effect to more actors as it hits them. Best managed in World. // TODO: For Area effects, launch a growing particle effect that applies the effect to more actors as it hits them. Best managed in World.