1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Don't count as running if not actually moving along (local) X/Y

This commit is contained in:
Chris Robinson 2013-08-09 06:53:07 -07:00
parent c2d8eb377f
commit a28c36de17

View file

@ -676,28 +676,12 @@ void CharacterController::update(float duration, Movement &movement)
Ogre::Vector3 rot = cls.getRotationVector(mPtr);
mMovementSpeed = cls.getSpeed(mPtr);
// advance athletics
if(vec.squaredLength() > 0 && mPtr.getRefData().getHandle() == "player")
{
if(inwater)
{
mSecondsOfSwimming += duration;
while(mSecondsOfSwimming > 1)
{
cls.skillUsageSucceeded(mPtr, ESM::Skill::Athletics, 1);
mSecondsOfSwimming -= 1;
}
}
else if(isrunning)
{
mSecondsOfRunning += duration;
while(mSecondsOfRunning > 1)
{
cls.skillUsageSucceeded(mPtr, ESM::Skill::Athletics, 0);
mSecondsOfRunning -= 1;
}
}
}
CharacterState movestate = CharState_None;
CharacterState idlestate = CharState_SpecialIdle;
bool forcestateupdate = false;
vec.x *= mMovementSpeed;
vec.y *= mMovementSpeed;
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except
* for the initial thrust (which would be carried by "physics" until landing). */
@ -721,12 +705,30 @@ void CharacterController::update(float duration, Movement &movement)
//decrease fatigue by fFatigueJumpBase + (1 - normalizedEncumbrance) * fFatigueJumpMult;
}
vec.x *= mMovementSpeed;
vec.y *= mMovementSpeed;
isrunning = isrunning && std::abs(vec[0])+std::abs(vec[1]) > 0.0f;
CharacterState movestate = CharState_None;
CharacterState idlestate = CharState_SpecialIdle;
bool forcestateupdate = false;
// advance athletics
if(std::abs(vec[0])+std::abs(vec[1]) > 0.0f && mPtr.getRefData().getHandle() == "player")
{
if(inwater)
{
mSecondsOfSwimming += duration;
while(mSecondsOfSwimming > 1)
{
cls.skillUsageSucceeded(mPtr, ESM::Skill::Athletics, 1);
mSecondsOfSwimming -= 1;
}
}
else if(isrunning)
{
mSecondsOfRunning += duration;
while(mSecondsOfRunning > 1)
{
cls.skillUsageSucceeded(mPtr, ESM::Skill::Athletics, 0);
mSecondsOfRunning -= 1;
}
}
}
if(std::abs(vec.x/2.0f) > std::abs(vec.y))
{