Implement SwimHit animation

This commit is contained in:
Andrei Kortunov 2017-09-22 15:49:42 +04:00
parent 3eb1308c0d
commit 1c6cfad3cc
2 changed files with 22 additions and 4 deletions

View file

@ -283,13 +283,23 @@ void CharacterController::refreshHitRecoilAnims()
}
else if (recovery)
{
std::string anim = chooseRandomGroup("hit");
if (mAnimation->hasAnimation(anim))
std::string anim = isSwimming ? chooseRandomGroup("swimhit") : chooseRandomGroup("hit");
if (isSwimming && mAnimation->hasAnimation(anim))
{
mHitState = CharState_Hit;
mHitState = CharState_SwimHit;
mCurrentHit = anim;
mAnimation->play(mCurrentHit, Priority_Hit, MWRender::Animation::BlendMask_All, true, 1, "start", "stop", 0.0f, 0);
}
else
{
anim = chooseRandomGroup("hit");
if (mAnimation->hasAnimation(anim))
{
mHitState = CharState_Hit;
mCurrentHit = anim;
mAnimation->play(mCurrentHit, Priority_Hit, MWRender::Animation::BlendMask_All, true, 1, "start", "stop", 0.0f, 0);
}
}
}
else if (block && mAnimation->hasAnimation("shield"))
{
@ -1157,7 +1167,7 @@ bool CharacterController::updateWeaponState()
mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell;
if(weaptype != mWeaponType && !isKnockedOut() &&
!isKnockedDown() && mHitState != CharState_Hit)
!isKnockedDown() && !isRecovery())
{
forcestateupdate = true;
@ -2267,6 +2277,12 @@ bool CharacterController::isKnockedOut() const
mHitState == CharState_SwimKnockOut;
}
bool CharacterController::isRecovery() const
{
return mHitState == CharState_Hit ||
mHitState == CharState_SwimHit;
}
bool CharacterController::isAttackingOrSpell() const
{
return mUpperBodyState != UpperCharState_Nothing &&

View file

@ -103,6 +103,7 @@ enum CharacterState {
CharState_DeathKnockOut,
CharState_Hit,
CharState_SwimHit,
CharState_KnockDown,
CharState_KnockOut,
CharState_SwimKnockDown,
@ -271,6 +272,7 @@ public:
bool isReadyToBlock() const;
bool isKnockedDown() const;
bool isKnockedOut() const;
bool isRecovery() const;
bool isSneaking() const;
bool isRunning() const;
bool isAttackingOrSpell() const;