1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 12:09:41 +00:00

Restructure function updateMovementSpeed

This commit is contained in:
ζeh Matt 2022-03-28 16:20:24 +03:00
parent 23615e653a
commit 5e44dd41eb
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0

View file

@ -318,8 +318,9 @@ namespace MWMechanics
if (mSmoothMovement) if (mSmoothMovement)
return; return;
CreatureStats &stats = actor.getClass().getCreatureStats(actor); const auto& actorClass = actor.getClass();
MWMechanics::AiSequence& seq = stats.getAiSequence(); const CreatureStats &stats = actorClass.getCreatureStats(actor);
const MWMechanics::AiSequence& seq = stats.getAiSequence();
if (!seq.isEmpty() && seq.getActivePackage().useVariableSpeed()) if (!seq.isEmpty() && seq.getActivePackage().useVariableSpeed())
{ {
@ -330,7 +331,7 @@ namespace MWMechanics
if (distance < DECELERATE_DISTANCE) if (distance < DECELERATE_DISTANCE)
{ {
float speedCoef = std::max(0.7f, 0.2f + 0.8f * distance / DECELERATE_DISTANCE); float speedCoef = std::max(0.7f, 0.2f + 0.8f * distance / DECELERATE_DISTANCE);
auto& movement = actor.getClass().getMovementSettings(actor); auto& movement = actorClass.getMovementSettings(actor);
movement.mPosition[0] *= speedCoef; movement.mPosition[0] *= speedCoef;
movement.mPosition[1] *= speedCoef; movement.mPosition[1] *= speedCoef;
} }