diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 79f18d76196..d00de2ef435 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -177,7 +177,7 @@ void AnimationInfo::setNewAnimation(OptionalClxSpriteList celSprite, int8_t numb } } -void AnimationInfo::changeAnimationData(OptionalClxSpriteList celSprite, int8_t numberOfFrames, int8_t ticksPerFrame) +void AnimationInfo::changeanimationData(OptionalClxSpriteList celSprite, int8_t numberOfFrames, int8_t ticksPerFrame) { 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 diff --git a/Source/engine/animationinfo.h b/Source/engine/animationinfo.h index ae0947f7a5f..5d51b8918be 100644 --- a/Source/engine/animationinfo.h +++ b/Source/engine/animationinfo.h @@ -100,7 +100,7 @@ class AnimationInfo { * @param numberOfFrames Number of Frames in Animation * @param ticksPerFrame How many game ticks are needed to advance one Animation Frame */ - void changeAnimationData(OptionalClxSpriteList sprites, int8_t numberOfFrames, int8_t ticksPerFrame); + void changeanimationData(OptionalClxSpriteList sprites, int8_t numberOfFrames, int8_t ticksPerFrame); /** * @brief Process the Animation for a game tick (for example advances the frame) diff --git a/Source/items.cpp b/Source/items.cpp index ac61ba57e9f..f68ae68a361 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2811,8 +2811,8 @@ void CalcPlrGraphics(Player &player, PlayerWeaponGraphic animWeaponId, PlayerArm LoadPlrGFX(player, graphic); OptionalClxSpriteList sprites; if (!HeadlessMode) - sprites = player.AnimationData[static_cast(graphic)].spritesForDirection(player._pdir); - player.AnimInfo.changeAnimationData(sprites, numberOfFrames, ticksPerFrame); + sprites = player.animationData[static_cast(graphic)].spritesForDirection(player._pdir); + player.AnimInfo.changeanimationData(sprites, numberOfFrames, ticksPerFrame); } else { player._pgfxnum = gfxNum; } diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 0c0dd1533ad..baf76900c51 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -2548,7 +2548,7 @@ void LoadGame(bool firstflag) } } - SetUpMissileAnimationData(); + SetUpMissileanimationData(); RedoMissileFlags(); NewCursor(CURSOR_HAND); gbProcessPlayers = IsDiabloAlive(!firstflag); diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 8f1d2cf9a96..ff0b4785d99 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -4175,7 +4175,7 @@ void ProcessMissiles() DeleteMissiles(); } -void SetUpMissileAnimationData() +void SetUpMissileanimationData() { for (auto &missile : Missiles) { if (missile._miAnimType == MissileGraphicID::None) diff --git a/Source/missiles.h b/Source/missiles.h index 444f12d3adb..4845c08ecf5 100644 --- a/Source/missiles.h +++ b/Source/missiles.h @@ -454,7 +454,7 @@ void ProcessBoneSpirit(Missile &missile); void ProcessResurrectBeam(Missile &missile); void ProcessRedPortal(Missile &missile); void ProcessMissiles(); -void SetUpMissileAnimationData(); +void SetUpMissileanimationData(); void RedoMissileFlags(); #ifdef BUILD_TESTING diff --git a/Source/monster.cpp b/Source/monster.cpp index c2bde27e185..608484145e7 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -146,7 +146,7 @@ void InitMonster(Monster &monster, Direction rd, size_t typeIndex, Point positio monster.levelType = static_cast(typeIndex); monster.mode = MonsterMode::Stand; monster.animInfo = {}; - monster.changeAnimationData(MonsterGraphic::Stand); + monster.changeanimationData(MonsterGraphic::Stand); monster.animInfo.tickCounterOfCurrentFrame = GenerateRnd(monster.animInfo.ticksPerFrame - 1); monster.animInfo.currentFrame = GenerateRnd(monster.animInfo.numberOfFrames - 1); @@ -187,7 +187,7 @@ void InitMonster(Monster &monster, Direction rd, size_t typeIndex, Point positio monster.talkMsg = TEXT_NONE; if (monster.ai == MonsterAIID::Gargoyle) { - monster.changeAnimationData(MonsterGraphic::Special); + monster.changeanimationData(MonsterGraphic::Special); monster.animInfo.currentFrame = 0; monster.flags |= MFLAG_ALLOW_SPECIAL; monster.mode = MonsterMode::SpecialMeleeAttack; @@ -302,7 +302,7 @@ void PlaceGroup(size_t typeIndex, size_t num, Monster *leader = nullptr, bool le } if (minion.ai != MonsterAIID::Gargoyle) { - minion.changeAnimationData(MonsterGraphic::Stand); + minion.changeanimationData(MonsterGraphic::Stand); minion.animInfo.currentFrame = GenerateRnd(minion.animInfo.numberOfFrames - 1); minion.flags &= ~MFLAG_ALLOW_SPECIAL; minion.mode = MonsterMode::Stand; @@ -983,7 +983,7 @@ void StartFadeout(Monster &monster, Direction md, bool backwards) */ void StartHeal(Monster &monster) { - monster.changeAnimationData(MonsterGraphic::Special); + monster.changeanimationData(MonsterGraphic::Special); monster.animInfo.currentFrame = monster.type().getAnimData(MonsterGraphic::Special).frames - 1; monster.flags |= MFLAG_LOCK_ANIMATION; monster.mode = MonsterMode::Heal; @@ -1002,9 +1002,9 @@ void SyncLightPosition(Monster &monster) void MonsterIdle(Monster &monster) { if (monster.type().type == MT_GOLEM) - monster.changeAnimationData(MonsterGraphic::Walk); + monster.changeanimationData(MonsterGraphic::Walk); else - monster.changeAnimationData(MonsterGraphic::Stand); + monster.changeanimationData(MonsterGraphic::Stand); if (monster.animInfo.isLastFrame()) UpdateEnemy(monster); @@ -1484,7 +1484,7 @@ bool MonsterSpecialStand(Monster &monster) bool MonsterDelay(Monster &monster) { - monster.changeAnimationData(MonsterGraphic::Stand, GetMonsterDirection(monster)); + monster.changeanimationData(MonsterGraphic::Stand, GetMonsterDirection(monster)); if (monster.ai == MonsterAIID::Lazarus) { if (monster.var2 > 8 || monster.var2 < 0) monster.var2 = 8; @@ -2432,7 +2432,7 @@ void SneakAi(Monster &monster) } if (monster.mode == MonsterMode::Stand) { if (distanceToEnemy >= 2 || v >= 4 * monster.intelligence + 10) - monster.changeAnimationData(MonsterGraphic::Stand); + monster.changeanimationData(MonsterGraphic::Stand); else StartAttack(monster); } @@ -3239,7 +3239,7 @@ void PrepareUniqueMonst(Monster &monster, UniqueMonsterType monsterType, size_t } if (monster.ai != MonsterAIID::Gargoyle) { - monster.changeAnimationData(MonsterGraphic::Stand); + monster.changeanimationData(MonsterGraphic::Stand); monster.animInfo.currentFrame = GenerateRnd(monster.animInfo.numberOfFrames - 1); monster.flags &= ~MFLAG_ALLOW_SPECIAL; monster.mode = MonsterMode::Stand; @@ -4285,7 +4285,7 @@ void SyncMonsterAnim(Monster &monster) break; } - monster.changeAnimationData(graphic); + monster.changeanimationData(graphic); } void M_FallenFear(Point position) @@ -4721,7 +4721,7 @@ void Monster::checkStandAnimationIsLoaded(Direction mdir) { if (IsAnyOf(mode, MonsterMode::Stand, MonsterMode::Talk)) { direction = mdir; - changeAnimationData(MonsterGraphic::Stand); + changeanimationData(MonsterGraphic::Stand); } } diff --git a/Source/monster.h b/Source/monster.h index 44d46ed31a5..be59842526c 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -288,21 +288,21 @@ struct Monster { // note: missing field _mAFNum * @param graphic Animation sequence of interest * @param desiredDirection Desired desiredDirection the monster should be visually facing */ - void changeAnimationData(MonsterGraphic graphic, Direction desiredDirection) + void changeanimationData(MonsterGraphic graphic, Direction desiredDirection) { const AnimStruct &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.spritesForDirection(desiredDirection), animationData.frames, animationData.rate); + this->animInfo.changeanimationData(animationData.spritesForDirection(desiredDirection), animationData.frames, animationData.rate); } /** * @brief Sets the current cell sprite to match the desired animation sequence using the direction the monster is currently facing * @param graphic Animation sequence of interest */ - void changeAnimationData(MonsterGraphic graphic) + void changeanimationData(MonsterGraphic graphic) { - this->changeAnimationData(graphic, this->direction); + this->changeanimationData(graphic, this->direction); } /** diff --git a/Source/player.cpp b/Source/player.cpp index 7f21af54eff..423794c7cd5 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1996,7 +1996,7 @@ void Player::UpdatePreviewCelSprite(_cmd_id cmdId, Point point, uint16_t wParam1 return; LoadPlrGFX(*this, *graphic); - ClxSpriteList sprites = AnimationData[static_cast(*graphic)].spritesForDirection(dir); + ClxSpriteList sprites = animationData[static_cast(*graphic)].spritesForDirection(dir); if (!previewCelSprite || *previewCelSprite != sprites[0]) { previewCelSprite = sprites[0]; progressToNextGameTickWhenPreviewWasSet = ProgressToNextGameTick; @@ -2075,7 +2075,7 @@ void LoadPlrGFX(Player &player, player_graphic graphic) if (HeadlessMode) return; - auto &animationData = player.AnimationData[static_cast(graphic)]; + auto &animationData = player.animationData[static_cast(graphic)]; if (animationData.sprites) return; @@ -2170,7 +2170,7 @@ void InitPlayerGFX(Player &player) void ResetPlayerGFX(Player &player) { player.AnimInfo.sprites = std::nullopt; - for (PlayerAnimationData &animData : player.AnimationData) { + for (PlayeranimationData &animData : player.animationData) { animData.sprites = std::nullopt; } } @@ -2182,7 +2182,7 @@ void NewPlrAnim(Player &player, player_graphic graphic, Direction dir, Animation OptionalClxSpriteList sprites; int previewShownGameTickFragments = 0; if (!HeadlessMode) { - sprites = player.AnimationData[static_cast(graphic)].spritesForDirection(dir); + sprites = player.animationData[static_cast(graphic)].spritesForDirection(dir); if (player.previewCelSprite && (*sprites)[0] == *player.previewCelSprite && !player.isWalking()) { previewShownGameTickFragments = std::clamp(AnimationInfo::baseValueFraction - player.progressToNextGameTickWhenPreviewWasSet, 0, AnimationInfo::baseValueFraction); } @@ -3207,7 +3207,7 @@ void SyncPlrAnim(Player &player) { const player_graphic graphic = player.getGraphic(); if (!HeadlessMode) - player.AnimInfo.sprites = player.AnimationData[static_cast(graphic)].spritesForDirection(player._pdir); + player.AnimInfo.sprites = player.animationData[static_cast(graphic)].spritesForDirection(player._pdir); } void SyncInitPlrPos(Player &player) diff --git a/Source/player.h b/Source/player.h index a6c392c5413..b7c92da122a 100644 --- a/Source/player.h +++ b/Source/player.h @@ -191,7 +191,7 @@ constexpr std::array CharChar = { /** * @brief Contains Data (CelSprites) for a player graphic (player_graphic) */ -struct PlayerAnimationData { +struct PlayeranimationData { /** * @brief Sprite lists for each of the 8 directions. */ @@ -285,9 +285,9 @@ struct Player { /** @brief Bitmask using item_special_effect */ ItemSpecialEffect _pIFlags; /** - * @brief Contains Data (Sprites) for the different Animations + * @brief Contains Data (Sprites) for the different Animations (AnimationData) */ - std::array::value> AnimationData; + std::array::value> animationData; int8_t _pNFrames; int8_t _pWFrames; int8_t _pAFrames; diff --git a/test/animationinfo_test.cpp b/test/animationinfo_test.cpp index 84508275572..75811241644 100644 --- a/test/animationinfo_test.cpp +++ b/test/animationinfo_test.cpp @@ -22,8 +22,8 @@ struct TestData { /** * @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) +struct SetNewanimationData : public TestData { + SetNewanimationData(int numberOfFrames, int delayLen, AnimationDistributionFlags params = AnimationDistributionFlags::None, int numSkippedFrames = 0, int distributeFramesBeforeFrame = 0) { _NumberOfFrames = numberOfFrames; _DelayLen = delayLen; @@ -98,8 +98,8 @@ void RunAnimationTest(const std::vector &vecTestData) for (TestData *x : 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); + auto setNewanimationData = static_cast(x); + animInfo.setNewAnimation(std::nullopt, setNewanimationData->_NumberOfFrames, setNewanimationData->_DelayLen, setNewanimationData->_Params, setNewanimationData->_NumSkippedFrames, setNewanimationData->_DistributeFramesBeforeFrame); } break; case TestDataType::GameTick: { auto gameTickData = static_cast(x); @@ -129,7 +129,7 @@ TEST(AnimationInfo, AttackSwordWarrior) // ProcessAnimationPending should be con { RunAnimationTest( { - new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), + new SetNewanimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(1, 0), new RenderingData(0.0f, 0), @@ -192,7 +192,7 @@ TEST(AnimationInfo, AttackSwordWarriorWithFastestAttack) // Skipped frames and P { RunAnimationTest( { - new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 2, 9), + new SetNewanimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 2, 9), // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(3, 0), new RenderingData(0.0f, 0), @@ -248,7 +248,7 @@ TEST(AnimationInfo, AttackSwordWarriorRepeated) { RunAnimationTest( { - new SetNewAnimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), + new SetNewanimationData(16, 1, AnimationDistributionFlags::ProcessAnimationPending, 0, 9), // processAnimation directly after StartAttack (in same GameTick). So we don't see any rendering before. new GameTickData(1, 0), new RenderingData(0.0f, 0), @@ -293,7 +293,7 @@ TEST(AnimationInfo, AttackSwordWarriorRepeated) new RenderingData(0.3f, 9), // Start of repeated attack, cause plr[pnum].AnimInfo.currentFrame > plr[myplr]._pAFNum - new SetNewAnimationData(16, 1, static_cast(AnimationDistributionFlags::ProcessAnimationPending | AnimationDistributionFlags::RepeatedAction), 0, 9), + 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. new GameTickData(1, 0), new RenderingData(0.0f, 10), @@ -356,7 +356,7 @@ TEST(AnimationInfo, BlockingWarriorNormal) // Ignored delay for last Frame shoul { RunAnimationTest( { - new SetNewAnimationData(2, 3, AnimationDistributionFlags::SkipsDelayOfLastFrame), + new SetNewanimationData(2, 3, AnimationDistributionFlags::SkipsDelayOfLastFrame), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), new RenderingData(0.6f, 0), @@ -384,7 +384,7 @@ TEST(AnimationInfo, BlockingSorcererWithFastBlock) // Skipped frames and ignored { RunAnimationTest( { - new SetNewAnimationData(6, 3, AnimationDistributionFlags::SkipsDelayOfLastFrame, 4), + new SetNewanimationData(6, 3, AnimationDistributionFlags::SkipsDelayOfLastFrame, 4), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), new RenderingData(0.6f, 0), @@ -412,7 +412,7 @@ TEST(AnimationInfo, HitRecoverySorcererHarmony) // Skipped frames and ignored de { RunAnimationTest( { - new SetNewAnimationData(8, 1, AnimationDistributionFlags::None, 3), + new SetNewanimationData(8, 1, AnimationDistributionFlags::None, 3), new RenderingData(0.0f, 0), new RenderingData(0.3f, 0), new RenderingData(0.6f, 0), @@ -444,7 +444,7 @@ TEST(AnimationInfo, Stand) // Distribution Logic shouldn't change anything here { RunAnimationTest( { - new SetNewAnimationData(10, 4), + new SetNewanimationData(10, 4), new RenderingData(0.1f, 0), new GameTickData(0, 1), new RenderingData(0.6f, 0),