1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 11:53:53 +00:00

Restart idle instantly only after the hit state ends

This commit is contained in:
Alexei Kotov 2022-06-13 23:21:39 +03:00
parent 81e1d72c64
commit 69a1d8ac86
2 changed files with 5 additions and 5 deletions

View file

@ -317,7 +317,7 @@ void CharacterController::resetCurrentDeathState()
mDeathState = CharState_None; mDeathState = CharState_None;
} }
void CharacterController::refreshHitRecoilAnims(CharacterState& idle) void CharacterController::refreshHitRecoilAnims()
{ {
auto& charClass = mPtr.getClass(); auto& charClass = mPtr.getClass();
if (!charClass.isActor()) if (!charClass.isActor())
@ -339,6 +339,7 @@ void CharacterController::refreshHitRecoilAnims(CharacterState& idle)
stats.setKnockedDown(false); stats.setKnockedDown(false);
stats.setHitRecovery(false); stats.setHitRecovery(false);
stats.setBlock(false); stats.setBlock(false);
resetCurrentIdleState();
} }
else if (isKnockedOut()) else if (isKnockedOut())
mAnimation->setLoopingEnabled(mCurrentHit, knockout); mAnimation->setLoopingEnabled(mCurrentHit, knockout);
@ -392,6 +393,7 @@ void CharacterController::refreshHitRecoilAnims(CharacterState& idle)
stats.setKnockedDown(false); stats.setKnockedDown(false);
stats.setHitRecovery(false); stats.setHitRecovery(false);
stats.setBlock(false); stats.setBlock(false);
resetCurrentIdleState();
return; return;
} }
@ -412,8 +414,6 @@ void CharacterController::refreshHitRecoilAnims(CharacterState& idle)
} }
mAnimation->play(mCurrentHit, priority, MWRender::Animation::BlendMask_All, true, 1, startKey, stopKey, 0.0f, ~0ul); mAnimation->play(mCurrentHit, priority, MWRender::Animation::BlendMask_All, true, 1, startKey, stopKey, 0.0f, ~0ul);
idle = CharState_None;
} }
void CharacterController::refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force) void CharacterController::refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force)
@ -755,7 +755,7 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
if (isPersistentAnimPlaying()) if (isPersistentAnimPlaying())
return; return;
refreshHitRecoilAnims(idle); refreshHitRecoilAnims();
refreshJumpAnims(jump, idle, force); refreshJumpAnims(jump, idle, force);
refreshMovementAnims(movement, idle, force); refreshMovementAnims(movement, idle, force);

View file

@ -204,7 +204,7 @@ class CharacterController : public MWRender::Animation::TextKeyListener
void resetCurrentDeathState(); void resetCurrentDeathState();
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false); void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
void refreshHitRecoilAnims(CharacterState& idle); void refreshHitRecoilAnims();
void refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force=false); void refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force=false);
void refreshMovementAnims(CharacterState movement, CharacterState& idle, bool force=false); void refreshMovementAnims(CharacterState movement, CharacterState& idle, bool force=false);
void refreshIdleAnims(CharacterState idle, bool force=false); void refreshIdleAnims(CharacterState idle, bool force=false);