From af12736baf1f3be46ed358dafe487f5710cb1680 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Wed, 10 Aug 2022 12:53:32 +0300 Subject: [PATCH 1/2] Cancel stagger and attack animations simultaneously --- apps/openmw/mwmechanics/character.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 6b091693a6..f93d538ab0 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1483,7 +1483,7 @@ bool CharacterController::updateWeaponState() } mAnimation->play(mCurrentWeapon, priorityWeapon, - MWRender::Animation::BlendMask_All, true, + MWRender::Animation::BlendMask_All, false, 1, startKey, stopKey, 0.0f, 0); mUpperBodyState = UpperBodyState::Casting; @@ -1608,7 +1608,7 @@ bool CharacterController::updateWeaponState() } } - if(!animPlaying) + if(!animPlaying || complete >= 1.f) { if (mUpperBodyState == UpperBodyState::Equipping || mUpperBodyState == UpperBodyState::AttackEnd || @@ -1622,12 +1622,16 @@ bool CharacterController::updateWeaponState() if (mUpperBodyState != UpperBodyState::Equipping && isRecovery()) mAnimation->disable(mCurrentHit); + if (animPlaying) + mAnimation->disable(mCurrentWeapon); + mUpperBodyState = UpperBodyState::WeaponEquipped; } else if (mUpperBodyState == UpperBodyState::Unequipping) mUpperBodyState = UpperBodyState::None; } - else if(complete >= 1.0f && !isRandomAttackAnimation(mCurrentWeapon)) + + if (complete >= 1.0f && !isRandomAttackAnimation(mCurrentWeapon)) { std::string start, stop; switch(mUpperBodyState) @@ -1686,9 +1690,8 @@ bool CharacterController::updateWeaponState() if(!start.empty()) { - bool autodisable = mUpperBodyState == UpperBodyState::AttackEnd; mAnimation->disable(mCurrentWeapon); - mAnimation->play(mCurrentWeapon, priorityWeapon, MWRender::Animation::BlendMask_All, autodisable, weapSpeed, start, stop, 0.0f, 0); + mAnimation->play(mCurrentWeapon, priorityWeapon, MWRender::Animation::BlendMask_All, false, weapSpeed, start, stop, 0.0f, 0); } } else if(complete >= 1.0f && isRandomAttackAnimation(mCurrentWeapon)) From bd7ddada7b47eee6b152a1c7dd45450482c46eee Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Wed, 10 Aug 2022 12:59:41 +0300 Subject: [PATCH 2/2] Cancel stagger when random attack animations end --- apps/openmw/mwmechanics/character.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index f93d538ab0..7e45911d9b 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1697,6 +1697,8 @@ bool CharacterController::updateWeaponState() else if(complete >= 1.0f && isRandomAttackAnimation(mCurrentWeapon)) { clearStateAnimation(mCurrentWeapon); + if (isRecovery()) + mAnimation->disable(mCurrentHit); mUpperBodyState = UpperBodyState::WeaponEquipped; }