1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-24 18:39:59 +00:00

Prevent missing KO animations from cancelling KO

This commit is contained in:
Alexei Kotov 2023-01-07 22:16:35 +03:00
parent 6aaceb44c2
commit 152bdb2f65

View File

@ -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);
}