Support playgroup mode 0

actorid
Chris Robinson 13 years ago
parent 13ab2baef0
commit 9f0c1eeb7b

@ -120,13 +120,14 @@ void Animation::playGroup(std::string groupname, int mode, int loops)
else if(!findGroupTimes(groupname, &times)) else if(!findGroupTimes(groupname, &times))
throw std::runtime_error("Failed to find animation group "+groupname); throw std::runtime_error("Failed to find animation group "+groupname);
// FIXME: mode = 0 not yet supported if(mode == 0 && mCurGroup.mLoops > 0)
if(mode == 0) mNextGroup = times;
mode = 1; else
{
mCurGroup = times; mCurGroup = times;
mNextGroup = GroupTimes();
mTime = ((mode==1) ? mCurGroup.mStart : mCurGroup.mLoopStart); mTime = ((mode==2) ? mCurGroup.mLoopStart : mCurGroup.mStart);
}
} }
void Animation::skipAnim() void Animation::skipAnim()
@ -148,8 +149,12 @@ void Animation::runAnimation(float timepassed)
} }
else if(mTime >= mCurGroup.mStop) else if(mTime >= mCurGroup.mStop)
{ {
mCurGroup.mLoops--; if(mNextGroup.mLoops > 0)
mTime = mCurGroup.mStop; mTime = mTime - mCurGroup.mStop + mNextGroup.mStart;
else
mTime = mCurGroup.mStop;
mCurGroup = mNextGroup;
mNextGroup = GroupTimes();
} }
} }

@ -35,6 +35,7 @@ protected:
float mTime; float mTime;
GroupTimes mCurGroup; GroupTimes mCurGroup;
GroupTimes mNextGroup;
bool mSkipFrame; bool mSkipFrame;

Loading…
Cancel
Save