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:
parent
23615e653a
commit
5e44dd41eb
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue