diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index fe77da52b..46f3bdc0d 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -120,13 +120,14 @@ void Animation::playGroup(std::string groupname, int mode, int loops) else if(!findGroupTimes(groupname, ×)) throw std::runtime_error("Failed to find animation group "+groupname); - // FIXME: mode = 0 not yet supported - if(mode == 0) - mode = 1; - - mCurGroup = times; - - mTime = ((mode==1) ? mCurGroup.mStart : mCurGroup.mLoopStart); + if(mode == 0 && mCurGroup.mLoops > 0) + mNextGroup = times; + else + { + mCurGroup = times; + mNextGroup = GroupTimes(); + mTime = ((mode==2) ? mCurGroup.mLoopStart : mCurGroup.mStart); + } } void Animation::skipAnim() @@ -148,8 +149,12 @@ void Animation::runAnimation(float timepassed) } else if(mTime >= mCurGroup.mStop) { - mCurGroup.mLoops--; - mTime = mCurGroup.mStop; + if(mNextGroup.mLoops > 0) + mTime = mTime - mCurGroup.mStop + mNextGroup.mStart; + else + mTime = mCurGroup.mStop; + mCurGroup = mNextGroup; + mNextGroup = GroupTimes(); } } diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index c9b34a4e5..3611d35c0 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -35,6 +35,7 @@ protected: float mTime; GroupTimes mCurGroup; + GroupTimes mNextGroup; bool mSkipFrame;