Play creature movement animation without scaling if a fallback is used (Fixes #1797)

This commit is contained in:
scrawl 2014-08-13 01:53:56 +02:00
parent e2ee3b2497
commit 8ae6796b2f

View file

@ -395,8 +395,19 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
CharacterState walkState = runStateToWalkState(mMovementState); CharacterState walkState = runStateToWalkState(mMovementState);
const StateInfo *stateinfo = std::find_if(sMovementList, sMovementListEnd, FindCharState(walkState)); const StateInfo *stateinfo = std::find_if(sMovementList, sMovementListEnd, FindCharState(walkState));
anim = stateinfo->groupname; anim = stateinfo->groupname;
}
if (mMovementSpeed > 0.0f && (vel=mAnimation->getVelocity(anim)) > 1.0f)
speedmult = mMovementSpeed / vel;
else
// Another bug: when using a fallback animation (e.g. RunForward as fallback to SwimRunForward),
// then the equivalent Walk animation will not use a fallback, and if that animation doesn't exist
// we will play without any scaling.
// Makes the speed attribute of most water creatures totally useless.
// And again, this can not be fixed without patching game data.
speedmult = 1.f;
}
else
{
if(mMovementSpeed > 0.0f && (vel=mAnimation->getVelocity(anim)) > 1.0f) if(mMovementSpeed > 0.0f && (vel=mAnimation->getVelocity(anim)) > 1.0f)
{ {
speedmult = mMovementSpeed / vel; speedmult = mMovementSpeed / vel;
@ -411,6 +422,8 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
speedmult = mMovementSpeed / (isrunning ? 222.857f : 154.064f); speedmult = mMovementSpeed / (isrunning ? 222.857f : 154.064f);
mMovementAnimationControlled = false; mMovementAnimationControlled = false;
} }
}
mAnimation->play(mCurrentMovement, Priority_Movement, movegroup, false, mAnimation->play(mCurrentMovement, Priority_Movement, movegroup, false,
speedmult, ((mode!=2)?"start":"loop start"), "stop", 0.0f, ~0ul); speedmult, ((mode!=2)?"start":"loop start"), "stop", 0.0f, ~0ul);
} }