mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 06:09:42 +00:00
Restructure function updateMovementSpeed
This commit is contained in:
parent
23615e653a
commit
5e44dd41eb
1 changed files with 4 additions and 3 deletions
|
@ -318,8 +318,9 @@ namespace MWMechanics
|
|||
if (mSmoothMovement)
|
||||
return;
|
||||
|
||||
CreatureStats &stats = actor.getClass().getCreatureStats(actor);
|
||||
MWMechanics::AiSequence& seq = stats.getAiSequence();
|
||||
const auto& actorClass = actor.getClass();
|
||||
const CreatureStats &stats = actorClass.getCreatureStats(actor);
|
||||
const MWMechanics::AiSequence& seq = stats.getAiSequence();
|
||||
|
||||
if (!seq.isEmpty() && seq.getActivePackage().useVariableSpeed())
|
||||
{
|
||||
|
@ -330,7 +331,7 @@ namespace MWMechanics
|
|||
if (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[1] *= speedCoef;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue