1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 03:45:32 +00:00

Better handle animations with a 0-length loop

This commit is contained in:
Chris Robinson 2013-08-19 07:26:42 -07:00
parent 1aa92067c2
commit 3ca4d54bf9

View file

@ -833,7 +833,12 @@ Ogre::Vector3 Animation::runAnimation(float duration)
float timepassed = duration * state.mSpeedMult;
while(state.mPlaying)
{
float targetTime = state.mTime + timepassed;
float targetTime;
if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
goto handle_loop;
targetTime = state.mTime + timepassed;
if(textkey == textkeys.end() || textkey->first > targetTime)
{
if(mNonAccumCtrl && stateiter->first == mAnimationValuePtr[0]->getAnimName())
@ -858,11 +863,10 @@ Ogre::Vector3 Animation::runAnimation(float duration)
if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
{
handle_loop:
state.mLoopCount--;
state.mTime = state.mLoopStartTime;
state.mPlaying = true;
if(state.mTime >= state.mLoopStopTime)
break;
textkey = textkeys.lower_bound(state.mTime);
while(textkey != textkeys.end() && textkey->first <= state.mTime)
@ -870,6 +874,9 @@ Ogre::Vector3 Animation::runAnimation(float duration)
handleTextKey(state, stateiter->first, textkey);
textkey++;
}
if(state.mTime >= state.mLoopStopTime)
break;
}
if(timepassed <= 0.0f)