1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-28 20:06:41 +00:00

Merge pull request #2833 from Capostrophic/animscale

Cap movement animation playback speed
This commit is contained in:
Andrei Kortunov 2020-05-11 22:09:23 +04:00 committed by GitHub
commit c0dc5eb4df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2289,8 +2289,12 @@ void CharacterController::update(float duration, bool animationOnly)
} }
else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed) else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed)
{ {
float speedmult = speed / mMovementAnimSpeed; // Vanilla caps the played animation speed.
mAnimation->adjustSpeedMult(mCurrentMovement, speedmult); const float maxSpeedMult = 10.f;
const float speedMult = speed / mMovementAnimSpeed;
mAnimation->adjustSpeedMult(mCurrentMovement, std::min(maxSpeedMult, speedMult));
// Make sure the actual speed is the "expected" speed even though the animation is slower
scale *= std::max(1.f, speedMult / maxSpeedMult);
} }
if (!mSkipAnim) if (!mSkipAnim)