From a7f898057ba345d1c06f1f9071f1e067ab02bda4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 17 Sep 2015 04:30:55 +0200 Subject: [PATCH] Don't activate the initial death animation when skipAnim is set (Fixes #2513) --- apps/openmw/mwmechanics/character.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 3837e9a75..e80d6f4d0 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -701,8 +701,9 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim mIdleState = CharState_Idle; else { - int deathindex = mPtr.getClass().getCreatureStats(mPtr).getDeathAnimation(); - playDeath(1.0f, CharacterState(CharState_Death1 + deathindex)); + // Set the death state, but don't play it yet + // We will play it in the first frame, but only if no script set the skipAnim flag + mDeathState = static_cast(CharState_Death1 + mPtr.getClass().getCreatureStats(mPtr).getDeathAnimation()); } } else @@ -1835,6 +1836,13 @@ void CharacterController::update(float duration) } else if(cls.getCreatureStats(mPtr).isDead()) { + // initial start of death animation for actors that started the game as dead + // not done in constructor since we need to give scripts a chance to set the mSkipAnim flag + if (!mSkipAnim && mDeathState != CharState_None && mCurrentDeath.empty()) + { + playDeath(1.f, mDeathState); + } + world->queueMovement(mPtr, osg::Vec3f(0.f, 0.f, 0.f)); }