1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-25 21:41:04 +00:00

Apply particle textures like original engine does

This commit is contained in:
Allofich 2016-09-08 18:43:26 +09:00
parent 85349da26c
commit bca477ca8a
3 changed files with 22 additions and 10 deletions

View File

@ -543,8 +543,9 @@ namespace MWMechanics
std::string texture = "";
// Use particle textures for non-harmful effects
if (!magicEffect->mParticle.empty() && !(magicEffect->mData.mFlags & ESM::MagicEffect::Harmful))
// TODO: Choosing whether to apply the override texture should be chosen based on nodes in the .NIF file.
if (magicEffect->mHit.empty() || magicEffect->mHit == "VFX_DefaultHit" || magicEffect->mHit == "VFX_MysticismHit"
|| magicEffect->mHit == "VFX_SoulTrapHit")
texture = magicEffect->mParticle;
// TODO: VFX are no longer active after saving/reloading the game
@ -939,12 +940,18 @@ namespace MWMechanics
if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a spell cast vfx
{
const ESM::Static* castStatic;
std::string texture = "";
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);
// TODO: Choosing whether to apply the override texture should be chosen based on nodes in the .NIF file.
if (effect->mCasting.empty() || effect->mCasting == "VFX_DefaultCast" || effect->mCasting == "VFX_ShieldCast")
texture = effect->mParticle;
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex, false, "", texture);
}
if (!mCaster.getClass().isActor())

View File

@ -79,7 +79,10 @@ namespace
{
const ESM::MagicEffect *magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
effects.mList.begin()->mEffectID);
texture = magicEffect->mParticle;
// TODO: Choosing whether to apply the override texture should be chosen based on nodes in the .NIF file.
if (magicEffect->mBolt.empty() || magicEffect->mBolt == "VFX_DefaultBolt" || magicEffect->mBolt == "VFX_DestructBolt")
texture = magicEffect->mParticle;
}
if (projectileEffects.mList.size() > 1) // insert a VFX_Multiple projectile if there are multiple projectile effects

View File

@ -3163,11 +3163,7 @@ namespace MWWorld
const ESM::MagicEffect* effect = getStore().get<ESM::MagicEffect>().find(effectIt->mEffectID);
if ((effectIt->mArea <= 0 && !ignore.isEmpty() && ignore.getClass().isActor()) || effectIt->mRange != rangeType)
<<<<<<< fe3a033642f21393bc267afa4edcc373c9d5f80b
continue; // Not right range type, or not area effect and hit an actor
=======
continue; // Not right range type
>>>>>>> Use particle texture for "hit" effects
// Spawn the explosion orb effect
const ESM::Static* areaStatic;
@ -3176,13 +3172,19 @@ namespace MWWorld
else
areaStatic = getStore().get<ESM::Static>().find ("VFX_DefaultArea");
std::string texture = "";
// TODO: Choosing whether to apply the override texture should be chosen based on nodes in the .NIF file.
if (effect->mArea.empty() || effect->mArea == "VFX_DefaultArea")
texture = effect->mParticle;
if (effectIt->mArea <= 0)
{
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, "", origin, 1.0f);
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, 1.0f);
continue;
}
else
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, "", origin, static_cast<float>(effectIt->mArea * 2));
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, static_cast<float>(effectIt->mArea * 2));
// Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
static const std::string schools[] = {