mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 17:19:39 +00:00
Play all of a spell's casting effects
This commit is contained in:
parent
b4577fe751
commit
446c0a4fa8
1 changed files with 29 additions and 27 deletions
|
@ -880,7 +880,6 @@ namespace MWMechanics
|
||||||
inflict(mTarget, mCaster, spell->mEffects, ESM::RT_Touch);
|
inflict(mTarget, mCaster, spell->mEffects, ESM::RT_Touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string projectileModel;
|
std::string projectileModel;
|
||||||
std::string sound;
|
std::string sound;
|
||||||
float speed = 0;
|
float speed = 0;
|
||||||
|
@ -970,36 +969,39 @@ namespace MWMechanics
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellid);
|
||||||
const ESM::ENAMstruct &effectentry = spell->mEffects.mList.at(0);
|
|
||||||
|
|
||||||
const ESM::MagicEffect *effect;
|
for (std::vector<ESM::ENAMstruct>::const_iterator iter = spell->mEffects.mList.begin();
|
||||||
effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID);
|
iter != spell->mEffects.mList.end(); ++iter)
|
||||||
|
|
||||||
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;
|
const ESM::MagicEffect *effect;
|
||||||
if (!effect->mCasting.empty())
|
effect = store.get<ESM::MagicEffect>().find(iter->mEffectID);
|
||||||
castStatic = store.get<ESM::Static>().find (effect->mCasting);
|
|
||||||
|
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<ESM::Static>().find (effect->mCasting);
|
||||||
|
else
|
||||||
|
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
|
||||||
|
|
||||||
|
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mCaster.getClass().isActor())
|
||||||
|
animation->addSpellCastGlow(effect);
|
||||||
|
|
||||||
|
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
|
else
|
||||||
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
|
sndMgr->playSound3D(mCaster, schools[effect->mData.mSchool]+" cast", 1.0f, 1.0f);
|
||||||
|
|
||||||
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mCaster.getClass().isActor())
|
|
||||||
animation->addSpellCastGlow(effect);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getEffectiveEnchantmentCastCost(float castCost, const MWWorld::Ptr &actor)
|
int getEffectiveEnchantmentCastCost(float castCost, const MWWorld::Ptr &actor)
|
||||||
|
|
Loading…
Reference in a new issue