diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index fa930cb52..09794d15f 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1979,24 +1979,24 @@ void CharacterController::update(float duration, bool animationOnly) osg::Vec3f rot = cls.getRotationVector(mPtr); speed = cls.getSpeed(mPtr); + float analogueMult = 1.f; if(isPlayer) { - // Joystick anologue movement. + // Joystick analogue movement. float xAxis = std::abs(cls.getMovementSettings(mPtr).mPosition[0]); float yAxis = std::abs(cls.getMovementSettings(mPtr).mPosition[1]); - float analogueMovement = ((xAxis > yAxis) ? xAxis : yAxis); + analogueMult = ((xAxis > yAxis) ? xAxis : yAxis); // If Strafing, our max speed is slower so multiply by X axis instead. if(std::abs(vec.x()/2.0f) > std::abs(vec.y())) - analogueMovement = xAxis; + analogueMult = xAxis; // Due to the half way split between walking/running, we multiply speed by 2 while walking, unless a keyboard was used. - if(!isrunning && !sneak && !flying && analogueMovement <= 0.5f) - speed *= 2; - - speed *= (analogueMovement); + if(!isrunning && !sneak && !flying && analogueMult <= 0.5f) + analogueMult *= 2.f; } + speed *= analogueMult; vec.x() *= speed; vec.y() *= speed; @@ -2063,6 +2063,7 @@ void CharacterController::update(float duration, bool animationOnly) } } fatigueLoss *= duration; + fatigueLoss *= analogueMult; DynamicStat fatigue = cls.getCreatureStats(mPtr).getFatigue(); if (!godmode)