diff --git a/Source/dead.cpp b/Source/dead.cpp index dc869aa79..31c6a62c5 100644 --- a/Source/dead.cpp +++ b/Source/dead.cpp @@ -16,7 +16,7 @@ DeadStruct Dead[MaxDead]; int8_t stonendx; namespace { -void InitDeadAnimationFromMonster(DeadStruct &dead, CMonster &mon) +void InitDeadAnimationFromMonster(DeadStruct &dead, const CMonster &mon) { int i = 0; auto &animData = mon.GetAnimData(MonsterGraphic::Death); diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 8a4a5fb43..f16977fad 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -73,7 +73,7 @@ float AnimationInfo::GetAnimationProgress() const return fAnimationFraction; } -void AnimationInfo::SetNewAnimation(CelSprite *celSprite, int numberOfFrames, int ticksPerFrame, AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/, int numSkippedFrames /*= 0*/, int distributeFramesBeforeFrame /*= 0*/) +void AnimationInfo::SetNewAnimation(const CelSprite *celSprite, int numberOfFrames, int ticksPerFrame, AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/, int numSkippedFrames /*= 0*/, int distributeFramesBeforeFrame /*= 0*/) { if ((flags & AnimationDistributionFlags::RepeatedAction) == AnimationDistributionFlags::RepeatedAction && distributeFramesBeforeFrame != 0 && NumberOfFrames == numberOfFrames && CurrentFrame >= distributeFramesBeforeFrame && CurrentFrame != NumberOfFrames) { // We showed the same Animation (for example a melee attack) before but truncated the Animation. @@ -161,7 +161,7 @@ void AnimationInfo::SetNewAnimation(CelSprite *celSprite, int numberOfFrames, in } } -void AnimationInfo::ChangeAnimationData(CelSprite *celSprite, int numberOfFrames, int delayLen) +void AnimationInfo::ChangeAnimationData(const CelSprite *celSprite, int numberOfFrames, int delayLen) { if (numberOfFrames != NumberOfFrames || delayLen != TicksPerFrame) { // Ensure that the CurrentFrame is still valid and that we disable ADL cause the calculcated values (for example TickModifier) could be wrong diff --git a/Source/engine/animationinfo.h b/Source/engine/animationinfo.h index d9b9f0084..66e48a40e 100644 --- a/Source/engine/animationinfo.h +++ b/Source/engine/animationinfo.h @@ -39,7 +39,7 @@ public: /** * @brief Pointer to Animation Sprite */ - CelSprite *pCelSprite; + const CelSprite *pCelSprite; /** * @brief How many game ticks are needed to advance one Animation Frame */ @@ -81,7 +81,7 @@ public: * @param numSkippedFrames Number of Frames that will be skipped (for example with modifier "faster attack") * @param distributeFramesBeforeFrame Distribute the numSkippedFrames only before this frame */ - void SetNewAnimation(CelSprite *celSprite, int numberOfFrames, int ticksPerFrame, AnimationDistributionFlags flags = AnimationDistributionFlags::None, int numSkippedFrames = 0, int distributeFramesBeforeFrame = 0); + void SetNewAnimation(const CelSprite *celSprite, int numberOfFrames, int ticksPerFrame, AnimationDistributionFlags flags = AnimationDistributionFlags::None, int numSkippedFrames = 0, int distributeFramesBeforeFrame = 0); /** * @brief Changes the Animation Data on-the-fly. This is needed if a animation is currently in progress and the player changes his gear. @@ -89,7 +89,7 @@ public: * @param numberOfFrames Number of Frames in Animation * @param delayLen Delay after each Animation sequence */ - void ChangeAnimationData(CelSprite *celSprite, int numberOfFrames, int delayLen); + void ChangeAnimationData(const CelSprite *celSprite, int numberOfFrames, int delayLen); /** * @brief Process the Animation for a game tick (for example advances the frame) diff --git a/Source/monster.h b/Source/monster.h index b3ec980f3..286e7a39e 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -130,7 +130,7 @@ struct CMonster { /** * @brief Returns AnimStruct for specified graphic */ - AnimStruct& GetAnimData(MonsterGraphic graphic) + const AnimStruct& GetAnimData(MonsterGraphic graphic) const { return Anims[static_cast(graphic)]; } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 124bebeea..20a502803 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -443,7 +443,7 @@ static void DrawMonster(const Surface &out, int x, int y, int mx, int my, int m) return; } - CelSprite &cel = *Monsters[m].AnimInfo.pCelSprite; + auto &cel = *Monsters[m].AnimInfo.pCelSprite; if ((dFlags[x][y] & BFLAG_LIT) == 0) { Cl2DrawLightTbl(out, mx, my, cel, nCel, 1);