diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index a99fdcef1..bae4f5fc6 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -166,7 +166,11 @@ void AnimationInfo::ChangeAnimationData(const CelSprite *celSprite, int numberOf { if (numberOfFrames != NumberOfFrames || ticksPerFrame != TicksPerFrame) { // Ensure that the CurrentFrame is still valid and that we disable ADL cause the calculcated values (for example TickModifier) could be wrong - CurrentFrame = clamp(CurrentFrame, 1, numberOfFrames); + if (numberOfFrames >= 1) + CurrentFrame = clamp(CurrentFrame, 1, numberOfFrames); + else + CurrentFrame = 0; + NumberOfFrames = numberOfFrames; TicksPerFrame = ticksPerFrame; TicksSinceSequenceStarted = 0; diff --git a/Source/monster.h b/Source/monster.h index fb6859b4b..779e1e393 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -229,12 +229,8 @@ struct Monster { // note: missing field _mAFNum auto &animationData = this->MType->GetAnimData(graphic); auto &celSprite = animationData.GetCelSpritesForDirection(direction); - if (celSprite) { - // Passing the Frames and Rate properties here is only relevant when initialising a monster, but doesn't cause any harm when switching animations. - this->AnimInfo.ChangeAnimationData(&*celSprite, animationData.Frames, animationData.Rate); - } - // This function is called during level load for some monsters without animations, in those cases AnimInfo is default initialised - // with zero/nullptr values for all the properties ChangeAnimationData would otherwise set. + // Passing the Frames and Rate properties here is only relevant when initialising a monster, but doesn't cause any harm when switching animations. + this->AnimInfo.ChangeAnimationData(celSprite ? &*celSprite : nullptr, animationData.Frames, animationData.Rate); } /**