diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 28f97af57..37042aaaf 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -12,92 +12,92 @@ namespace devilution { -int8_t AnimationInfo::GetFrameToUseForRendering() const +int8_t AnimationInfo::getFrameToUseForRendering() const { // Normal logic is used, // - if no frame-skipping is required and so we have exactly one Animationframe per game tick // or // - if we load from a savegame where the new variables are not stored (we don't want to break savegame compatiblity because of smoother rendering of one animation) - if (RelevantFramesForDistributing <= 0) - return std::max(0, CurrentFrame); + if (relevantFramesForDistributing_ <= 0) + return std::max(0, currentFrame); - if (CurrentFrame >= RelevantFramesForDistributing) - return CurrentFrame; + if (currentFrame >= relevantFramesForDistributing_) + return currentFrame; - float ticksSinceSequenceStarted = TicksSinceSequenceStarted; - if (TicksSinceSequenceStarted < 0) { + float ticksSinceSequenceStarted = ticksSinceSequenceStarted_; + if (ticksSinceSequenceStarted_ < 0) { ticksSinceSequenceStarted = 0.0F; - Log("GetFrameToUseForRendering: Invalid TicksSinceSequenceStarted {}", TicksSinceSequenceStarted); + Log("getFrameToUseForRendering: Invalid ticksSinceSequenceStarted_ {}", ticksSinceSequenceStarted_); } // we don't use the processed game ticks alone but also the fraction of the next game tick (if a rendering happens between game ticks). This helps to smooth the animations. - float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + ticksSinceSequenceStarted; + float totalTicksForCurrentAnimationSequence = getProgressToNextGameTick() + ticksSinceSequenceStarted; - int8_t absoluteAnimationFrame = static_cast(totalTicksForCurrentAnimationSequence * TickModifier); - if (SkippedFramesFromPreviousAnimation > 0) { + int8_t absoluteAnimationFrame = static_cast(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; + absoluteAnimationFrame -= skippedFramesFromPreviousAnimation_; if (absoluteAnimationFrame < 0) { // We still display the remains of the previous Animation - absoluteAnimationFrame = NumberOfFrames + absoluteAnimationFrame; + absoluteAnimationFrame = numberOfFrames + absoluteAnimationFrame; } - } else if (absoluteAnimationFrame >= RelevantFramesForDistributing) { + } else if (absoluteAnimationFrame >= relevantFramesForDistributing_) { // this can happen if we are at the last frame and the next game tick is due (gfProgressToNextGameTick >= 1.0f) - if (absoluteAnimationFrame >= (RelevantFramesForDistributing + 1)) { + if (absoluteAnimationFrame >= (relevantFramesForDistributing_ + 1)) { // we should never have +2 frames even if next game tick is due - Log("GetFrameToUseForRendering: Calculated an invalid Animation Frame (Calculated {} MaxFrame {})", absoluteAnimationFrame, RelevantFramesForDistributing); + Log("getFrameToUseForRendering: Calculated an invalid Animation Frame (Calculated {} MaxFrame {})", absoluteAnimationFrame, relevantFramesForDistributing_); } - return RelevantFramesForDistributing - 1; + return relevantFramesForDistributing_ - 1; } if (absoluteAnimationFrame < 0) { - Log("GetFrameToUseForRendering: Calculated an invalid Animation Frame (Calculated {})", absoluteAnimationFrame); + Log("getFrameToUseForRendering: Calculated an invalid Animation Frame (Calculated {})", absoluteAnimationFrame); return 0; } return absoluteAnimationFrame; } -float AnimationInfo::GetAnimationProgress() const +float AnimationInfo::getAnimationProgress() const { - float ticksSinceSequenceStarted = TicksSinceSequenceStarted; - float tickModifier = TickModifier; + float ticksSinceSequenceStarted = ticksSinceSequenceStarted_; + float tickModifier = tickModifier_; - if (RelevantFramesForDistributing <= 0) { - // This logic is used if animation distribution is not active (see GetFrameToUseForRendering). + if (relevantFramesForDistributing_ <= 0) { + // 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 = static_cast((CurrentFrame * TicksPerFrame) + TickCounterOfCurrentFrame); - tickModifier = 1.0F / static_cast(TicksPerFrame); + ticksSinceSequenceStarted = static_cast((currentFrame * ticksPerFrame) + tickCounterOfCurrentFrame); + tickModifier = 1.0F / static_cast(ticksPerFrame); } - float totalTicksForCurrentAnimationSequence = GetProgressToNextGameTick() + ticksSinceSequenceStarted; + float totalTicksForCurrentAnimationSequence = getProgressToNextGameTick() + ticksSinceSequenceStarted; float progressInAnimationFrames = totalTicksForCurrentAnimationSequence * tickModifier; - float animationFraction = progressInAnimationFrames / static_cast(NumberOfFrames); + float animationFraction = progressInAnimationFrames / static_cast(numberOfFrames); return animationFraction; } -void AnimationInfo::SetNewAnimation(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame, AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/, int8_t numSkippedFrames /*= 0*/, int8_t distributeFramesBeforeFrame /*= 0*/, float previewShownGameTickFragments /*= 0.F*/) +void AnimationInfo::setNewAnimation(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame, AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/, int8_t numSkippedFrames /*= 0*/, int8_t distributeFramesBeforeFrame /*= 0*/, float previewShownGameTickFragments /*= 0.F*/) { - if ((flags & AnimationDistributionFlags::RepeatedAction) == AnimationDistributionFlags::RepeatedAction && distributeFramesBeforeFrame != 0 && NumberOfFrames == numberOfFrames && CurrentFrame + 1 >= distributeFramesBeforeFrame && CurrentFrame != NumberOfFrames - 1) { + if ((flags & AnimationDistributionFlags::RepeatedAction) == AnimationDistributionFlags::RepeatedAction && distributeFramesBeforeFrame != 0 && this->numberOfFrames == numberOfFrames && currentFrame + 1 >= distributeFramesBeforeFrame && currentFrame != this->numberOfFrames - 1) { // We showed the same Animation (for example a melee attack) before but truncated the Animation. // So now we should add them back to the new Animation. This increases the speed of the current Animation but the game logic/ticks isn't affected. - SkippedFramesFromPreviousAnimation = NumberOfFrames - CurrentFrame - 1; + skippedFramesFromPreviousAnimation_ = this->numberOfFrames - currentFrame - 1; } else { - SkippedFramesFromPreviousAnimation = 0; + skippedFramesFromPreviousAnimation_ = 0; } if (ticksPerFrame <= 0) { - Log("SetNewAnimation: Invalid ticksPerFrame {}", ticksPerFrame); + Log("setNewAnimation: Invalid ticksPerFrame {}", ticksPerFrame); ticksPerFrame = 1; } this->celSprite = celSprite; - NumberOfFrames = numberOfFrames; - CurrentFrame = numSkippedFrames; - TickCounterOfCurrentFrame = 0; - TicksPerFrame = ticksPerFrame; - TicksSinceSequenceStarted = 0.F; - RelevantFramesForDistributing = 0; - TickModifier = 0.0F; - IsPetrified = false; + this->numberOfFrames = numberOfFrames; + currentFrame = numSkippedFrames; + tickCounterOfCurrentFrame = 0; + this->ticksPerFrame = ticksPerFrame; + ticksSinceSequenceStarted_ = 0.F; + relevantFramesForDistributing_ = 0; + tickModifier_ = 0.0F; + isPetrified = false; if (numSkippedFrames != 0 || flags != AnimationDistributionFlags::None) { // Animation Frames that will be adjusted for the skipped Frames/game ticks @@ -117,24 +117,24 @@ void AnimationInfo::SetNewAnimation(OptionalCelSprite celSprite, int8_t numberOf float relevantAnimationTicksWithSkipping = relevantAnimationTicksForDistribution - (numSkippedFrames * ticksPerFrame); if ((flags & AnimationDistributionFlags::ProcessAnimationPending) == AnimationDistributionFlags::ProcessAnimationPending) { - // If ProcessAnimation will be called after SetNewAnimation (in same game tick as SetNewAnimation), we increment the Animation-Counter. - // If no delay is specified, this will result in complete skipped frame (see ProcessAnimation). + // If processAnimation will be called after setNewAnimation (in same game tick as setNewAnimation), we increment the Animation-Counter. + // If no delay is specified, this will result in complete skipped frame (see processAnimation). // But if we have a delay specified, this would only result in a reduced time the first frame is shown (one skipped delay). // Because of that, we only the remove one game tick from the time the Animation is shown relevantAnimationTicksWithSkipping -= 1.F; // The Animation Distribution Logic needs to account how many game ticks passed since the Animation started. - // Because ProcessAnimation will increase this later (in same game tick as SetNewAnimation), we correct this upfront. - // This also means Rendering should never hapen with TicksSinceSequenceStarted < 0. - TicksSinceSequenceStarted = -1.F; + // Because processAnimation will increase this later (in same game tick as setNewAnimation), we correct this upfront. + // This also means Rendering should never hapen with ticksSinceSequenceStarted_ < 0. + ticksSinceSequenceStarted_ = -1.F; } // The preview animation was shown some times (less then one game tick) // So we overall have a longer time the animation is shown - TicksSinceSequenceStarted += previewShownGameTickFragments; + ticksSinceSequenceStarted_ += previewShownGameTickFragments; relevantAnimationTicksWithSkipping += previewShownGameTickFragments; if ((flags & AnimationDistributionFlags::SkipsDelayOfLastFrame) == AnimationDistributionFlags::SkipsDelayOfLastFrame) { - // The logic for player/monster/... (not ProcessAnimation) only checks the frame not the delay. + // The logic for player/monster/... (not processAnimation) only checks the frame not the delay. // That means if a delay is specified, the last-frame is shown less than the other frames // Example: // If we have a animation with 3 frames and with a delay of 1 (ticksPerFrame = 2). @@ -154,7 +154,7 @@ void AnimationInfo::SetNewAnimation(OptionalCelSprite celSprite, int8_t numberOf } // The truncated Frames from previous Animation will also be shown, so we also have to distribute them for the given time (game ticks) - relevantAnimationTicksForDistribution += (SkippedFramesFromPreviousAnimation * ticksPerFrame); + 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 = static_cast(relevantAnimationTicksForDistribution) / relevantAnimationTicksWithSkipping; @@ -162,56 +162,56 @@ void AnimationInfo::SetNewAnimation(OptionalCelSprite celSprite, int8_t numberOf // tickModifier specifies the Animation fraction per game tick, so we have to remove the delay from the variable tickModifier /= static_cast(ticksPerFrame); - RelevantFramesForDistributing = relevantAnimationFramesForDistributing; - TickModifier = tickModifier; + relevantFramesForDistributing_ = relevantAnimationFramesForDistributing; + tickModifier_ = tickModifier; } } -void AnimationInfo::ChangeAnimationData(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame) +void AnimationInfo::changeAnimationData(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame) { - 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 + if (numberOfFrames != this->numberOfFrames || ticksPerFrame != this->ticksPerFrame) { + // Ensure that the currentFrame is still valid and that we disable ADL cause the calculcated values (for example tickModifier_) could be wrong if (numberOfFrames >= 1) - CurrentFrame = clamp(CurrentFrame, 0, numberOfFrames - 1); + currentFrame = clamp(currentFrame, 0, numberOfFrames - 1); else - CurrentFrame = -1; + currentFrame = -1; - NumberOfFrames = numberOfFrames; - TicksPerFrame = ticksPerFrame; - TicksSinceSequenceStarted = 0.F; - RelevantFramesForDistributing = 0; - TickModifier = 0.0F; + this->numberOfFrames = numberOfFrames; + this->ticksPerFrame = ticksPerFrame; + ticksSinceSequenceStarted_ = 0.F; + relevantFramesForDistributing_ = 0; + tickModifier_ = 0.0F; } this->celSprite = celSprite; } -void AnimationInfo::ProcessAnimation(bool reverseAnimation /*= false*/, bool dontProgressAnimation /*= false*/) +void AnimationInfo::processAnimation(bool reverseAnimation /*= false*/, bool dontProgressAnimation /*= false*/) { - TickCounterOfCurrentFrame++; + tickCounterOfCurrentFrame++; if (dontProgressAnimation) return; - TicksSinceSequenceStarted++; - if (TickCounterOfCurrentFrame >= TicksPerFrame) { - TickCounterOfCurrentFrame = 0; + ticksSinceSequenceStarted_++; + if (tickCounterOfCurrentFrame >= ticksPerFrame) { + tickCounterOfCurrentFrame = 0; if (reverseAnimation) { - --CurrentFrame; - if (CurrentFrame == -1) { - CurrentFrame = NumberOfFrames - 1; - TicksSinceSequenceStarted = 0.F; + --currentFrame; + if (currentFrame == -1) { + currentFrame = numberOfFrames - 1; + ticksSinceSequenceStarted_ = 0.F; } } else { - ++CurrentFrame; - if (CurrentFrame >= NumberOfFrames) { - CurrentFrame = 0; - TicksSinceSequenceStarted = 0.F; + ++currentFrame; + if (currentFrame >= numberOfFrames) { + currentFrame = 0; + ticksSinceSequenceStarted_ = 0.F; } } } } -float AnimationInfo::GetProgressToNextGameTick() const +float AnimationInfo::getProgressToNextGameTick() const { - if (IsPetrified) + if (isPetrified) return 0.0F; return gfProgressToNextGameTick; } diff --git a/Source/engine/animationinfo.h b/Source/engine/animationinfo.h index d06fac1a2..0a9ef99f3 100644 --- a/Source/engine/animationinfo.h +++ b/Source/engine/animationinfo.h @@ -18,7 +18,7 @@ namespace devilution { enum AnimationDistributionFlags : uint8_t { None = 0, /** - * @brief ProcessAnimation will be called after SetNewAnimation (in same game tick as NewPlrAnim) + * @brief processAnimation will be called after setNewAnimation (in same game tick as NewPlrAnim) */ ProcessAnimationPending = 1 << 0, /** @@ -43,34 +43,34 @@ public: /** * @brief How many game ticks are needed to advance one Animation Frame */ - int8_t TicksPerFrame; + int8_t ticksPerFrame; /** - * @brief Increases by one each game tick, counting how close we are to TicksPerFrame + * @brief Increases by one each game tick, counting how close we are to ticksPerFrame */ - int8_t TickCounterOfCurrentFrame; + int8_t tickCounterOfCurrentFrame; /** * @brief Number of frames in current animation */ - int8_t NumberOfFrames; + int8_t numberOfFrames; /** * @brief Current frame of animation */ - int8_t CurrentFrame; + int8_t currentFrame; /** * @brief Is the animation currently petrified and shouldn't advance with gfProgressToNextGameTick */ - bool IsPetrified; + bool isPetrified; /** * @brief Calculates the Frame to use for the Animation rendering * @return The Frame to use for rendering */ - int8_t GetFrameToUseForRendering() const; + [[nodiscard]] int8_t getFrameToUseForRendering() const; /** * @brief Calculates the progress of the current animation as a fraction (0.0f to 1.0f) */ - float GetAnimationProgress() const; + [[nodiscard]] float getAnimationProgress() const; /** * @brief Sets the new Animation with all relevant information for rendering @@ -82,7 +82,7 @@ public: * @param distributeFramesBeforeFrame Distribute the numSkippedFrames only before this frame * @param previewShownGameTickFragments Defines how long (in game ticks fraction) the preview animation was shown */ - void SetNewAnimation(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame, AnimationDistributionFlags flags = AnimationDistributionFlags::None, int8_t numSkippedFrames = 0, int8_t distributeFramesBeforeFrame = 0, float previewShownGameTickFragments = 0.F); + void setNewAnimation(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame, AnimationDistributionFlags flags = AnimationDistributionFlags::None, int8_t numSkippedFrames = 0, int8_t distributeFramesBeforeFrame = 0, float previewShownGameTickFragments = 0.F); /** * @brief Changes the Animation Data on-the-fly. This is needed if a animation is currently in progress and the player changes his gear. @@ -90,37 +90,37 @@ public: * @param numberOfFrames Number of Frames in Animation * @param ticksPerFrame How many game ticks are needed to advance one Animation Frame */ - void ChangeAnimationData(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame); + void changeAnimationData(OptionalCelSprite celSprite, int8_t numberOfFrames, int8_t ticksPerFrame); /** * @brief Process the Animation for a game tick (for example advances the frame) * @param reverseAnimation Play the animation backwards (for example is used for "unseen" monster fading) - * @param dontProgressAnimation Increase TickCounterOfCurrentFrame but don't change CurrentFrame + * @param dontProgressAnimation Increase tickCounterOfCurrentFrame but don't change currentFrame */ - void ProcessAnimation(bool reverseAnimation = false, bool dontProgressAnimation = false); + void processAnimation(bool reverseAnimation = false, bool dontProgressAnimation = false); private: /** * @brief returns the progress as a fraction (0.0f to 1.0f) in time to the next game tick or 0.0f if the animation is frozen */ - float GetProgressToNextGameTick() const; + [[nodiscard]] float getProgressToNextGameTick() const; /** * @brief Specifies how many animations-fractions are displayed between two game ticks. this can be > 0, if animations are skipped or < 0 if the same animation is shown in multiple times (delay specified). */ - float TickModifier; + float tickModifier_; /** * @brief Number of game ticks after the current animation sequence started */ - float TicksSinceSequenceStarted; + float ticksSinceSequenceStarted_; /** * @brief Animation Frames that will be adjusted for the skipped Frames/game ticks */ - int8_t RelevantFramesForDistributing; + int8_t relevantFramesForDistributing_; /** * @brief Animation Frames that wasn't shown from previous Animation */ - int8_t SkippedFramesFromPreviousAnimation; + int8_t skippedFramesFromPreviousAnimation_; }; } // namespace devilution diff --git a/Source/engine/render/scrollrt.cpp b/Source/engine/render/scrollrt.cpp index 33bea3a05..22cdd2368 100644 --- a/Source/engine/render/scrollrt.cpp +++ b/Source/engine/render/scrollrt.cpp @@ -429,7 +429,7 @@ void DrawMonster(const Surface &out, Point tilePosition, Point targetBufferPosit } }; - int nCel = monster.AnimInfo.GetFrameToUseForRendering(); + int nCel = monster.AnimInfo.getFrameToUseForRendering(); const uint32_t frames = LoadLE32(monster.AnimInfo.celSprite->Data()); if (nCel < 0 || frames > 50 || nCel >= static_cast(frames)) { Log( @@ -510,7 +510,7 @@ void DrawPlayer(const Surface &out, const Player &player, Point tilePosition, Po } OptionalCelSprite sprite = player.AnimInfo.celSprite; - int nCel = player.AnimInfo.GetFrameToUseForRendering(); + int nCel = player.AnimInfo.getFrameToUseForRendering(); if (player.previewCelSprite) { sprite = player.previewCelSprite; @@ -719,7 +719,7 @@ void DrawItem(const Surface &out, Point tilePosition, Point targetBufferPosition return; } - int nCel = item.AnimInfo.GetFrameToUseForRendering(); + int nCel = item.AnimInfo.getFrameToUseForRendering(); const uint32_t frames = LoadLE32(cel->Data()); if (nCel < 0 || frames > 50 || nCel >= static_cast(frames)) { Log("Draw \"{}\" Item 1: frame {} of {}, item type=={}", item._iIName, nCel, frames, ItemTypeToString(item._itype)); @@ -732,7 +732,7 @@ void DrawItem(const Surface &out, Point tilePosition, Point targetBufferPosition CelBlitOutlineTo(out, GetOutlineColor(item, false), position, *cel, nCel); } CelClippedDrawLightTo(out, position, *cel, nCel); - if (item.AnimInfo.CurrentFrame == item.AnimInfo.NumberOfFrames - 1 || item._iCurs == ICURS_MAGIC_ROCK) + if (item.AnimInfo.currentFrame == item.AnimInfo.numberOfFrames - 1 || item._iCurs == ICURS_MAGIC_ROCK) AddItemToLabelQueue(bItem - 1, px, targetBufferPosition.y); } @@ -781,7 +781,7 @@ void DrawMonsterHelper(const Surface &out, Point tilePosition, Point targetBuffe const Point monsterRenderPosition { targetBufferPosition + offset - Displacement { CalculateWidth2(cel.Width()), 0 } }; if (mi == pcursmonst) { - Cl2DrawOutline(out, 233, monsterRenderPosition.x, monsterRenderPosition.y, cel, monster.AnimInfo.GetFrameToUseForRendering()); + Cl2DrawOutline(out, 233, monsterRenderPosition.x, monsterRenderPosition.y, cel, monster.AnimInfo.getFrameToUseForRendering()); } DrawMonster(out, tilePosition, monsterRenderPosition, monster); } @@ -1412,7 +1412,7 @@ Displacement GetOffsetForWalking(const AnimationInfo &animationInfo, const Direc constexpr Displacement MovingOffset[8] = { { 0, 32 }, { -32, 16 }, { -64, 0 }, { -32, -16 }, { 0, -32 }, { 32, -16 }, { 64, 0 }, { 32, 16 } }; // clang-format on - float fAnimationProgress = animationInfo.GetAnimationProgress(); + float fAnimationProgress = animationInfo.getAnimationProgress(); Displacement offset = MovingOffset[static_cast(dir)]; offset *= fAnimationProgress; diff --git a/Source/items.cpp b/Source/items.cpp index 6b8acc762..731f44d94 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -445,7 +445,7 @@ void AddInitItems() item._iCreateInfo = curlv | CF_PREGEN; SetupItem(item); - item.AnimInfo.CurrentFrame = item.AnimInfo.NumberOfFrames - 1; + item.AnimInfo.currentFrame = item.AnimInfo.numberOfFrames - 1; item._iAnimFlag = false; item._iSelFlag = 1; DeltaAddItem(ii); @@ -1647,7 +1647,7 @@ void SpawnRock() SetupItem(item); item._iSelFlag = 2; item._iPostDraw = true; - item.AnimInfo.CurrentFrame = 10; + item.AnimInfo.currentFrame = 10; } void ItemDoppel() @@ -2678,10 +2678,10 @@ void CalcPlrItemVals(Player &player, bool loadgfx) player.previewCelSprite = std::nullopt; if (player._pmode == PM_STAND) { LoadPlrGFX(player, player_graphic::Stand); - player.AnimInfo.ChangeAnimationData(player.AnimationData[static_cast(player_graphic::Stand)].GetCelSpritesForDirection(player._pdir), player._pNFrames, 4); + player.AnimInfo.changeAnimationData(player.AnimationData[static_cast(player_graphic::Stand)].GetCelSpritesForDirection(player._pdir), player._pNFrames, 4); } else { LoadPlrGFX(player, player_graphic::Walk); - player.AnimInfo.ChangeAnimationData(player.AnimationData[static_cast(player_graphic::Walk)].GetCelSpritesForDirection(player._pdir), player._pWFrames, 1); + player.AnimInfo.changeAnimationData(player.AnimationData[static_cast(player_graphic::Walk)].GetCelSpritesForDirection(player._pdir), player._pWFrames, 1); } } else { player._pgfxnum = gfxNum; @@ -3328,7 +3328,7 @@ void SpawnQuestItem(int itemid, Point position, int randarea, int selflag) item._iPostDraw = true; if (selflag != 0) { item._iSelFlag = selflag; - item.AnimInfo.CurrentFrame = item.AnimInfo.NumberOfFrames - 1; + item.AnimInfo.currentFrame = item.AnimInfo.numberOfFrames - 1; item._iAnimFlag = false; } } @@ -3410,18 +3410,18 @@ void ProcessItems() auto &item = Items[ii]; if (!item._iAnimFlag) continue; - item.AnimInfo.ProcessAnimation(); + item.AnimInfo.processAnimation(); if (item._iCurs == ICURS_MAGIC_ROCK) { - if (item._iSelFlag == 1 && item.AnimInfo.CurrentFrame == 10) - item.AnimInfo.CurrentFrame = 0; - if (item._iSelFlag == 2 && item.AnimInfo.CurrentFrame == 20) - item.AnimInfo.CurrentFrame = 10; + if (item._iSelFlag == 1 && item.AnimInfo.currentFrame == 10) + item.AnimInfo.currentFrame = 0; + if (item._iSelFlag == 2 && item.AnimInfo.currentFrame == 20) + item.AnimInfo.currentFrame = 10; } else { - if (item.AnimInfo.CurrentFrame == (item.AnimInfo.NumberOfFrames - 1) / 2) + if (item.AnimInfo.currentFrame == (item.AnimInfo.numberOfFrames - 1) / 2) PlaySfxLoc(ItemDropSnds[ItemCAnimTbl[item._iCurs]], item.position); - if (item.AnimInfo.CurrentFrame >= item.AnimInfo.NumberOfFrames - 1) { - item.AnimInfo.CurrentFrame = item.AnimInfo.NumberOfFrames - 1; + if (item.AnimInfo.currentFrame >= item.AnimInfo.numberOfFrames - 1) { + item.AnimInfo.currentFrame = item.AnimInfo.numberOfFrames - 1; item._iAnimFlag = false; item._iSelFlag = 1; } @@ -4336,7 +4336,7 @@ void MakeGoldStack(Item &goldItem, int value) int ItemNoFlippy() { int r = ActiveItems[ActiveItemCount - 1]; - Items[r].AnimInfo.CurrentFrame = Items[r].AnimInfo.NumberOfFrames - 1; + Items[r].AnimInfo.currentFrame = Items[r].AnimInfo.numberOfFrames - 1; Items[r]._iAnimFlag = false; Items[r]._iSelFlag = 1; @@ -4584,16 +4584,16 @@ void Item::setNewAnimation(bool showAnimation) int8_t numberOfFrames = ItemAnimLs[it]; auto celSprite = itemanims[it] ? OptionalCelSprite { *itemanims[it] } : std::nullopt; if (_iCurs != ICURS_MAGIC_ROCK) - AnimInfo.SetNewAnimation(celSprite, numberOfFrames, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, numberOfFrames); + AnimInfo.setNewAnimation(celSprite, numberOfFrames, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, numberOfFrames); else - AnimInfo.SetNewAnimation(celSprite, numberOfFrames, 1); + AnimInfo.setNewAnimation(celSprite, numberOfFrames, 1); _iPostDraw = false; _iRequest = false; if (showAnimation) { _iAnimFlag = true; _iSelFlag = 0; } else { - AnimInfo.CurrentFrame = AnimInfo.NumberOfFrames - 1; + AnimInfo.currentFrame = AnimInfo.numberOfFrames - 1; _iAnimFlag = false; _iSelFlag = 1; } diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index be1b6b633..4d4b12154 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -240,8 +240,8 @@ void LoadItemData(LoadHelper &file, Item &item) item._iAnimFlag = file.NextBool32(); file.Skip(4); // Skip pointer _iAnimData item.AnimInfo = {}; - item.AnimInfo.NumberOfFrames = file.NextLENarrow(); - item.AnimInfo.CurrentFrame = file.NextLENarrow(-1); + item.AnimInfo.numberOfFrames = file.NextLENarrow(); + item.AnimInfo.currentFrame = file.NextLENarrow(-1); file.Skip(8); // Skip _iAnimWidth and _iAnimWidth2 file.Skip(4); // Unused since 1.02 item._iSelFlag = file.NextLE(); @@ -352,10 +352,10 @@ void LoadPlayer(LoadHelper &file, Player &player) player._pgfxnum = file.NextLE(); file.Skip(); // Skip pointer pData player.AnimInfo = {}; - player.AnimInfo.TicksPerFrame = file.NextLENarrow(1); - player.AnimInfo.TickCounterOfCurrentFrame = file.NextLENarrow(); - player.AnimInfo.NumberOfFrames = file.NextLENarrow(); - player.AnimInfo.CurrentFrame = file.NextLENarrow(-1); + player.AnimInfo.ticksPerFrame = file.NextLENarrow(1); + player.AnimInfo.tickCounterOfCurrentFrame = file.NextLENarrow(); + player.AnimInfo.numberOfFrames = file.NextLENarrow(); + player.AnimInfo.currentFrame = file.NextLENarrow(-1); file.Skip(3); // Skip _pAnimWidth, _pAnimWidth2, _peflag player._plid = file.NextLE(); player._pvid = file.NextLE(); @@ -593,10 +593,10 @@ void LoadMonster(LoadHelper *file, Monster &monster) file->Skip(4); // Skip pointer _mAnimData monster.AnimInfo = {}; - monster.AnimInfo.TicksPerFrame = file->NextLENarrow(); - monster.AnimInfo.TickCounterOfCurrentFrame = file->NextLENarrow(); - monster.AnimInfo.NumberOfFrames = file->NextLENarrow(); - monster.AnimInfo.CurrentFrame = file->NextLENarrow(-1); + monster.AnimInfo.ticksPerFrame = file->NextLENarrow(); + monster.AnimInfo.tickCounterOfCurrentFrame = file->NextLENarrow(); + monster.AnimInfo.numberOfFrames = file->NextLENarrow(); + monster.AnimInfo.currentFrame = file->NextLENarrow(-1); file->Skip(4); // Skip _meflag monster._mDelFlag = file->NextBool32(); monster._mVar1 = file->NextLE(); @@ -998,8 +998,8 @@ void SaveItem(SaveHelper &file, const Item &item) file.WriteLE(item.position.y); file.WriteLE(item._iAnimFlag ? 1 : 0); file.Skip(4); // Skip pointer _iAnimData - file.WriteLE(item.AnimInfo.NumberOfFrames); - file.WriteLE(item.AnimInfo.CurrentFrame + 1); + file.WriteLE(item.AnimInfo.numberOfFrames); + file.WriteLE(item.AnimInfo.currentFrame + 1); // write _iAnimWidth for vanilla compatibility file.WriteLE(ItemAnimWidth); // write _iAnimWidth2 for vanilla compatibility @@ -1105,10 +1105,10 @@ void SavePlayer(SaveHelper &file, const Player &player) file.Skip(4); // Unused file.WriteLE(player._pgfxnum); file.Skip(4); // Skip pointer _pAnimData - file.WriteLE(std::max(0, player.AnimInfo.TicksPerFrame - 1)); - file.WriteLE(player.AnimInfo.TickCounterOfCurrentFrame); - file.WriteLE(player.AnimInfo.NumberOfFrames); - file.WriteLE(player.AnimInfo.CurrentFrame + 1); + file.WriteLE(std::max(0, player.AnimInfo.ticksPerFrame - 1)); + file.WriteLE(player.AnimInfo.tickCounterOfCurrentFrame); + file.WriteLE(player.AnimInfo.numberOfFrames); + file.WriteLE(player.AnimInfo.currentFrame + 1); // write _pAnimWidth for vanilla compatibility int animWidth = player.AnimInfo.celSprite ? player.AnimInfo.celSprite->Width() : 96; file.WriteLE(animWidth); @@ -1333,10 +1333,10 @@ void SaveMonster(SaveHelper *file, Monster &monster) file->Skip(2); // Unused file->Skip(4); // Skip pointer _mAnimData - file->WriteLE(monster.AnimInfo.TicksPerFrame); - file->WriteLE(monster.AnimInfo.TickCounterOfCurrentFrame); - file->WriteLE(monster.AnimInfo.NumberOfFrames); - file->WriteLE(monster.AnimInfo.CurrentFrame + 1); + file->WriteLE(monster.AnimInfo.ticksPerFrame); + file->WriteLE(monster.AnimInfo.tickCounterOfCurrentFrame); + file->WriteLE(monster.AnimInfo.numberOfFrames); + file->WriteLE(monster.AnimInfo.currentFrame + 1); file->Skip(); // Skip _meflag file->WriteLE(monster._mDelFlag ? 1 : 0); file->WriteLE(monster._mVar1); diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 0ad767f60..f22e79728 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -3503,7 +3503,7 @@ void MI_Stone(Missile &missile) missile._miDelFlag = true; if (monster._mhitpoints > 0) { monster._mmode = static_cast(missile.var1); - monster.AnimInfo.IsPetrified = false; + monster.AnimInfo.isPetrified = false; } else { AddCorpse(monster.position.tile, stonendx, monster._mdir); } diff --git a/Source/monster.cpp b/Source/monster.cpp index e5a5ebc5a..23b69419d 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -199,8 +199,8 @@ void InitMonster(Monster &monster, Direction rd, int mtype, Point position) monster.mName = pgettext("monster", monster.data().mName).data(); monster.AnimInfo = {}; monster.ChangeAnimationData(MonsterGraphic::Stand); - monster.AnimInfo.TickCounterOfCurrentFrame = GenerateRnd(monster.AnimInfo.TicksPerFrame - 1); - monster.AnimInfo.CurrentFrame = GenerateRnd(monster.AnimInfo.NumberOfFrames - 1); + monster.AnimInfo.tickCounterOfCurrentFrame = GenerateRnd(monster.AnimInfo.ticksPerFrame - 1); + monster.AnimInfo.currentFrame = GenerateRnd(monster.AnimInfo.numberOfFrames - 1); monster.mLevel = monster.data().mLevel; int maxhp = monster.data().mMinHP + GenerateRnd(monster.data().mMaxHP - monster.data().mMinHP + 1); @@ -244,7 +244,7 @@ void InitMonster(Monster &monster, Direction rd, int mtype, Point position) if (monster._mAi == AI_GARG) { monster.ChangeAnimationData(MonsterGraphic::Special); - monster.AnimInfo.CurrentFrame = 0; + monster.AnimInfo.currentFrame = 0; monster._mFlags |= MFLAG_ALLOW_SPECIAL; monster._mmode = MonsterMode::SpecialMeleeAttack; } @@ -371,7 +371,7 @@ void PlaceGroup(int mtype, int num, UniqueMonsterPack uniqueMonsterPack, int lea if (minion._mAi != AI_GARG) { minion.ChangeAnimationData(MonsterGraphic::Stand); - minion.AnimInfo.CurrentFrame = GenerateRnd(minion.AnimInfo.NumberOfFrames - 1); + minion.AnimInfo.currentFrame = GenerateRnd(minion.AnimInfo.numberOfFrames - 1); minion._mFlags &= ~MFLAG_ALLOW_SPECIAL; minion._mmode = MonsterMode::Stand; } @@ -676,7 +676,7 @@ void DeleteMonster(size_t activeIndex) void NewMonsterAnim(Monster &monster, MonsterGraphic graphic, Direction md, AnimationDistributionFlags flags = AnimationDistributionFlags::None, int8_t numSkippedFrames = 0, int8_t distributeFramesBeforeFrame = 0) { const auto &animData = monster.type().getAnimData(graphic); - monster.AnimInfo.SetNewAnimation(animData.getCelSpritesForDirection(md), animData.frames, animData.rate, flags, numSkippedFrames, distributeFramesBeforeFrame); + monster.AnimInfo.setNewAnimation(animData.getCelSpritesForDirection(md), animData.frames, animData.rate, flags, numSkippedFrames, distributeFramesBeforeFrame); monster._mFlags &= ~(MFLAG_LOCK_ANIMATION | MFLAG_ALLOW_SPECIAL); monster._mdir = md; } @@ -1152,7 +1152,7 @@ void StartFadein(Monster &monster, Direction md, bool backwards) monster._mFlags &= ~MFLAG_HIDDEN; if (backwards) { monster._mFlags |= MFLAG_LOCK_ANIMATION; - monster.AnimInfo.CurrentFrame = monster.AnimInfo.NumberOfFrames - 1; + monster.AnimInfo.currentFrame = monster.AnimInfo.numberOfFrames - 1; } } @@ -1165,14 +1165,14 @@ void StartFadeout(Monster &monster, Direction md, bool backwards) monster.position.old = monster.position.tile; if (backwards) { monster._mFlags |= MFLAG_LOCK_ANIMATION; - monster.AnimInfo.CurrentFrame = monster.AnimInfo.NumberOfFrames - 1; + monster.AnimInfo.currentFrame = monster.AnimInfo.numberOfFrames - 1; } } void StartHeal(Monster &monster) { monster.ChangeAnimationData(MonsterGraphic::Special); - monster.AnimInfo.CurrentFrame = monster.type().getAnimData(MonsterGraphic::Special).frames - 1; + monster.AnimInfo.currentFrame = monster.type().getAnimData(MonsterGraphic::Special).frames - 1; monster._mFlags |= MFLAG_LOCK_ANIMATION; monster._mmode = MonsterMode::Heal; monster._mVar1 = monster._mmaxhp / (16 * (GenerateRnd(5) + 4)); @@ -1194,7 +1194,7 @@ bool MonsterIdle(Monster &monster) else monster.ChangeAnimationData(MonsterGraphic::Stand); - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) UpdateEnemy(monster); monster._mVar2++; @@ -1211,7 +1211,7 @@ bool MonsterWalk(int monsterId, MonsterMode variant) auto &monster = Monsters[monsterId]; // Check if we reached new tile - const bool isAnimationEnd = monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1; + const bool isAnimationEnd = monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1; if (isAnimationEnd) { switch (variant) { case MonsterMode::MoveNorthwards: @@ -1236,8 +1236,8 @@ bool MonsterWalk(int monsterId, MonsterMode variant) ChangeLightXY(monster.mlid, monster.position.tile); M_StartStand(monster, monster._mdir); } else { // We didn't reach new tile so update monster's "sub-tile" position - if (monster.AnimInfo.TickCounterOfCurrentFrame == 0) { - if (monster.AnimInfo.CurrentFrame == 0 && monster.type().type == MT_FLESTHNG) + if (monster.AnimInfo.tickCounterOfCurrentFrame == 0) { + if (monster.AnimInfo.currentFrame == 0 && monster.type().type == MT_FLESTHNG) PlayEffect(monster, 3); monster.position.offset2 += monster.position.velocity; monster.position.offset.deltaX = monster.position.offset2.deltaX >> 4; @@ -1415,22 +1415,22 @@ bool MonsterAttack(int monsterId) assert(monsterId >= 0 && monsterId < MaxMonsters); auto &monster = Monsters[monsterId]; - if (monster.AnimInfo.CurrentFrame == monster.data().mAFNum - 1) { + if (monster.AnimInfo.currentFrame == monster.data().mAFNum - 1) { MonsterAttackPlayer(monsterId, monster._menemy, monster.mHit, monster.mMinDamage, monster.mMaxDamage); if (monster._mAi != AI_SNAKE) PlayEffect(monster, 0); } - if (IsAnyOf(monster.type().type, MT_NMAGMA, MT_YMAGMA, MT_BMAGMA, MT_WMAGMA) && monster.AnimInfo.CurrentFrame == 8) { + if (IsAnyOf(monster.type().type, MT_NMAGMA, MT_YMAGMA, MT_BMAGMA, MT_WMAGMA) && monster.AnimInfo.currentFrame == 8) { MonsterAttackPlayer(monsterId, monster._menemy, monster.mHit + 10, monster.mMinDamage - 2, monster.mMaxDamage - 2); PlayEffect(monster, 0); } - if (IsAnyOf(monster.type().type, MT_STORM, MT_RSTORM, MT_STORML, MT_MAEL) && monster.AnimInfo.CurrentFrame == 12) { + if (IsAnyOf(monster.type().type, MT_STORM, MT_RSTORM, MT_STORML, MT_MAEL) && monster.AnimInfo.currentFrame == 12) { MonsterAttackPlayer(monsterId, monster._menemy, monster.mHit - 20, monster.mMinDamage + 4, monster.mMaxDamage + 4); PlayEffect(monster, 0); } - if (monster._mAi == AI_SNAKE && monster.AnimInfo.CurrentFrame == 0) + if (monster._mAi == AI_SNAKE && monster.AnimInfo.currentFrame == 0) PlayEffect(monster, 0); - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; } @@ -1443,7 +1443,7 @@ bool MonsterRangedAttack(int monsterId) assert(monsterId >= 0 && monsterId < MaxMonsters); auto &monster = Monsters[monsterId]; - if (monster.AnimInfo.CurrentFrame == monster.data().mAFNum - 1) { + if (monster.AnimInfo.currentFrame == monster.data().mAFNum - 1) { const auto &missileType = static_cast(monster._mVar1); if (missileType != MIS_NULL) { int multimissiles = 1; @@ -1464,7 +1464,7 @@ bool MonsterRangedAttack(int monsterId) PlayEffect(monster, 0); } - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; } @@ -1477,7 +1477,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) { if (AddMissile( monster.position.tile, monster.enemyPosition, @@ -1492,7 +1492,7 @@ bool MonsterRangedSpecialAttack(int monsterId) } } - if (monster._mAi == AI_MEGA && monster.AnimInfo.CurrentFrame == monster.data().mAFNum2 - 1) { + if (monster._mAi == AI_MEGA && monster.AnimInfo.currentFrame == monster.data().mAFNum2 - 1) { if (monster._mVar2++ == 0) { monster._mFlags |= MFLAG_ALLOW_SPECIAL; } else if (monster._mVar2 == 15) { @@ -1500,7 +1500,7 @@ bool MonsterRangedSpecialAttack(int monsterId) } } - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; } @@ -1513,10 +1513,10 @@ bool MonsterSpecialAttack(int monsterId) assert(monsterId >= 0 && monsterId < MaxMonsters); auto &monster = Monsters[monsterId]; - if (monster.AnimInfo.CurrentFrame == monster.data().mAFNum2 - 1) + if (monster.AnimInfo.currentFrame == monster.data().mAFNum2 - 1) MonsterAttackPlayer(monsterId, monster._menemy, monster.mHit2, monster.mMinDamage2, monster.mMaxDamage2); - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; } @@ -1526,8 +1526,8 @@ bool MonsterSpecialAttack(int monsterId) bool MonsterFadein(Monster &monster) { - if (((monster._mFlags & MFLAG_LOCK_ANIMATION) == 0 || monster.AnimInfo.CurrentFrame != 0) - && ((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0 || monster.AnimInfo.CurrentFrame != monster.AnimInfo.NumberOfFrames - 1)) { + if (((monster._mFlags & MFLAG_LOCK_ANIMATION) == 0 || monster.AnimInfo.currentFrame != 0) + && ((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0 || monster.AnimInfo.currentFrame != monster.AnimInfo.numberOfFrames - 1)) { return false; } @@ -1539,8 +1539,8 @@ bool MonsterFadein(Monster &monster) bool MonsterFadeout(Monster &monster) { - if (((monster._mFlags & MFLAG_LOCK_ANIMATION) == 0 || monster.AnimInfo.CurrentFrame != 0) - && ((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0 || monster.AnimInfo.CurrentFrame != monster.AnimInfo.NumberOfFrames - 1)) { + if (((monster._mFlags & MFLAG_LOCK_ANIMATION) == 0 || monster.AnimInfo.currentFrame != 0) + && ((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0 || monster.AnimInfo.currentFrame != monster.AnimInfo.numberOfFrames - 1)) { return false; } @@ -1560,7 +1560,7 @@ bool MonsterHeal(Monster &monster) return false; } - if (monster.AnimInfo.CurrentFrame == 0) { + if (monster.AnimInfo.currentFrame == 0) { monster._mFlags &= ~MFLAG_LOCK_ANIMATION; monster._mFlags |= MFLAG_ALLOW_SPECIAL; if (monster._mVar1 + monster._mhitpoints < monster._mmaxhp) { @@ -1638,7 +1638,7 @@ bool MonsterTalk(Monster &monster) bool MonsterGotHit(Monster &monster) { - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; @@ -1668,7 +1668,7 @@ bool MonsterDeath(int monsterId) if (monster._mVar1 == 140) PrepDoEnding(); - } else if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + } else if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { if (monster._uniqtype == 0) AddCorpse(monster.position.tile, monster.type().corpseId, monster._mdir); else @@ -1684,10 +1684,10 @@ bool MonsterDeath(int monsterId) bool MonsterSpecialStand(Monster &monster) { - if (monster.AnimInfo.CurrentFrame == monster.data().mAFNum2 - 1) + if (monster.AnimInfo.currentFrame == monster.data().mAFNum2 - 1) PlayEffect(monster, 3); - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { M_StartStand(monster, monster._mdir); return true; } @@ -1704,9 +1704,9 @@ bool MonsterDelay(Monster &monster) } if (monster._mVar2-- == 0) { - int oFrame = monster.AnimInfo.CurrentFrame; + int oFrame = monster.AnimInfo.currentFrame; M_StartStand(monster, monster._mdir); - monster.AnimInfo.CurrentFrame = oFrame; + monster.AnimInfo.currentFrame = oFrame; return true; } @@ -2493,7 +2493,7 @@ void FallenAi(int monsterId) } } - if (monster.AnimInfo.CurrentFrame == monster.AnimInfo.NumberOfFrames - 1) { + if (monster.AnimInfo.currentFrame == monster.AnimInfo.numberOfFrames - 1) { if (GenerateRnd(4) != 0) { return; } @@ -3497,7 +3497,7 @@ void PrepareUniqueMonst(Monster &monster, int uniqindex, int miniontype, int bos if (monster._mAi != AI_GARG) { monster.ChangeAnimationData(MonsterGraphic::Stand); - monster.AnimInfo.CurrentFrame = GenerateRnd(monster.AnimInfo.NumberOfFrames - 1); + monster.AnimInfo.currentFrame = GenerateRnd(monster.AnimInfo.numberOfFrames - 1); monster._mFlags &= ~MFLAG_ALLOW_SPECIAL; monster._mmode = MonsterMode::Stand; } @@ -4310,7 +4310,7 @@ void ProcessMonsters() } } while (raflag); if (monster._mmode != MonsterMode::Petrified) { - monster.AnimInfo.ProcessAnimation((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0, (monster._mFlags & MFLAG_ALLOW_SPECIAL) != 0); + monster.AnimInfo.processAnimation((monster._mFlags & MFLAG_LOCK_ANIMATION) != 0, (monster._mFlags & MFLAG_ALLOW_SPECIAL) != 0); } } @@ -4488,10 +4488,10 @@ void SyncMonsterAnim(Monster &monster) break; case MonsterMode::Charge: graphic = MonsterGraphic::Attack; - monster.AnimInfo.CurrentFrame = 0; + monster.AnimInfo.currentFrame = 0; break; default: - monster.AnimInfo.CurrentFrame = 0; + monster.AnimInfo.currentFrame = 0; break; } @@ -4877,7 +4877,7 @@ void Monster::CheckStandAnimationIsLoaded(Direction mdir) void Monster::Petrify() { _mmode = MonsterMode::Petrified; - AnimInfo.IsPetrified = true; + AnimInfo.isPetrified = true; } bool Monster::IsWalking() const diff --git a/Source/monster.h b/Source/monster.h index 6f3680d84..505cd6eb0 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -236,7 +236,7 @@ struct Monster { // note: missing field _mAFNum auto &animationData = type().getAnimData(graphic); // 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(animationData.getCelSpritesForDirection(direction), animationData.frames, animationData.rate); + this->AnimInfo.changeAnimationData(animationData.getCelSpritesForDirection(direction), animationData.frames, animationData.rate); } /** diff --git a/Source/msg.cpp b/Source/msg.cpp index fd9a067b7..e9f77aed3 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1838,7 +1838,7 @@ DWORD OnPlayerJoinLevel(const TCmd *pCmd, int pnum) player._pgfxnum &= ~0xF; player._pmode = PM_DEATH; NewPlrAnim(player, player_graphic::Death, Direction::South, player._pDFrames, 1); - player.AnimInfo.CurrentFrame = player.AnimInfo.NumberOfFrames - 2; + player.AnimInfo.currentFrame = player.AnimInfo.numberOfFrames - 2; dFlags[player.position.tile.x][player.position.tile.y] |= DungeonFlag::DeadPlayer; } diff --git a/Source/multi.cpp b/Source/multi.cpp index 9ad23b1dc..03a0aa359 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -845,7 +845,7 @@ void recv_plrinfo(int pnum, const TCmdPlrInfoHdr &header, bool recv) player._pgfxnum &= ~0xF; player._pmode = PM_DEATH; NewPlrAnim(player, player_graphic::Death, Direction::South, player._pDFrames, 1); - player.AnimInfo.CurrentFrame = player.AnimInfo.NumberOfFrames - 2; + player.AnimInfo.currentFrame = player.AnimInfo.numberOfFrames - 2; dFlags[player.position.tile.x][player.position.tile.y] |= DungeonFlag::DeadPlayer; } diff --git a/Source/player.cpp b/Source/player.cpp index ea05f500a..0063c391e 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -659,14 +659,14 @@ bool DoWalk(int pnum, int variant) // Play walking sound effect on certain animation frames if (*sgOptions.Audio.walkingSound && (leveltype != DTYPE_TOWN || sgGameInitInfo.bRunInTown == 0)) { - if (player.AnimInfo.CurrentFrame == 0 - || player.AnimInfo.CurrentFrame == 4) { + if (player.AnimInfo.currentFrame == 0 + || player.AnimInfo.currentFrame == 4) { PlaySfxLoc(PS_WALK1, player.position.tile); } } // Check if we reached new tile - if (player.AnimInfo.CurrentFrame >= player._pWFrames - 1) { + if (player.AnimInfo.currentFrame >= player._pWFrames - 1) { // Update the player's tile position switch (variant) { @@ -1073,13 +1073,13 @@ bool DoAttack(int pnum) } Player &player = Players[pnum]; - if (player.AnimInfo.CurrentFrame == player._pAFNum - 2) { + if (player.AnimInfo.currentFrame == player._pAFNum - 2) { PlaySfxLoc(PS_SWING, player.position.tile); } bool didhit = false; - if (player.AnimInfo.CurrentFrame == player._pAFNum - 1) { + if (player.AnimInfo.currentFrame == player._pAFNum - 1) { Point position = player.position.tile + player._pdir; int dx = position.x; int dy = position.y; @@ -1166,7 +1166,7 @@ bool DoAttack(int pnum) } } - if (player.AnimInfo.CurrentFrame == player._pAFrames - 1) { + if (player.AnimInfo.currentFrame == player._pAFrames - 1) { StartStand(pnum, player._pdir); ClearStateVariables(player); return true; @@ -1183,11 +1183,11 @@ bool DoRangeAttack(int pnum) Player &player = Players[pnum]; int arrows = 0; - if (player.AnimInfo.CurrentFrame == player._pAFNum - 1) { + if (player.AnimInfo.currentFrame == player._pAFNum - 1) { arrows = 1; } - if (HasAnyOf(player._pIFlags, ItemSpecialEffect::MultipleArrows) && player.AnimInfo.CurrentFrame == player._pAFNum + 1) { + if (HasAnyOf(player._pIFlags, ItemSpecialEffect::MultipleArrows) && player.AnimInfo.currentFrame == player._pAFNum + 1) { arrows = 2; } @@ -1238,7 +1238,7 @@ bool DoRangeAttack(int pnum) } } - if (player.AnimInfo.CurrentFrame >= player._pAFrames - 1) { + if (player.AnimInfo.currentFrame >= player._pAFrames - 1) { StartStand(pnum, player._pdir); ClearStateVariables(player); return true; @@ -1282,7 +1282,7 @@ bool DoBlock(int pnum) } Player &player = Players[pnum]; - if (player.AnimInfo.CurrentFrame >= player._pBFrames - 1) { + if (player.AnimInfo.currentFrame >= player._pBFrames - 1) { StartStand(pnum, player._pdir); ClearStateVariables(player); @@ -1343,7 +1343,7 @@ bool DoSpell(int pnum) } Player &player = Players[pnum]; - if (player.AnimInfo.CurrentFrame == player._pSFNum) { + if (player.AnimInfo.currentFrame == player._pSFNum) { CastSpell( pnum, player._pSpell, @@ -1358,7 +1358,7 @@ bool DoSpell(int pnum) } } - if (player.AnimInfo.CurrentFrame >= player._pSFrames - 1) { + if (player.AnimInfo.currentFrame >= player._pSFrames - 1) { StartStand(pnum, player._pdir); ClearStateVariables(player); return true; @@ -1374,7 +1374,7 @@ bool DoGotHit(int pnum) } Player &player = Players[pnum]; - if (player.AnimInfo.CurrentFrame >= player._pHFrames - 1) { + if (player.AnimInfo.currentFrame >= player._pHFrames - 1) { StartStand(pnum, player._pdir); ClearStateVariables(player); if (GenerateRnd(4) != 0) { @@ -1389,11 +1389,11 @@ bool DoGotHit(int pnum) bool DoDeath(Player &player) { - if (player.AnimInfo.CurrentFrame == player.AnimInfo.NumberOfFrames - 1) { - if (player.AnimInfo.TickCounterOfCurrentFrame == 0) { - player.AnimInfo.TicksPerFrame = 100; + if (player.AnimInfo.currentFrame == player.AnimInfo.numberOfFrames - 1) { + if (player.AnimInfo.tickCounterOfCurrentFrame == 0) { + player.AnimInfo.ticksPerFrame = 100; dFlags[player.position.tile.x][player.position.tile.y] |= DungeonFlag::DeadPlayer; - } else if (&player == MyPlayer && player.AnimInfo.TickCounterOfCurrentFrame == 30) { + } else if (&player == MyPlayer && player.AnimInfo.tickCounterOfCurrentFrame == 30) { MyPlayerIsDead = true; if (!gbIsMultiplayer) { gamemenu_on(); @@ -1694,7 +1694,7 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) return; } - if (player._pmode == PM_ATTACK && player.AnimInfo.CurrentFrame >= player._pAFNum) { + if (player._pmode == PM_ATTACK && player.AnimInfo.currentFrame >= player._pAFNum) { if (player.destAction == ACTION_ATTACK) { d = GetDirection(player.position.future, { player.destParam1, player.destParam2 }); StartAttack(pnum, d); @@ -1725,7 +1725,7 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) } } - if (player._pmode == PM_RATTACK && player.AnimInfo.CurrentFrame >= player._pAFNum) { + if (player._pmode == PM_RATTACK && player.AnimInfo.currentFrame >= player._pAFNum) { if (player.destAction == ACTION_RATTACK) { d = GetDirection(player.position.tile, { player.destParam1, player.destParam2 }); StartRangeAttack(pnum, d, player.destParam1, player.destParam2); @@ -1741,7 +1741,7 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) } } - if (player._pmode == PM_SPELL && player.AnimInfo.CurrentFrame >= player._pSFNum) { + if (player._pmode == PM_SPELL && player.AnimInfo.currentFrame >= player._pSFNum) { if (player.destAction == ACTION_SPELL) { d = GetDirection(player.position.tile, { player.destParam1, player.destParam2 }); StartSpell(pnum, d, player.destParam1, player.destParam2); @@ -2348,7 +2348,7 @@ void NewPlrAnim(Player &player, player_graphic graphic, Direction dir, int8_t nu float previewShownGameTickFragments = 0.F; if (celSprite == player.previewCelSprite && !player.IsWalking()) previewShownGameTickFragments = clamp(1.F - player.progressToNextGameTickWhenPreviewWasSet, 0.F, 1.F); - player.AnimInfo.SetNewAnimation(celSprite, numberOfFrames, delayLen, flags, numSkippedFrames, distributeFramesBeforeFrame, previewShownGameTickFragments); + player.AnimInfo.setNewAnimation(celSprite, numberOfFrames, delayLen, flags, numSkippedFrames, distributeFramesBeforeFrame, previewShownGameTickFragments); } void SetPlrAnims(Player &player) @@ -2764,12 +2764,12 @@ void InitPlayer(Player &player, bool firstTime) if (player._pHitPoints >> 6 > 0) { player._pmode = PM_STAND; NewPlrAnim(player, player_graphic::Stand, Direction::South, player._pNFrames, 4); - player.AnimInfo.CurrentFrame = GenerateRnd(player._pNFrames - 1); - player.AnimInfo.TickCounterOfCurrentFrame = GenerateRnd(3); + player.AnimInfo.currentFrame = GenerateRnd(player._pNFrames - 1); + player.AnimInfo.tickCounterOfCurrentFrame = GenerateRnd(3); } else { player._pmode = PM_DEATH; NewPlrAnim(player, player_graphic::Death, Direction::South, player._pDFrames, 2); - player.AnimInfo.CurrentFrame = player.AnimInfo.NumberOfFrames - 2; + player.AnimInfo.currentFrame = player.AnimInfo.numberOfFrames - 2; } player._pdir = Direction::South; @@ -3395,8 +3395,8 @@ void ProcessPlayers() } while (tplayer); player.previewCelSprite = std::nullopt; - if (player._pmode != PM_DEATH || player.AnimInfo.TickCounterOfCurrentFrame != 40) - player.AnimInfo.ProcessAnimation(); + if (player._pmode != PM_DEATH || player.AnimInfo.tickCounterOfCurrentFrame != 40) + player.AnimInfo.processAnimation(); } } } diff --git a/Source/player.h b/Source/player.h index 3315a71cf..e7d25cee2 100644 --- a/Source/player.h +++ b/Source/player.h @@ -690,13 +690,13 @@ struct Player { { if (_pmode == PM_STAND) return true; - if (_pmode == PM_ATTACK && AnimInfo.CurrentFrame >= _pAFNum) + if (_pmode == PM_ATTACK && AnimInfo.currentFrame >= _pAFNum) return true; - if (_pmode == PM_RATTACK && AnimInfo.CurrentFrame >= _pAFNum) + if (_pmode == PM_RATTACK && AnimInfo.currentFrame >= _pAFNum) return true; - if (_pmode == PM_SPELL && AnimInfo.CurrentFrame >= _pSFNum) + if (_pmode == PM_SPELL && AnimInfo.currentFrame >= _pSFNum) return true; - if (IsWalking() && AnimInfo.CurrentFrame == AnimInfo.NumberOfFrames - 1) + if (IsWalking() && AnimInfo.currentFrame == AnimInfo.numberOfFrames - 1) return true; return false; } diff --git a/Source/qol/itemlabels.cpp b/Source/qol/itemlabels.cpp index 435ff1b66..ecd105495 100644 --- a/Source/qol/itemlabels.cpp +++ b/Source/qol/itemlabels.cpp @@ -80,7 +80,7 @@ void AddItemToLabelQueue(int id, int x, int y) nameWidth += MarginX * 2; int index = ItemCAnimTbl[item._iCurs]; if (!labelCenterOffsets[index]) { - std::pair itemBounds = MeasureSolidHorizontalBounds(*item.AnimInfo.celSprite, item.AnimInfo.CurrentFrame); + std::pair itemBounds = MeasureSolidHorizontalBounds(*item.AnimInfo.celSprite, item.AnimInfo.currentFrame); labelCenterOffsets[index].emplace((itemBounds.first + itemBounds.second) / 2); } diff --git a/Source/track.cpp b/Source/track.cpp index 57d46e88c..4172cf081 100644 --- a/Source/track.cpp +++ b/Source/track.cpp @@ -23,7 +23,7 @@ void RepeatWalk(Player &player) if (!InDungeonBounds(cursPosition)) return; - if (player._pmode != PM_STAND && !(player.IsWalking() && player.AnimInfo.GetFrameToUseForRendering() > 6)) + if (player._pmode != PM_STAND && !(player.IsWalking() && player.AnimInfo.getFrameToUseForRendering() > 6)) return; const Point target = player.GetTargetPosition(); diff --git a/test/animationinfo_test.cpp b/test/animationinfo_test.cpp index b3c843244..47650a6b5 100644 --- a/test/animationinfo_test.cpp +++ b/test/animationinfo_test.cpp @@ -20,7 +20,7 @@ struct TestData { }; /** - * @brief Represents a call to SetNewAnimation + * @brief Represents a call to setNewAnimation */ struct SetNewAnimationData : public TestData { SetNewAnimationData(int numberOfFrames, int delayLen, AnimationDistributionFlags params = AnimationDistributionFlags::None, int numSkippedFrames = 0, int distributeFramesBeforeFrame = 0) @@ -45,7 +45,7 @@ struct SetNewAnimationData : public TestData { }; /** - * @brief Represents a GameTick, this includes skipping of Frames (for example because of Fastest Attack Modifier) and ProcessAnimation (which also updates Animation Frame/Count). + * @brief Represents a GameTick, this includes skipping of Frames (for example because of Fastest Attack Modifier) and processAnimation (which also updates Animation Frame/Count). */ struct GameTickData : TestData { int _ExpectedAnimationFrame; @@ -99,23 +99,23 @@ void RunAnimationTest(const std::vector &vecTestData) switch (x->type()) { case TestDataType::SetNewAnimation: { auto setNewAnimationData = static_cast(x); - animInfo.SetNewAnimation(std::nullopt, setNewAnimationData->_NumberOfFrames, setNewAnimationData->_DelayLen, setNewAnimationData->_Params, setNewAnimationData->_NumSkippedFrames, setNewAnimationData->_DistributeFramesBeforeFrame); + animInfo.setNewAnimation(std::nullopt, setNewAnimationData->_NumberOfFrames, setNewAnimationData->_DelayLen, setNewAnimationData->_Params, setNewAnimationData->_NumSkippedFrames, setNewAnimationData->_DistributeFramesBeforeFrame); } break; case TestDataType::GameTick: { auto gameTickData = static_cast(x); currentGameTick += 1; - animInfo.ProcessAnimation(); - EXPECT_EQ(animInfo.CurrentFrame, gameTickData->_ExpectedAnimationFrame); - EXPECT_EQ(animInfo.TickCounterOfCurrentFrame, gameTickData->_ExpectedAnimationCnt); + animInfo.processAnimation(); + EXPECT_EQ(animInfo.currentFrame, gameTickData->_ExpectedAnimationFrame); + EXPECT_EQ(animInfo.tickCounterOfCurrentFrame, gameTickData->_ExpectedAnimationCnt); } break; case TestDataType::Rendering: { auto renderingData = static_cast(x); gfProgressToNextGameTick = renderingData->_fProgressToNextGameTick; - EXPECT_EQ(animInfo.GetFrameToUseForRendering(), renderingData->_ExpectedRenderingFrame) + EXPECT_EQ(animInfo.getFrameToUseForRendering(), renderingData->_ExpectedRenderingFrame) << std::fixed << std::setprecision(2) << "ProgressToNextGameTick: " << renderingData->_fProgressToNextGameTick - << " CurrentFrame: " << animInfo.CurrentFrame - << " DelayCounter: " << animInfo.TickCounterOfCurrentFrame + << " currentFrame: " << animInfo.currentFrame + << " DelayCounter: " << animInfo.tickCounterOfCurrentFrame << " GameTick: " << currentGameTick; } break; } @@ -130,7 +130,7 @@ TEST(AnimationInfo, AttackSwordWarrior) // ProcessAnimationPending should be con RunAnimationTest( { new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), - // ProcessAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. + // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(1, 0), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), @@ -184,7 +184,7 @@ TEST(AnimationInfo, AttackSwordWarrior) // ProcessAnimationPending should be con new RenderingData(0.6f, 14), new GameTickData(15, 0), new RenderingData(0.6f, 15), - // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame == plr[pnum]._pAFrames - 1) {" + // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.currentFrame == plr[pnum]._pAFrames - 1) {" }); } @@ -193,7 +193,7 @@ TEST(AnimationInfo, AttackSwordWarriorWithFastestAttack) // Skipped frames and P RunAnimationTest( { new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 2, 9), - // ProcessAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. + // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(3, 0), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), @@ -237,7 +237,7 @@ TEST(AnimationInfo, AttackSwordWarriorWithFastestAttack) // Skipped frames and P new RenderingData(0.6f, 14), new GameTickData(15, 0), new RenderingData(0.6f, 15), - // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame == plr[pnum]._pAFrames - 1) {" + // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.currentFrame == plr[pnum]._pAFrames - 1) {" }); } @@ -249,7 +249,7 @@ TEST(AnimationInfo, AttackSwordWarriorRepeated) RunAnimationTest( { new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), - // ProcessAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. + // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(1, 0), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), @@ -292,9 +292,9 @@ TEST(AnimationInfo, AttackSwordWarriorRepeated) new GameTickData(9, 0), new RenderingData(0.3f, 9), - // Start of repeated attack, cause plr[pnum].AnimInfo.CurrentFrame > plr[myplr]._pAFNum + // Start of repeated attack, cause plr[pnum].AnimInfo.currentFrame > plr[myplr]._pAFNum new SetNewAnimationData(16, 1, static_cast(AnimationDistributionFlags::ProcessAnimationPending | AnimationDistributionFlags::RepeatedAction), 0, 9), - // ProcessAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. + // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(1, 0), new RenderingData(0.0f, 10), new RenderingData(0.3f, 10), @@ -348,7 +348,7 @@ TEST(AnimationInfo, AttackSwordWarriorRepeated) new RenderingData(0.6f, 14), new GameTickData(15, 0), new RenderingData(0.6f, 15), - // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame == plr[pnum]._pAFrames - 1) {" + // Animation stopped cause PM_DoAttack would stop the Animation "if (plr[pnum].AnimInfo.currentFrame == plr[pnum]._pAFrames - 1) {" }); } @@ -376,7 +376,7 @@ TEST(AnimationInfo, BlockingWarriorNormal) // Ignored delay for last Frame shoul new RenderingData(0.3f, 1), new RenderingData(0.6f, 1), new RenderingData(0.8f, 1), - // Animation stopped cause PM_DoBlock would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame >= plr[pnum]._pBFrames) {" + // Animation stopped cause PM_DoBlock would stop the Animation "if (plr[pnum].AnimInfo.currentFrame >= plr[pnum]._pBFrames) {" }); } @@ -404,7 +404,7 @@ TEST(AnimationInfo, BlockingSorcererWithFastBlock) // Skipped frames and ignored new RenderingData(0.3f, 4), new RenderingData(0.6f, 5), new RenderingData(0.8f, 5), - // Animation stopped cause PM_DoBlock would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame >= plr[pnum]._pBFrames) {" + // Animation stopped cause PM_DoBlock would stop the Animation "if (plr[pnum].AnimInfo.currentFrame >= plr[pnum]._pBFrames) {" }); } @@ -432,7 +432,7 @@ TEST(AnimationInfo, HitRecoverySorcererZenMode) // Skipped frames and ignored de new RenderingData(0.3f, 6), new RenderingData(0.6f, 7), new RenderingData(0.8f, 7), - // Animation stopped cause PM_DoGotHit would stop the Animation "if (plr[pnum].AnimInfo.CurrentFrame >= plr[pnum]._pHFrames) {" + // Animation stopped cause PM_DoGotHit would stop the Animation "if (plr[pnum].AnimInfo.currentFrame >= plr[pnum]._pHFrames) {" }); } TEST(AnimationInfo, Stand) // Distribution Logic shouldn't change anything here diff --git a/test/player_test.cpp b/test/player_test.cpp index 50e4e51e3..5bfb9ab2c 100644 --- a/test/player_test.cpp +++ b/test/player_test.cpp @@ -22,7 +22,7 @@ int RunBlockTest(int frames, ItemSpecialEffect flags) TestPlayerDoGotHit(pnum); if (player._pmode != PM_GOTHIT) break; - player.AnimInfo.CurrentFrame++; + player.AnimInfo.currentFrame++; } return i; diff --git a/test/writehero_test.cpp b/test/writehero_test.cpp index 38924c6e7..d261143d6 100644 --- a/test/writehero_test.cpp +++ b/test/writehero_test.cpp @@ -264,10 +264,10 @@ static void AssertPlayer(Player &player) ASSERT_EQ(player._pmode, 0); ASSERT_EQ(Count8(player.walkpath, MaxPathLength), 25); ASSERT_EQ(player._pgfxnum, 36); - ASSERT_EQ(player.AnimInfo.TicksPerFrame, 4); - ASSERT_EQ(player.AnimInfo.TickCounterOfCurrentFrame, 1); - ASSERT_EQ(player.AnimInfo.NumberOfFrames, 20); - ASSERT_EQ(player.AnimInfo.CurrentFrame, 0); + ASSERT_EQ(player.AnimInfo.ticksPerFrame, 4); + ASSERT_EQ(player.AnimInfo.tickCounterOfCurrentFrame, 1); + ASSERT_EQ(player.AnimInfo.numberOfFrames, 20); + ASSERT_EQ(player.AnimInfo.currentFrame, 0); ASSERT_EQ(player._pSpell, -1); ASSERT_EQ(player._pSplType, 4); ASSERT_EQ(player._pSplFrom, 0);