intgameTicksPerFrame=(Delay+1);// How many GameTicks are needed to advance one Animation Frame
intrelevantAnimationGameTicksForDistribution=relevantAnimationFramesForDistributing*gameTicksPerFrame;// GameTicks that will be adjusted for the skipped Frames/GameTicks
// How many GameTicks are needed to advance one Animation Frame
intgameTicksPerFrame=(Delay+1);
// GameTicks that will be adjusted for the skipped Frames/GameTicks
intrelevantAnimationGameTicksWithSkipping=relevantAnimationGameTicksForDistribution-(numSkippedFrames*gameTicksPerFrame);// How many GameTicks will the Animation be really shown (skipped Frames and GameTicks removed)
// If ProcessAnimation will be called after NewPlrAnim (in same GameTick as NewPlrAnim), we increment the Animation-Counter.
// If no delay is specified, this will result in complete skipped frame (see ProcessPlayerAnimation).
@ -608,8 +614,11 @@ void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, Animat
relevantAnimationGameTicksWithSkipping-=Delay;
}
floatgameTickModifier=(float)relevantAnimationGameTicksForDistribution/(float)relevantAnimationGameTicksWithSkipping;// if we skipped Frames we need to expand the GameTicks to make one GameTick for this Animation "faster"
gameTickModifier/=gameTicksPerFrame;// gameTickModifier specifies the Animation fraction per GameTick, so we have to remove the delay from the variable
// if we skipped Frames we need to expand the GameTicks to make one GameTick for this Animation "faster"
floattotalGameTicksForCurrentAnimationSequence=progressToNextGameTick+(float)pPlayer->_pAnimGameTicksSinceSequenceStarted;// we don't use the processed game ticks alone but also the fragtion of the next game tick (if a rendering happens between game ticks). This helps to smooth the animations.
intabsoluteAnimationFrame=1+(int)(totalGameTicksForCurrentAnimationSequence*pPlayer->_pAnimGameTickModifier);// 1 added for rounding reasons. float to int cast always truncate.
if(absoluteAnimationFrame>relevantAnimationFramesForDistributing){// this can happen if we are at the last frame and the next game tick is due (nthread_GetProgressToNextGameTick returns 1.0f)
if(absoluteAnimationFrame>(relevantAnimationFramesForDistributing+1))// we should never have +2 frames even if next game tick is due
// we don't use the processed game ticks alone but also the fragtion of the next game tick (if a rendering happens between game ticks). This helps to smooth the animations.