@ -24,7 +24,7 @@ int AnimationInfo::GetFrameToUseForRendering() const
if ( CurrentFrame > RelevantFramesForDistributing )
return CurrentFrame ;
au to ticksSinceSequenceStarted = ( float ) TicksSinceSequenceStarted ;
flo at ticksSinceSequenceStarted = static_cast < float > ( TicksSinceSequenceStarted ) ;
if ( TicksSinceSequenceStarted < 0 ) {
ticksSinceSequenceStarted = 0.0F ;
Log ( " GetFrameToUseForRendering: Invalid TicksSinceSequenceStarted {} " , TicksSinceSequenceStarted ) ;
@ -34,7 +34,7 @@ int AnimationInfo::GetFrameToUseForRendering() const
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + ticksSinceSequenceStarted ;
// 1 added for rounding reasons. float to int cast always truncate.
int absoluteAnimationFrame = 1 + ( int ) ( totalTicksForCurrentAnimationSequence * TickModifier ) ;
int absoluteAnimationFrame = 1 + static_cast < int > ( totalTicksForCurrentAnimationSequence * TickModifier ) ;
if ( SkippedFramesFromPreviousAnimation > 0 ) {
// absoluteAnimationFrames contains also the Frames from the previous Animation, so if we want to get the current Frame we have to remove them
absoluteAnimationFrame - = SkippedFramesFromPreviousAnimation ;
@ -66,12 +66,12 @@ float AnimationInfo::GetAnimationProgress() const
// This logic is used if animation distribution 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.
ticksSinceSequenceStarted = ( ( CurrentFrame - 1 ) * TicksPerFrame ) + TickCounterOfCurrentFrame ;
tickModifier = 1.f / TicksPerFrame ;
tickModifier = 1.0F / static_cast < float > ( TicksPerFrame ) ;
}
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + ticksSinceSequenceStarted ;
float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick ( ) + static_cast < float > ( ticksSinceSequenceStarted ) ;
float progressInAnimationFrames = totalTicksForCurrentAnimationSequence * tickModifier ;
float animationFraction = progressInAnimationFrames / NumberOfFrames ;
float animationFraction = progressInAnimationFrames / static_cast < float > ( NumberOfFrames ) ;
return animationFraction ;
}
@ -153,10 +153,10 @@ void AnimationInfo::SetNewAnimation(const CelSprite *celSprite, int numberOfFram
relevantAnimationTicksForDistribution + = ( SkippedFramesFromPreviousAnimation * ticksPerFrame ) ;
// if we skipped Frames we need to expand the game ticks to make one game tick for this Animation "faster"
float tickModifier = ( float ) relevantAnimationTicksForDistribution / ( float ) relevantAnimationTicksWithSkipping ;
float tickModifier = static_cast < float > ( relevantAnimationTicksForDistribution ) / static_cast < float > ( relevantAnimationTicksWithSkipping ) ;
// tickModifier specifies the Animation fraction per game tick, so we have to remove the delay from the variable
tickModifier / = ticksPerFrame ;
tickModifier / = static_cast < float > ( ticksPerFrame ) ;
RelevantFramesForDistributing = relevantAnimationFramesForDistributing ;
TickModifier = tickModifier ;
@ -208,7 +208,7 @@ void AnimationInfo::ProcessAnimation(bool reverseAnimation /*= false*/, bool don
float AnimationInfo : : GetProgressToNextGameTick ( ) const
{
if ( IsPetrified )
return 0.0 ;
return 0.0F ;
return gfProgressToNextGameTick ;
}