Merged pull request #1666

pull/469/head
Marc Zinnschlag 6 years ago
commit 1cfc1f9bdb

@ -84,6 +84,7 @@
Bug #4563: Fast travel price logic checks destination cell instead of service actor cell Bug #4563: Fast travel price logic checks destination cell instead of service actor cell
Bug #4565: Underwater view distance should be limited Bug #4565: Underwater view distance should be limited
Bug #4573: Player uses headtracking in the 1st-person mode Bug #4573: Player uses headtracking in the 1st-person mode
Bug #4574: Player turning animations are twitchy
Bug #4575: Weird result of attack animation blending with movement animations Bug #4575: Weird result of attack animation blending with movement animations
Bug #4576: Reset of idle animations when attack can not be started Bug #4576: Reset of idle animations when attack can not be started
Feature #2606: Editor: Implemented (optional) case sensitive global search Feature #2606: Editor: Implemented (optional) case sensitive global search

@ -1992,25 +1992,37 @@ void CharacterController::update(float duration)
else if(rot.z() != 0.0f && !sneak && !(mPtr == getPlayer() && MWBase::Environment::get().getWorld()->isFirstPerson())) else if(rot.z() != 0.0f && !sneak && !(mPtr == getPlayer() && MWBase::Environment::get().getWorld()->isFirstPerson()))
{ {
if(rot.z() > 0.0f) if(rot.z() > 0.0f)
{
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight; movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
mAnimation->disable(mCurrentJump);
}
else if(rot.z() < 0.0f) else if(rot.z() < 0.0f)
{
movestate = inwater ? CharState_SwimTurnLeft : CharState_TurnLeft; movestate = inwater ? CharState_SwimTurnLeft : CharState_TurnLeft;
mAnimation->disable(mCurrentJump);
}
} }
} }
mTurnAnimationThreshold -= duration; // Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
if (isTurning()) if (mPtr == getPlayer())
mTurnAnimationThreshold = 0.05f; {
else if (movestate == CharState_None && isTurning() float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
&& mTurnAnimationThreshold > 0) float complete;
bool animPlaying = mAnimation->getInfo(mCurrentMovement, &complete);
if (movestate == CharState_None && isTurning())
{
if (animPlaying && complete < threshold)
movestate = mMovementState;
}
}
else
{ {
movestate = mMovementState; mTurnAnimationThreshold -= duration;
if (movestate == CharState_TurnRight || movestate == CharState_TurnLeft ||
movestate == CharState_SwimTurnRight || movestate == CharState_SwimTurnLeft)
{
mTurnAnimationThreshold = 0.05f;
}
else if (movestate == CharState_None && isTurning()
&& mTurnAnimationThreshold > 0)
{
movestate = mMovementState;
}
} }
if(movestate != CharState_None && !isTurning()) if(movestate != CharState_None && !isTurning())
@ -2040,8 +2052,10 @@ void CharacterController::update(float duration)
if (isTurning()) if (isTurning())
{ {
// Adjust animation speed from 1.0 to 1.5 multiplier
float turnSpeed = std::min(1.5f, std::abs(rot.z()) / duration / static_cast<float>(osg::PI));
if (duration > 0) if (duration > 0)
mAnimation->adjustSpeedMult(mCurrentMovement, std::min(1.5f, std::abs(rot.z()) / duration / static_cast<float>(osg::PI))); mAnimation->adjustSpeedMult(mCurrentMovement, std::max(turnSpeed, 1.0f));
} }
else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed) else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed)
{ {

@ -31,8 +31,10 @@ enum Priority {
Priority_WeaponLowerBody, Priority_WeaponLowerBody,
Priority_SneakIdleLowerBody, Priority_SneakIdleLowerBody,
Priority_SwimIdle, Priority_SwimIdle,
Priority_Jump,
Priority_Movement, Priority_Movement,
// Note: in vanilla movement anims have higher priority than jump ones.
// It causes issues with landing animations during movement.
Priority_Jump,
Priority_Hit, Priority_Hit,
Priority_Weapon, Priority_Weapon,
Priority_Block, Priority_Block,

Loading…
Cancel
Save