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); Ogre::Vector3 rot = cls.getRotationVector(mPtr);
mMovementSpeed = cls.getSpeed(mPtr); mMovementSpeed = cls.getSpeed(mPtr);
// advance athletics CharacterState movestate = CharState_None;
if(vec.squaredLength() > 0 && mPtr.getRefData().getHandle() == "player") CharacterState idlestate = CharState_SpecialIdle;
{ bool forcestateupdate = false;
if(inwater)
{ vec.x *= mMovementSpeed;
mSecondsOfSwimming += duration; vec.y *= mMovementSpeed;
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;
}
}
}
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except /* 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). */ * 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; //decrease fatigue by fFatigueJumpBase + (1 - normalizedEncumbrance) * fFatigueJumpMult;
} }
vec.x *= mMovementSpeed; isrunning = isrunning && std::abs(vec[0])+std::abs(vec[1]) > 0.0f;
vec.y *= mMovementSpeed;
CharacterState movestate = CharState_None; // advance athletics
CharacterState idlestate = CharState_SpecialIdle; if(std::abs(vec[0])+std::abs(vec[1]) > 0.0f && mPtr.getRefData().getHandle() == "player")
bool forcestateupdate = false; {
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)) if(std::abs(vec.x/2.0f) > std::abs(vec.y))
{ {