1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 22:45:35 +00:00

Avoid clearing the current weapon animation group if it's still going to be in use

This commit is contained in:
Alexei Kotov 2022-06-17 09:53:13 +00:00 committed by jvoisin
parent 28c97c22b9
commit 0b38e165f7

View file

@ -390,7 +390,8 @@ void CharacterController::refreshHitRecoilAnims()
// Cancel upper body animations // Cancel upper body animations
if (isKnockedOut() || isKnockedDown()) if (isKnockedOut() || isKnockedDown())
{ {
clearStateAnimation(mCurrentWeapon); if (!mCurrentWeapon.empty())
mAnimation->disable(mCurrentWeapon);
if (mUpperBodyState > UpperCharState_WeapEquiped) if (mUpperBodyState > UpperCharState_WeapEquiped)
{ {
mUpperBodyState = UpperCharState_WeapEquiped; mUpperBodyState = UpperCharState_WeapEquiped;
@ -1148,7 +1149,8 @@ bool CharacterController::updateState(CharacterState idle)
if (isStillWeapon && mWeaponType != weaptype && mUpperBodyState > UpperCharState_WeapEquiped) if (isStillWeapon && mWeaponType != weaptype && mUpperBodyState > UpperCharState_WeapEquiped)
{ {
forcestateupdate = true; forcestateupdate = true;
clearStateAnimation(mCurrentWeapon); if (!mCurrentWeapon.empty())
mAnimation->disable(mCurrentWeapon);
mUpperBodyState = UpperCharState_WeapEquiped; mUpperBodyState = UpperCharState_WeapEquiped;
setAttackingOrSpell(false); setAttackingOrSpell(false);
mAnimation->showWeapons(true); mAnimation->showWeapons(true);
@ -1310,7 +1312,8 @@ bool CharacterController::updateState(CharacterState idle)
if (!ammunition && mUpperBodyState > UpperCharState_WeapEquiped) if (!ammunition && mUpperBodyState > UpperCharState_WeapEquiped)
{ {
clearStateAnimation(mCurrentWeapon); if (!mCurrentWeapon.empty())
mAnimation->disable(mCurrentWeapon);
mUpperBodyState = UpperCharState_WeapEquiped; mUpperBodyState = UpperCharState_WeapEquiped;
} }
} }
@ -1591,7 +1594,8 @@ bool CharacterController::updateState(CharacterState idle)
if (mWeaponType > ESM::Weapon::None) if (mWeaponType > ESM::Weapon::None)
mAnimation->showWeapons(true); mAnimation->showWeapons(true);
} }
clearStateAnimation(mCurrentWeapon); if (!mCurrentWeapon.empty())
mAnimation->disable(mCurrentWeapon);
} }
} }