diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 37042aaaf..f43324166 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -185,11 +185,9 @@ void AnimationInfo::changeAnimationData(OptionalCelSprite celSprite, int8_t numb this->celSprite = celSprite; } -void AnimationInfo::processAnimation(bool reverseAnimation /*= false*/, bool dontProgressAnimation /*= false*/) +void AnimationInfo::processAnimation(bool reverseAnimation /*= false*/) { tickCounterOfCurrentFrame++; - if (dontProgressAnimation) - return; ticksSinceSequenceStarted_++; if (tickCounterOfCurrentFrame >= ticksPerFrame) { tickCounterOfCurrentFrame = 0; diff --git a/Source/engine/animationinfo.h b/Source/engine/animationinfo.h index 0a9ef99f3..54779a30a 100644 --- a/Source/engine/animationinfo.h +++ b/Source/engine/animationinfo.h @@ -97,7 +97,7 @@ public: * @param reverseAnimation Play the animation backwards (for example is used for "unseen" monster fading) * @param dontProgressAnimation Increase tickCounterOfCurrentFrame but don't change currentFrame */ - void processAnimation(bool reverseAnimation = false, bool dontProgressAnimation = false); + void processAnimation(bool reverseAnimation = false); private: /** diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 116c32a3e..fd1b5ef8a 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -593,7 +593,8 @@ void LoadMonster(LoadHelper *file, Monster &monster) file->Skip(4); // Skip pointer _mAnimData monster.AnimInfo = {}; monster.AnimInfo.ticksPerFrame = file->NextLENarrow(); - monster.AnimInfo.tickCounterOfCurrentFrame = file->NextLENarrow(); + // Ensure that we can increase the tickCounterOfCurrentFrame at least once without overflow (needed for backwards compatibility for sitting gargoyles) + monster.AnimInfo.tickCounterOfCurrentFrame = file->NextLENarrow(1) - 1; monster.AnimInfo.numberOfFrames = file->NextLENarrow(); monster.AnimInfo.currentFrame = file->NextLENarrow(-1); file->Skip(4); // Skip _meflag diff --git a/Source/monster.cpp b/Source/monster.cpp index 3c0a74499..1952cf7f8 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1464,7 +1464,7 @@ bool MonsterRangedSpecialAttack(int monsterId) assert(monsterId >= 0 && monsterId < MaxMonsters); auto &monster = Monsters[monsterId]; - if (monster.AnimInfo.currentFrame == monster.data().mAFNum2 - 1 && monster.AnimInfo.tickCounterOfCurrentFrame == 0) { + if (monster.AnimInfo.currentFrame == monster.data().mAFNum2 - 1 && monster.AnimInfo.tickCounterOfCurrentFrame == 0 && (monster._mAi != AI_MEGA || monster._mVar2 == 0)) { if (AddMissile( monster.position.tile, monster.enemyPosition, @@ -4282,8 +4282,8 @@ void ProcessMonsters() GroupUnity(monster); } } while (raflag); - if (monster._mmode != MonsterMode::Petrified) { - monster.AnimInfo.processAnimation((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0, (monster._mFlags & MFLAG_ALLOW_SPECIAL) != 0); + if (monster._mmode != MonsterMode::Petrified && (monster._mFlags & MFLAG_ALLOW_SPECIAL) == 0) { + monster.AnimInfo.processAnimation((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0); } }