@ -59,19 +59,20 @@ int AnimationInfo::GetFrameToUseForRendering() const
float AnimationInfo : : GetAnimationProgress ( ) const
{
int ticksSinceSequenceStarted = TicksSinceSequenceStarted ;
float tickModifier = TickModifier ;
if ( RelevantFramesForDistributing < = 0 ) {
// This logic is used if animation distrubtion is not active (see GetFrameToUseForRendering).
// This logic is used if animation distrib ution is not active (see GetFrameToUseForRendering).
// In this case the variables calculated with animation distribution are not initialized and we have to calculate them on the fly with the given information.
int passedTicks = ( ( CurrentFrame - 1 ) * TicksPerFrame ) + TickCounterOfCurrentFrame ;
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + ( float ) passedTicks ;
float fAnimationFraction = totalTicksForCurrentAnimationSequence / ( float ) ( NumberOfFrames * TicksPerFrame ) ;
return fAnimationFraction ;
ticksSinceSequenceStarted = ( ( CurrentFrame - 1 ) * TicksPerFrame ) + TickCounterOfCurrentFrame ;
tickModifier = 1.f / TicksPerFrame ;
}
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + T icksSinceSequenceStarted;
float fP rogressInAnimationFrames = totalTicksForCurrentAnimationSequence * T ickModifier;
float fAnimationFraction = fP rogressInAnimationFrames / NumberOfFrames ;
return fA nimationFraction;
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + t icksSinceSequenceStarted;
float p rogressInAnimationFrames = totalTicksForCurrentAnimationSequence * t ickModifier;
float animationFraction = p rogressInAnimationFrames / NumberOfFrames ;
return a nimationFraction;
}
void AnimationInfo : : SetNewAnimation ( const CelSprite * celSprite , int numberOfFrames , int ticksPerFrame , AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/ , int numSkippedFrames /*= 0*/ , int distributeFramesBeforeFrame /*= 0*/ )