mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
Always reset the idle animation after the landing animation ends
This commit is contained in:
parent
69a1d8ac86
commit
1a646374b0
@ -416,13 +416,15 @@ void CharacterController::refreshHitRecoilAnims()
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force)
|
void CharacterController::refreshJumpAnims(JumpingState jump, bool force)
|
||||||
{
|
{
|
||||||
if (!force && jump == mJumpState && idle == CharState_None)
|
if (!force && jump == mJumpState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (jump == JumpState_None)
|
if (jump == JumpState_None)
|
||||||
{
|
{
|
||||||
|
if (!mCurrentJump.empty())
|
||||||
|
resetCurrentIdleState();
|
||||||
resetCurrentJumpState();
|
resetCurrentJumpState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -431,25 +433,20 @@ void CharacterController::refreshJumpAnims(JumpingState jump, CharacterState& id
|
|||||||
std::string jumpAnimName = "jump" + weapShortGroup;
|
std::string jumpAnimName = "jump" + weapShortGroup;
|
||||||
MWRender::Animation::BlendMask jumpmask = MWRender::Animation::BlendMask_All;
|
MWRender::Animation::BlendMask jumpmask = MWRender::Animation::BlendMask_All;
|
||||||
if (!weapShortGroup.empty() && !mAnimation->hasAnimation(jumpAnimName))
|
if (!weapShortGroup.empty() && !mAnimation->hasAnimation(jumpAnimName))
|
||||||
{
|
|
||||||
jumpAnimName = fallbackShortWeaponGroup("jump", &jumpmask);
|
jumpAnimName = fallbackShortWeaponGroup("jump", &jumpmask);
|
||||||
|
|
||||||
// If we apply jump only for lower body, do not reset idle animations.
|
if (!mAnimation->hasAnimation(jumpAnimName))
|
||||||
// For upper body there will be idle animation.
|
{
|
||||||
if (jumpmask == MWRender::Animation::BlendMask_LowerBody && idle == CharState_None)
|
if (!mCurrentJump.empty())
|
||||||
idle = CharState_Idle;
|
resetCurrentIdleState();
|
||||||
}
|
resetCurrentJumpState();
|
||||||
|
|
||||||
if (!force && jump == mJumpState)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool startAtLoop = (jump == mJumpState);
|
bool startAtLoop = (jump == mJumpState);
|
||||||
mJumpState = jump;
|
mJumpState = jump;
|
||||||
clearStateAnimation(mCurrentJump);
|
clearStateAnimation(mCurrentJump);
|
||||||
|
|
||||||
if (!mAnimation->hasAnimation(jumpAnimName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
mCurrentJump = jumpAnimName;
|
mCurrentJump = jumpAnimName;
|
||||||
if(mJumpState == JumpState_InAir)
|
if(mJumpState == JumpState_InAir)
|
||||||
mAnimation->play(jumpAnimName, Priority_Jump, jumpmask, false, 1.0f, startAtLoop ? "loop start" : "start", "stop", 0.f, ~0ul);
|
mAnimation->play(jumpAnimName, Priority_Jump, jumpmask, false, 1.0f, startAtLoop ? "loop start" : "start", "stop", 0.f, ~0ul);
|
||||||
@ -756,7 +753,7 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
refreshHitRecoilAnims();
|
refreshHitRecoilAnims();
|
||||||
refreshJumpAnims(jump, idle, force);
|
refreshJumpAnims(jump, force);
|
||||||
refreshMovementAnims(movement, idle, force);
|
refreshMovementAnims(movement, idle, force);
|
||||||
|
|
||||||
// idle handled last as it can depend on the other states
|
// idle handled last as it can depend on the other states
|
||||||
@ -2071,9 +2068,6 @@ void CharacterController::update(float duration)
|
|||||||
jumpstate = JumpState_Landing;
|
jumpstate = JumpState_Landing;
|
||||||
vec.z() = 0.0f;
|
vec.z() = 0.0f;
|
||||||
|
|
||||||
// We should reset idle animation during landing
|
|
||||||
clearStateAnimation(mCurrentIdle);
|
|
||||||
|
|
||||||
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
||||||
float healthLost = getFallDamage(mPtr, height);
|
float healthLost = getFallDamage(mPtr, height);
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
|||||||
|
|
||||||
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
void refreshCurrentAnims(CharacterState idle, CharacterState movement, JumpingState jump, bool force=false);
|
||||||
void refreshHitRecoilAnims();
|
void refreshHitRecoilAnims();
|
||||||
void refreshJumpAnims(JumpingState jump, CharacterState& idle, bool force=false);
|
void refreshJumpAnims(JumpingState jump, 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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user