From 152bdb2f65c29fe30ddb348f2e925227df52d772 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 7 Jan 2023 22:16:35 +0300 Subject: [PATCH] Prevent missing KO animations from cancelling KO --- apps/openmw/mwmechanics/character.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 21e30ec8ac..966ed5a158 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -400,6 +400,9 @@ namespace MWMechanics { if (!mAnimation->isPlaying(mCurrentHit)) { + if (isKnockedOut() && mCurrentHit.empty() && knockout) + return; + mHitState = CharState_None; mCurrentHit.clear(); stats.setKnockedDown(false); @@ -450,18 +453,6 @@ namespace MWMechanics mCurrentHit = chooseRandomGroup(hitStateToAnimGroup(CharState_Hit)); } - if (!mAnimation->hasAnimation(mCurrentHit)) - { - // The hit animation is missing. Reset the current hit state and immediately cancel all states as if the - // animation were instantaneous. - mHitState = CharState_None; - mCurrentHit.clear(); - stats.setKnockedDown(false); - stats.setHitRecovery(false); - resetCurrentIdleState(); - return; - } - // Cancel upper body animations if (isKnockedOut() || isKnockedDown()) { @@ -479,6 +470,12 @@ namespace MWMechanics } } + if (!mAnimation->hasAnimation(mCurrentHit)) + { + mCurrentHit.clear(); + return; + } + mAnimation->play( mCurrentHit, priority, MWRender::Animation::BlendMask_All, true, 1, startKey, stopKey, 0.0f, ~0ul); }