Don't reset the animation when setting the same state

Unless looping is being toggled on.
This commit is contained in:
Chris Robinson 2013-01-19 15:44:57 -08:00
parent e0541b52c4
commit a7b07ee5cf
2 changed files with 13 additions and 4 deletions

View file

@ -279,8 +279,7 @@ namespace MWMechanics
newstate = CharState_WalkForward;
}
if(iter->second.getState() != newstate)
iter->second.setState(newstate, true);
iter->second.setState(newstate, true);
iter->second.setDirection(dir);
}

View file

@ -215,8 +215,18 @@ void CharacterController::skipAnim()
void CharacterController::setState(CharacterState state, bool loop)
{
mState = state;
mLoop = loop;
if(mState == state)
{
// If setting the same state again, only reset the animation if looping
// is being turned on.
if(mLoop == loop || !(mLoop=loop))
return;
}
else
{
mState = state;
mLoop = loop;
}
if(mAnimNames.size() == 0)
return;