From 19b0b056e500d5291749f7dcf0646d3c6efc5ea2 Mon Sep 17 00:00:00 2001 From: Alexander Perepechko Date: Thu, 13 Jun 2019 21:42:25 +0000 Subject: [PATCH] Remove spell FX and VFX after playing the death animation (bug #5060) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/actors.cpp | 10 +++++----- apps/openmw/mwmechanics/character.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ab11f95a..a4881cf43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,6 +102,7 @@ Bug #5047: # in cell names sets color Bug #5050: Invalid spell effects are not handled gracefully Bug #5056: Calling Cast function on player doesn't equip the spell but casts it + Bug #5060: Magic effect visuals stop when death animation begins instead of when it ends Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 0317e7dde..5cca894e6 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -551,7 +551,7 @@ namespace MWMechanics void Actors::adjustMagicEffects (const MWWorld::Ptr& creature) { CreatureStats& creatureStats = creature.getClass().getCreatureStats (creature); - if (creatureStats.isDead()) + if (creatureStats.isDeathAnimationFinished()) return; MagicEffects now = creatureStats.getSpells().getMagicEffects(); @@ -1665,10 +1665,6 @@ namespace MWMechanics stats.getActiveSpells().visitEffectSources(soulTrap); } - // Reset magic effects and recalculate derived effects - // One case where we need this is to make sure bound items are removed upon death - stats.modifyMagicEffects(MWMechanics::MagicEffects()); - stats.getActiveSpells().clear(); calculateCreatureStatModifiers(iter->first, 0); if (cls.isEssential(iter->first)) @@ -1680,6 +1676,10 @@ namespace MWMechanics ++mDeathCount[Misc::StringUtils::lowerCase(iter->first.getCellRef().getRefId())]; + // Reset magic effects and recalculate derived effects + // One case where we need this is to make sure bound items are removed upon death + stats.modifyMagicEffects(MWMechanics::MagicEffects()); + stats.getActiveSpells().clear(); // Make sure spell effects are removed purgeSpellEffects(stats.getActorId()); diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index c3eadff59..65013eee9 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2648,7 +2648,7 @@ void CharacterController::updateContinuousVfx() for (std::vector::iterator it = effects.begin(); it != effects.end(); ++it) { - if (mPtr.getClass().getCreatureStats(mPtr).isDead() + if (mPtr.getClass().getCreatureStats(mPtr).isDeathAnimationFinished() || mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(MWMechanics::EffectKey(*it)).getMagnitude() <= 0) mAnimation->removeEffect(*it); }