diff --git a/Source/automap.cpp b/Source/automap.cpp index 3a91776aa..5ba4a8d32 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -1320,9 +1320,6 @@ void DrawAutomapPlr(const Surface &out, const Displacement &myPlayerOffset, cons const uint8_t playerColor = MapColorsPlayer + (8 * player.getId()) % 128; Point tile = player.position.tile; - if (player._pmode == PM_WALK_SIDEWAYS) { - tile = player.position.future; - } int px = tile.x - 2 * AutomapOffset.deltaX - ViewPosition.x; int py = tile.y - 2 * AutomapOffset.deltaY - ViewPosition.y; diff --git a/Source/engine/actor_position.cpp b/Source/engine/actor_position.cpp index 7d98ab40e..f2bf2f849 100644 --- a/Source/engine/actor_position.cpp +++ b/Source/engine/actor_position.cpp @@ -94,11 +94,11 @@ constexpr std::array WalkParameters { { // Direction startingOffset, VelocityX, VelocityY { /* South */ { 0, 0 }, VelocityToUse::None, VelocityToUse::Half }, { /* SouthWest */ { 0, 0 }, VelocityToUse::NegativeHalf, VelocityToUse::Quarter }, - { /* West */ { 512, -256 }, VelocityToUse::NegativeFull, VelocityToUse::None }, + { /* West */ { 0, 0 }, VelocityToUse::NegativeFull, VelocityToUse::None }, { /* NorthWest */ { 0, 0 }, VelocityToUse::NegativeHalf, VelocityToUse::NegativeQuarter }, { /* North */ { 0, 0 }, VelocityToUse::None, VelocityToUse::NegativeHalf }, { /* NorthEast */ { 0, 0 }, VelocityToUse::Half, VelocityToUse::NegativeQuarter }, - { /* East */ { -512, -256 }, VelocityToUse::Full, VelocityToUse::None }, + { /* East */ { 0, 0 }, VelocityToUse::Full, VelocityToUse::None }, { /* SouthEast */ { 0, 0 }, VelocityToUse::Half, VelocityToUse::Quarter } // clang-format on } }; diff --git a/Source/engine/render/scrollrt.cpp b/Source/engine/render/scrollrt.cpp index eb7015e7a..3a74fa97f 100644 --- a/Source/engine/render/scrollrt.cpp +++ b/Source/engine/render/scrollrt.cpp @@ -1334,7 +1334,6 @@ Displacement GetOffsetForWalking(const AnimationInfo &animationInfo, const Direc { // clang-format off // South, SouthWest, West, NorthWest, North, NorthEast, East, SouthEast, - constexpr Displacement StartOffset[8] = { { 0, 0 }, { 0, 0 }, { 64, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { -64, 0 }, { 0, 0 } }; constexpr Displacement MovingOffset[8] = { { 0, 32 }, { -32, 16 }, { -64, 0 }, { -32, -16 }, { 0, -32 }, { 32, -16 }, { 64, 0 }, { 32, 16 } }; // clang-format on @@ -1345,8 +1344,6 @@ Displacement GetOffsetForWalking(const AnimationInfo &animationInfo, const Direc if (cameraMode) { offset = -offset; - } else { - offset += StartOffset[static_cast(dir)]; } return offset; diff --git a/Source/monster.cpp b/Source/monster.cpp index 135fd828f..78b53ef3a 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -710,7 +710,7 @@ void StartSpecialStand(Monster &monster, Direction md) monster.position.old = monster.position.tile; } -void WalkNonSideways(Monster &monster, int xadd, int yadd, Direction endDir) +void Walk(Monster &monster, int xadd, int yadd, Direction endDir) { const auto fx = static_cast(xadd + monster.position.tile.x); const auto fy = static_cast(yadd + monster.position.tile.y); @@ -725,28 +725,6 @@ void WalkNonSideways(Monster &monster, int xadd, int yadd, Direction endDir) NewMonsterAnim(monster, MonsterGraphic::Walk, endDir, AnimationDistributionFlags::ProcessAnimationPending, -1); } -void WalkSideways(Monster &monster, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, Direction endDir) -{ - const auto fx = static_cast(xadd + monster.position.tile.x); - const auto fy = static_cast(yadd + monster.position.tile.y); - const auto x = static_cast(mapx + monster.position.tile.x); - const auto y = static_cast(mapy + monster.position.tile.y); - - if (monster.lightId != NO_LIGHT) - ChangeLightXY(monster.lightId, { x, y }); - - monster.position.temp = { x, y }; - monster.position.old = monster.position.tile; - monster.position.future = { fx, fy }; - monster.occupyTile(monster.position.tile, true); - monster.occupyTile(monster.position.future, false); - monster.mode = MonsterMode::MoveSideways; - monster.var1 = fx; - monster.var2 = fy; - monster.var3 = static_cast(endDir); - NewMonsterAnim(monster, MonsterGraphic::Walk, endDir, AnimationDistributionFlags::ProcessAnimationPending, -1); -} - void StartAttack(Monster &monster) { Direction md = GetMonsterDirection(monster); @@ -3954,28 +3932,28 @@ bool Walk(Monster &monster, Direction md) switch (md) { case Direction::North: - WalkNonSideways(monster, -1, -1, Direction::North); + Walk(monster, -1, -1, Direction::North); break; case Direction::NorthEast: - WalkNonSideways(monster, 0, -1, Direction::NorthEast); + Walk(monster, 0, -1, Direction::NorthEast); break; case Direction::East: - WalkSideways(monster, -32, -16, 1, -1, 1, 0, Direction::East); + Walk(monster, 1, -1, Direction::East); break; case Direction::SouthEast: - WalkNonSideways(monster, 1, 0, Direction::SouthEast); + Walk(monster, 1, 0, Direction::SouthEast); break; case Direction::South: - WalkNonSideways(monster, 1, 1, Direction::South); + Walk(monster, 1, 1, Direction::South); break; case Direction::SouthWest: - WalkNonSideways(monster, 0, 1, Direction::SouthWest); + Walk(monster, 0, 1, Direction::SouthWest); break; case Direction::West: - WalkSideways(monster, 32, -16, -1, 1, 0, 1, Direction::West); + Walk(monster, -1, 1, Direction::West); break; case Direction::NorthWest: - WalkNonSideways(monster, -1, 0, Direction::NorthWest); + Walk(monster, -1, 0, Direction::NorthWest); break; case Direction::NoDirection: break; diff --git a/Source/player.cpp b/Source/player.cpp index fc5b43daf..b19126245 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -61,7 +61,6 @@ namespace { struct DirectionSettings { Direction dir; DisplacementOf tileAdd; - DisplacementOf map; PLR_MODE walkMode; void (*walkModeHandler)(Player &, const DirectionSettings &); }; @@ -75,37 +74,22 @@ void UpdatePlayerLightOffset(Player &player) ChangeLightOffset(player.lightId, offset.screenToLight()); } -void WalkNonSideways(Player &player, const DirectionSettings &walkParams) +void Walk(Player &player, const DirectionSettings &walkParams) { player.occupyTile(player.position.future, true); player.position.temp = player.position.tile + walkParams.tileAdd; } -void WalkSideways(Player &player, const DirectionSettings &walkParams) -{ - Point const nextPosition = player.position.tile + walkParams.map; - - player.occupyTile(player.position.tile, true); - player.occupyTile(player.position.future, false); - - if (leveltype != DTYPE_TOWN) { - ChangeLightXY(player.lightId, nextPosition); - UpdatePlayerLightOffset(player); - } - - player.position.temp = player.position.future; -} - constexpr std::array WalkSettings { { // clang-format off - { Direction::South, { 1, 1 }, { 0, 0 }, PM_WALK_SOUTHWARDS, WalkNonSideways }, - { Direction::SouthWest, { 0, 1 }, { 0, 0 }, PM_WALK_SOUTHWARDS, WalkNonSideways }, - { Direction::West, { -1, 1 }, { 0, 1 }, PM_WALK_SIDEWAYS, WalkSideways }, - { Direction::NorthWest, { -1, 0 }, { 0, 0 }, PM_WALK_NORTHWARDS, WalkNonSideways }, - { Direction::North, { -1, -1 }, { 0, 0 }, PM_WALK_NORTHWARDS, WalkNonSideways }, - { Direction::NorthEast, { 0, -1 }, { 0, 0 }, PM_WALK_NORTHWARDS, WalkNonSideways }, - { Direction::East, { 1, -1 }, { 1, 0 }, PM_WALK_SIDEWAYS, WalkSideways }, - { Direction::SouthEast, { 1, 0 }, { 0, 0 }, PM_WALK_SOUTHWARDS, WalkNonSideways } + { Direction::South, { 1, 1 }, PM_WALK_SOUTHWARDS, Walk }, + { Direction::SouthWest, { 0, 1 }, PM_WALK_SOUTHWARDS, Walk }, + { Direction::West, { -1, 1 }, PM_WALK_SIDEWAYS, Walk }, + { Direction::NorthWest, { -1, 0 }, PM_WALK_NORTHWARDS, Walk }, + { Direction::North, { -1, -1 }, PM_WALK_NORTHWARDS, Walk }, + { Direction::NorthEast, { 0, -1 }, PM_WALK_NORTHWARDS, Walk }, + { Direction::East, { 1, -1 }, PM_WALK_SIDEWAYS, Walk }, + { Direction::SouthEast, { 1, 0 }, PM_WALK_SOUTHWARDS, Walk } // clang-format on } };