mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 04:15:34 +00:00
Don't reset the animation when setting the same state
Unless looping is being toggled on.
This commit is contained in:
parent
e0541b52c4
commit
a7b07ee5cf
2 changed files with 13 additions and 4 deletions
|
@ -279,8 +279,7 @@ namespace MWMechanics
|
||||||
newstate = CharState_WalkForward;
|
newstate = CharState_WalkForward;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iter->second.getState() != newstate)
|
iter->second.setState(newstate, true);
|
||||||
iter->second.setState(newstate, true);
|
|
||||||
iter->second.setDirection(dir);
|
iter->second.setDirection(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,8 +215,18 @@ void CharacterController::skipAnim()
|
||||||
|
|
||||||
void CharacterController::setState(CharacterState state, bool loop)
|
void CharacterController::setState(CharacterState state, bool loop)
|
||||||
{
|
{
|
||||||
mState = state;
|
if(mState == state)
|
||||||
mLoop = loop;
|
{
|
||||||
|
// 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)
|
if(mAnimNames.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue