@ -270,6 +270,7 @@ void CharacterController::refreshHitRecoilAnims()
| | mPtr . getClass ( ) . getCreatureStats ( mPtr ) . getFatigue ( ) . getBase ( ) = = 0 )
& & mAnimation - > hasAnimation ( " knockout " ) )
{
mTimeUntilWake = Misc : : Rng : : rollClosedProbability ( ) * 2 + 1 ; // Wake up after 1 to 3 seconds
if ( isSwimming & & mAnimation - > hasAnimation ( " swimknockout " ) )
{
mHitState = CharState_SwimKnockOut ;
@ -354,7 +355,8 @@ void CharacterController::refreshHitRecoilAnims()
mPtr . getClass ( ) . getCreatureStats ( mPtr ) . setBlock ( false ) ;
mHitState = CharState_None ;
}
else if ( isKnockedOut ( ) & & mPtr . getClass ( ) . getCreatureStats ( mPtr ) . getFatigue ( ) . getCurrent ( ) > 0 )
else if ( isKnockedOut ( ) & & mPtr . getClass ( ) . getCreatureStats ( mPtr ) . getFatigue ( ) . getCurrent ( ) > 0
& & mTimeUntilWake < = 0 )
{
mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown ;
mAnimation - > disable ( mCurrentHit ) ;
@ -388,21 +390,29 @@ void CharacterController::refreshJumpAnims(const WeaponInfo* weap, JumpingState
}
}
if ( mJumpState = = JumpState_InAir )
if ( ! mCurrentJump . empty ( ) )
{
mAnimation - > disable ( mCurrentJump ) ;
mCurrentJump = jumpAnimName ;
if ( mAnimation - > hasAnimation ( " jump " ) )
mAnimation - > play ( mCurrentJump , Priority_Jump , jumpmask , false ,
mCurrentJump . clear ( ) ;
}
if ( mJumpState = = JumpState_InAir )
{
if ( mAnimation - > hasAnimation ( jumpAnimName ) )
{
mAnimation - > play ( jumpAnimName , Priority_Jump , jumpmask , false ,
1.0f , ( startAtLoop ? " loop start " : " start " ) , " stop " , 0.0f , ~ 0ul ) ;
mCurrentJump = jumpAnimName ;
}
}
else
else if ( mJumpState = = JumpState_Landing )
{
mAnimation - > disable ( mCurrentJump ) ;
mCurrentJump . clear ( ) ;
if ( mAnimation - > hasAnimation ( " jump " ) )
if ( mAnimation - > hasAnimation ( jumpAnimName ) )
{
mAnimation - > play ( jumpAnimName , Priority_Jump , jumpmask , true ,
1.0f , " loop stop " , " stop " , 0.0f , 0 ) ;
mCurrentJump = jumpAnimName ;
}
}
}
}
@ -789,6 +799,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
, mSecondsOfRunning ( 0 )
, mTurnAnimationThreshold ( 0 )
, mAttackingOrSpell ( false )
, mTimeUntilWake ( 0.f )
{
if ( ! mAnimation )
return ;
@ -1718,6 +1729,9 @@ void CharacterController::update(float duration)
updateMagicEffects ( ) ;
if ( isKnockedOut ( ) )
mTimeUntilWake - = duration ;
bool godmode = mPtr = = MWMechanics : : getPlayer ( ) & & MWBase : : Environment : : get ( ) . getWorld ( ) - > getGodModeState ( ) ;
if ( ! cls . isActor ( ) )
@ -1810,7 +1824,6 @@ void CharacterController::update(float duration)
mHasMovedInXY = std : : abs ( vec . x ( ) ) + std : : abs ( vec . y ( ) ) > 0.0f ;
isrunning = isrunning & & mHasMovedInXY ;
// advance athletics
if ( mHasMovedInXY & & mPtr = = getPlayer ( ) )
{
@ -1965,7 +1978,8 @@ void CharacterController::update(float duration)
}
else
{
jumpstate = JumpState_None ;
jumpstate = mAnimation - > isPlaying ( mCurrentJump ) ? JumpState_Landing : JumpState_None ;
vec . z ( ) = 0.0f ;
inJump = false ;
@ -1995,9 +2009,15 @@ void CharacterController::update(float duration)
else if ( rot . z ( ) ! = 0.0f & & ! sneak & & ! ( mPtr = = getPlayer ( ) & & MWBase : : Environment : : get ( ) . getWorld ( ) - > isFirstPerson ( ) ) )
{
if ( rot . z ( ) > 0.0f )
{
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight ;
mAnimation - > disable ( mCurrentJump ) ;
}
else if ( rot . z ( ) < 0.0f )
{
movestate = inwater ? CharState_SwimTurnLeft : CharState_TurnLeft ;
mAnimation - > disable ( mCurrentJump ) ;
}
}
}