diff --git a/Source/automap.cpp b/Source/automap.cpp index 601f788f6..12117d3a0 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -347,7 +347,7 @@ void SearchAutomapItem(const Surface &out, const Displacement &myPlayerOffset) { const Player &player = *MyPlayer; Point tile = player.position.tile; - if (player._pmode == PM_WALK3) { + if (player._pmode == PM_WALK_SIDEWAYS) { tile = player.position.future; if (player._pdir == Direction::West) tile.x++; @@ -395,7 +395,7 @@ void DrawAutomapPlr(const Surface &out, const Displacement &myPlayerOffset, int Player &player = Players[playerId]; Point tile = player.position.tile; - if (player._pmode == PM_WALK3) { + if (player._pmode == PM_WALK_SIDEWAYS) { tile = player.position.future; } diff --git a/Source/inv.cpp b/Source/inv.cpp index 518cee2bf..4d7771829 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -236,7 +236,7 @@ bool CanWield(Player &player, const Item &item) */ bool CanEquip(Player &player, const Item &item, inv_body_loc bodyLocation) { - if (!CanEquip(item) || player._pmode > PM_WALK3 || !player.InvBody[bodyLocation].isEmpty()) { + if (!CanEquip(item) || player._pmode > PM_WALK_SIDEWAYS || !player.InvBody[bodyLocation].isEmpty()) { return false; } @@ -402,7 +402,7 @@ void CheckInvPaste(Player &player, Point cursorPosition) return; } - if (player._pmode > PM_WALK3 && IsNoneOf(il, ILOC_UNEQUIPABLE, ILOC_BELT)) + if (player._pmode > PM_WALK_SIDEWAYS && IsNoneOf(il, ILOC_UNEQUIPABLE, ILOC_BELT)) return; if (&player == MyPlayer) @@ -566,7 +566,7 @@ void CheckInvPaste(Player &player, Point cursorPosition) void CheckInvCut(Player &player, Point cursorPosition, bool automaticMove, bool dropItem) { - if (player._pmode > PM_WALK3) { + if (player._pmode > PM_WALK_SIDEWAYS) { return; } diff --git a/Source/monster.cpp b/Source/monster.cpp index 1f8e405d4..f3eeba4cf 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -808,7 +808,7 @@ void StartSpecialStand(Monster &monster, Direction md) monster.position.old = monster.position.tile; } -void StartWalkNorthwards(Monster &monster, int xvel, int yvel, int xadd, int yadd, Direction endDir) +void WalkNorthwards(Monster &monster, int xvel, int yvel, 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); @@ -825,7 +825,7 @@ void StartWalkNorthwards(Monster &monster, int xvel, int yvel, int xadd, int yad monster.position.offset2 = { 0, 0 }; } -void StartWalkSouthwards(Monster &monster, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, Direction endDir) +void WalkSouthwards(Monster &monster, int xvel, int yvel, int xoff, int yoff, 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); @@ -847,7 +847,7 @@ void StartWalkSouthwards(Monster &monster, int xvel, int yvel, int xoff, int yof monster.position.offset2 = DisplacementOf { static_cast(16 * xoff), static_cast(16 * yoff) }; } -void StartWalkSideways(Monster &monster, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, Direction endDir) +void WalkSideways(Monster &monster, int xvel, int yvel, 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); @@ -4076,28 +4076,28 @@ void M_WalkDir(Monster &monster, Direction md) int mwi = monster.type().getAnimData(MonsterGraphic::Walk).frames - 1; switch (md) { case Direction::North: - StartWalkNorthwards(monster, 0, -MWVel[mwi][1], -1, -1, Direction::North); + WalkNorthwards(monster, 0, -MWVel[mwi][1], -1, -1, Direction::North); break; case Direction::NorthEast: - StartWalkNorthwards(monster, MWVel[mwi][1], -MWVel[mwi][0], 0, -1, Direction::NorthEast); + WalkNorthwards(monster, MWVel[mwi][1], -MWVel[mwi][0], 0, -1, Direction::NorthEast); break; case Direction::East: - StartWalkSideways(monster, MWVel[mwi][2], 0, -32, -16, 1, -1, 1, 0, Direction::East); + WalkSideways(monster, MWVel[mwi][2], 0, -32, -16, 1, -1, 1, 0, Direction::East); break; case Direction::SouthEast: - StartWalkSouthwards(monster, MWVel[mwi][1], MWVel[mwi][0], -32, -16, 1, 0, Direction::SouthEast); + WalkSouthwards(monster, MWVel[mwi][1], MWVel[mwi][0], -32, -16, 1, 0, Direction::SouthEast); break; case Direction::South: - StartWalkSouthwards(monster, 0, MWVel[mwi][1], 0, -32, 1, 1, Direction::South); + WalkSouthwards(monster, 0, MWVel[mwi][1], 0, -32, 1, 1, Direction::South); break; case Direction::SouthWest: - StartWalkSouthwards(monster, -MWVel[mwi][1], MWVel[mwi][0], 32, -16, 0, 1, Direction::SouthWest); + WalkSouthwards(monster, -MWVel[mwi][1], MWVel[mwi][0], 32, -16, 0, 1, Direction::SouthWest); break; case Direction::West: - StartWalkSideways(monster, -MWVel[mwi][2], 0, 32, -16, -1, 1, 0, 1, Direction::West); + WalkSideways(monster, -MWVel[mwi][2], 0, 32, -16, -1, 1, 0, 1, Direction::West); break; case Direction::NorthWest: - StartWalkNorthwards(monster, -MWVel[mwi][1], -MWVel[mwi][0], -1, 0, Direction::NorthWest); + WalkNorthwards(monster, -MWVel[mwi][1], -MWVel[mwi][0], -1, 0, Direction::NorthWest); break; } } diff --git a/Source/player.cpp b/Source/player.cpp index 0063c391e..f218de7ac 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -219,14 +219,14 @@ void PmChangeLightOff(Player &player) ChangeLightOffset(player._plid, { x, y }); } -void WalkUpwards(int pnum, const DirectionSettings &walkParams) +void WalkNorthwards(int pnum, const DirectionSettings &walkParams) { Player &player = Players[pnum]; dPlayer[player.position.future.x][player.position.future.y] = -(pnum + 1); player.position.temp = WorldTilePosition { static_cast(walkParams.tileAdd.deltaX), static_cast(walkParams.tileAdd.deltaY) }; } -void WalkDownwards(int pnum, const DirectionSettings & /*walkParams*/) +void WalkSouthwards(int pnum, const DirectionSettings & /*walkParams*/) { Player &player = Players[pnum]; dPlayer[player.position.tile.x][player.position.tile.y] = -(pnum + 1); @@ -238,7 +238,7 @@ void WalkDownwards(int pnum, const DirectionSettings & /*walkParams*/) PmChangeLightOff(player); } -void WalkSides(int pnum, const DirectionSettings &walkParams) +void WalkSideways(int pnum, const DirectionSettings &walkParams) { Player &player = Players[pnum]; @@ -268,14 +268,14 @@ _sfx_id herosounds[enum_size::value][enum_size::value] = constexpr std::array WalkSettings { { // clang-format off - { Direction::South, { 1, 1 }, { 0, -32 }, { 0, 0 }, ScrollDirection::South, PM_WALK2, WalkDownwards }, - { Direction::SouthWest, { 0, 1 }, { 32, -16 }, { 0, 0 }, ScrollDirection::SouthWest, PM_WALK2, WalkDownwards }, - { Direction::West, { -1, 1 }, { 32, -16 }, { 0, 1 }, ScrollDirection::West, PM_WALK3, WalkSides }, - { Direction::NorthWest, { -1, 0 }, { 0, 0 }, { 0, 0 }, ScrollDirection::NorthWest, PM_WALK, WalkUpwards }, - { Direction::North, { -1, -1 }, { 0, 0 }, { 0, 0 }, ScrollDirection::North, PM_WALK, WalkUpwards }, - { Direction::NorthEast, { 0, -1 }, { 0, 0 }, { 0, 0 }, ScrollDirection::NorthEast, PM_WALK, WalkUpwards }, - { Direction::East, { 1, -1 }, { -32, -16 }, { 1, 0 }, ScrollDirection::East, PM_WALK3, WalkSides }, - { Direction::SouthEast, { 1, 0 }, { -32, -16 }, { 0, 0 }, ScrollDirection::SouthEast, PM_WALK2, WalkDownwards } + { Direction::South, { 1, 1 }, { 0, -32 }, { 0, 0 }, ScrollDirection::South, PM_WALK_SOUTHWARDS, WalkSouthwards }, + { Direction::SouthWest, { 0, 1 }, { 32, -16 }, { 0, 0 }, ScrollDirection::SouthWest, PM_WALK_SOUTHWARDS, WalkSouthwards }, + { Direction::West, { -1, 1 }, { 32, -16 }, { 0, 1 }, ScrollDirection::West, PM_WALK_SIDEWAYS, WalkSideways }, + { Direction::NorthWest, { -1, 0 }, { 0, 0 }, { 0, 0 }, ScrollDirection::NorthWest, PM_WALK_NORTHWARDS, WalkNorthwards }, + { Direction::North, { -1, -1 }, { 0, 0 }, { 0, 0 }, ScrollDirection::North, PM_WALK_NORTHWARDS, WalkNorthwards }, + { Direction::NorthEast, { 0, -1 }, { 0, 0 }, { 0, 0 }, ScrollDirection::NorthEast, PM_WALK_NORTHWARDS, WalkNorthwards }, + { Direction::East, { 1, -1 }, { -32, -16 }, { 1, 0 }, ScrollDirection::East, PM_WALK_SIDEWAYS, WalkSideways }, + { Direction::SouthEast, { 1, 0 }, { -32, -16 }, { 0, 0 }, ScrollDirection::SouthEast, PM_WALK_SOUTHWARDS, WalkSouthwards } // clang-format on } }; @@ -670,15 +670,15 @@ bool DoWalk(int pnum, int variant) // Update the player's tile position switch (variant) { - case PM_WALK: + case PM_WALK_NORTHWARDS: dPlayer[player.position.tile.x][player.position.tile.y] = 0; player.position.tile += { player.position.temp.x, player.position.temp.y }; dPlayer[player.position.tile.x][player.position.tile.y] = pnum + 1; break; - case PM_WALK2: + case PM_WALK_SOUTHWARDS: dPlayer[player.position.temp.x][player.position.temp.y] = 0; break; - case PM_WALK3: + case PM_WALK_SIDEWAYS: dPlayer[player.position.tile.x][player.position.tile.y] = 0; player.position.tile = player.position.temp; // dPlayer is set here for backwards comparability, without it the player would be invisible if loaded from a vanilla save. @@ -2010,7 +2010,7 @@ void Player::Stop() bool Player::IsWalking() const { - return IsAnyOf(_pmode, PM_WALK, PM_WALK2, PM_WALK3); + return IsAnyOf(_pmode, PM_WALK_NORTHWARDS, PM_WALK_SOUTHWARDS, PM_WALK_SIDEWAYS); } void Player::Reset() @@ -3367,9 +3367,9 @@ void ProcessPlayers() case PM_QUIT: tplayer = false; break; - case PM_WALK: - case PM_WALK2: - case PM_WALK3: + case PM_WALK_NORTHWARDS: + case PM_WALK_SOUTHWARDS: + case PM_WALK_SIDEWAYS: tplayer = DoWalk(pnum, player._pmode); break; case PM_ATTACK: @@ -3570,9 +3570,9 @@ void SyncPlrAnim(Player &player) case PM_QUIT: graphic = player_graphic::Stand; break; - case PM_WALK: - case PM_WALK2: - case PM_WALK3: + case PM_WALK_NORTHWARDS: + case PM_WALK_SOUTHWARDS: + case PM_WALK_SIDEWAYS: graphic = player_graphic::Walk; break; case PM_ATTACK: diff --git a/Source/player.h b/Source/player.h index e7d25cee2..ded415608 100644 --- a/Source/player.h +++ b/Source/player.h @@ -115,9 +115,9 @@ enum class PlayerWeaponGraphic : uint8_t { enum PLR_MODE : uint8_t { PM_STAND, - PM_WALK, // Movement towards N, NW, or NE - PM_WALK2, // Movement towards S, SW, or SE - PM_WALK3, // Movement towards W or E + PM_WALK_NORTHWARDS, + PM_WALK_SOUTHWARDS, + PM_WALK_SIDEWAYS, PM_ATTACK, PM_RATTACK, PM_BLOCK,