Merge pull request #10570 from tupaschoal/use-more-coords-6

Prefer CoordsXY* on more places
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2020-01-19 18:06:20 +01:00
commit b1e8caa575
21 files changed
+123 -104

No files matched your search

+1 -2
View File
@@ -3713,8 +3713,7 @@ void ride_construction_toolupdate_entrance_exit(ScreenCoordsXY screenCoords)
if (ride != nullptr)
{
_currentTrackPrice = ride_entrance_exit_place_ghost(
ride, entranceOrExitCoords.x, entranceOrExitCoords.y, entranceOrExitCoords.direction,
gRideEntranceExitPlaceType, stationNum);
ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum);
}
window_ride_construction_update_active_elements();
}
+1 -1
View File
@@ -1974,7 +1974,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// TODO: Make this work with Left/Right park entrance parts
int16_t parkEntranceIndex = park_entrance_get_index(
windowTileInspectorToolMap.x, windowTileInspectorToolMap.y, tileElement->GetBaseZ());
{ windowTileInspectorToolMap, tileElement->GetBaseZ() });
gfx_draw_string_left(
dpi, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, &parkEntranceIndex, COLOUR_WHITE, x, y + 11);
}
@@ -266,7 +266,7 @@ public:
banner->position.x = _loc.x / 32;
banner->position.y = _loc.y / 32;
ride_id_t rideIndex = banner_get_closest_ride_index(_loc.x, _loc.y, maxHeight);
ride_id_t rideIndex = banner_get_closest_ride_index({ _loc, maxHeight });
if (rideIndex != RIDE_ID_NULL)
{
banner->ride_index = rideIndex;
@@ -52,7 +52,7 @@ public:
res->Position = _loc;
res->ErrorTitle = STR_CANT_REMOVE_THIS;
auto entranceIndex = park_entrance_get_index(_loc.x, _loc.y, _loc.z);
auto entranceIndex = park_entrance_get_index(_loc);
if (entranceIndex == -1)
{
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
@@ -68,7 +68,7 @@ public:
res->Position = _loc;
res->ErrorTitle = STR_CANT_REMOVE_THIS;
auto entranceIndex = park_entrance_get_index(_loc.x, _loc.y, _loc.z);
auto entranceIndex = park_entrance_get_index(_loc);
if (entranceIndex == -1)
{
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
@@ -221,7 +221,7 @@ public:
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
maze_entrance_hedge_removal(_loc.x, _loc.y, tileElement);
maze_entrance_hedge_removal({ _loc, tileElement });
}
footpath_connect_edges(_loc, tileElement, GetFlags());
@@ -171,7 +171,7 @@ public:
res->Position.z = tile_element_height(res->Position);
footpath_queue_chain_reset();
maze_entrance_hedge_replacement(_loc.x, _loc.y, tileElement);
maze_entrance_hedge_replacement({ _loc, tileElement });
footpath_remove_edges_at(_loc, tileElement);
tile_element_remove(tileElement);
+1 -4
View File
@@ -60,9 +60,6 @@ public:
{
auto banner = GetBanner(_bannerIndex);
int32_t x = banner->position.x << 5;
int32_t y = banner->position.y << 5;
if (!_name.empty())
{
banner->flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
@@ -72,7 +69,7 @@ public:
else
{
// If empty name take closest ride name.
ride_id_t rideIndex = banner_get_closest_ride_index(x, y, 16);
ride_id_t rideIndex = banner_get_closest_ride_index({ banner->position.ToCoordsXY(), 16 });
if (rideIndex == RIDE_ID_NULL)
{
banner->flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
+1 -1
View File
@@ -362,7 +362,7 @@ public:
banner->position.x = _loc.x / 32;
banner->position.y = _loc.y / 32;
ride_id_t rideIndex = banner_get_closest_ride_index(_loc.x, _loc.y, targetHeight);
ride_id_t rideIndex = banner_get_closest_ride_index({ _loc, targetHeight });
if (rideIndex != RIDE_ID_NULL)
{
banner->ride_index = rideIndex;
+4 -6
View File
@@ -4271,9 +4271,7 @@ static void ride_set_maze_entrance_exit_points(Ride* ride)
// Enumerate entrance and exit positions
for (position = positions; !(*position).isNull(); position++)
{
int32_t x = (*position).x << 5;
int32_t y = (*position).y << 5;
int32_t z = (*position).z;
auto entranceExitMapPos = position->ToCoordsXYZ();
TileElement* tileElement = map_get_first_element_at(position->ToCoordsXY());
do
@@ -4287,10 +4285,10 @@ static void ride_set_maze_entrance_exit_points(Ride* ride)
{
continue;
}
if (tileElement->base_height != z)
if (tileElement->GetBaseZ() != entranceExitMapPos.z)
continue;
maze_entrance_hedge_removal(x, y, tileElement);
maze_entrance_hedge_removal({ entranceExitMapPos, tileElement });
} while (!(tileElement++)->IsLastForTile());
}
}
@@ -7091,7 +7089,7 @@ void sub_6CB945(Ride* ride)
if (shouldRemove)
{
footpath_queue_chain_reset();
maze_entrance_hedge_replacement(location.x, location.y, tileElement);
maze_entrance_hedge_replacement({ location, tileElement });
footpath_remove_edges_at(location, tileElement);
footpath_update_queue_chains();
map_invalidate_tile_full(location);
+1 -1
View File
@@ -1222,7 +1222,7 @@ void ride_get_start_of_track(CoordsXYE* output);
void window_ride_construction_update_active_elements();
void ride_construction_remove_ghosts();
money32 ride_entrance_exit_place_ghost(
Ride* ride, int32_t x, int32_t y, int32_t direction, int32_t placeType, int32_t stationNum);
Ride* ride, const CoordsXY& entranceExitCoords, int32_t direction, int32_t placeType, int32_t stationNum);
CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(ScreenCoordsXY screenCoords);
bool ride_select_backwards_from_front();
+17 -12
View File
@@ -77,9 +77,9 @@ size_t Banner::FormatTextTo(void* argsV) const
*
* rct2: 0x006B7EAB
*/
static uint8_t banner_get_ride_index_at(int32_t x, int32_t y, int32_t z)
static uint8_t banner_get_ride_index_at(const CoordsXYZ& bannerCoords)
{
TileElement* tileElement = map_get_first_element_at({ x, y });
TileElement* tileElement = map_get_first_element_at(bannerCoords);
ride_id_t resultRideIndex = RIDE_ID_NULL;
if (tileElement == nullptr)
return resultRideIndex;
@@ -93,7 +93,7 @@ static uint8_t banner_get_ride_index_at(int32_t x, int32_t y, int32_t z)
if (ride == nullptr || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP))
continue;
if ((tileElement->GetClearanceZ()) + 32 <= z)
if ((tileElement->GetClearanceZ()) + (4 * COORDS_Z_STEP) <= bannerCoords.z)
continue;
resultRideIndex = rideIndex;
@@ -209,15 +209,21 @@ WallElement* banner_get_scrolling_wall_tile_element(BannerIndex bannerIndex)
*
* rct2: 0x006B7D86
*/
uint8_t banner_get_closest_ride_index(int32_t x, int32_t y, int32_t z)
uint8_t banner_get_closest_ride_index(const CoordsXYZ& mapPos)
{
static constexpr const LocationXY16 NeighbourCheckOrder[] = { { 32, 0 }, { -32, 0 }, { 0, 32 },
{ 0, -32 }, { -32, +32 }, { +32, -32 },
{ +32, +32 }, { -32, +32 }, { 0, 0 } };
static constexpr const std::array<CoordsXY, 9> NeighbourCheckOrder = { CoordsXY{ COORDS_XY_STEP, 0 },
CoordsXY{ -COORDS_XY_STEP, 0 },
{ 0, COORDS_XY_STEP },
CoordsXY{ 0, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, -COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ 0, 0 } };
for (size_t i = 0; i < std::size(NeighbourCheckOrder); i++)
for (const auto& neighhbourCoords : NeighbourCheckOrder)
{
ride_id_t rideIndex = banner_get_ride_index_at(x + NeighbourCheckOrder[i].x, y + NeighbourCheckOrder[i].y, z);
ride_id_t rideIndex = banner_get_ride_index_at({ CoordsXY{ mapPos } + neighhbourCoords, mapPos.z });
if (rideIndex != RIDE_ID_NULL)
{
return rideIndex;
@@ -235,9 +241,8 @@ uint8_t banner_get_closest_ride_index(int32_t x, int32_t y, int32_t z)
if (location.isNull())
continue;
int32_t rideX = location.x * 32;
int32_t rideY = location.y * 32;
int32_t distance = abs(x - rideX) + abs(y - rideY);
auto rideCoords = location.ToCoordsXY();
int32_t distance = abs(mapPos.x - rideCoords.x) + abs(mapPos.y - rideCoords.y);
if (distance < resultDistance)
{
resultDistance = distance;
+1 -1
View File
@@ -49,7 +49,7 @@ void banner_init();
BannerIndex create_new_banner(uint8_t flags);
TileElement* banner_get_tile_element(BannerIndex bannerIndex);
WallElement* banner_get_scrolling_wall_tile_element(BannerIndex bannerIndex);
uint8_t banner_get_closest_ride_index(int32_t x, int32_t y, int32_t z);
uint8_t banner_get_closest_ride_index(const CoordsXYZ& mapPos);
void banner_reset_broken_index();
void fix_duplicated_banners();
Banner* GetBanner(BannerIndex id);
+20 -22
View File
@@ -100,9 +100,9 @@ void rct_duck::Remove()
sprite_remove((rct_sprite*)this);
}
void rct_duck::MoveTo(int16_t destX, int16_t destY, int16_t destZ)
void rct_duck::MoveTo(const CoordsXYZ& destination)
{
sprite_move(destX, destY, destZ, (rct_sprite*)this);
sprite_move(destination.x, destination.y, destination.z, (rct_sprite*)this);
}
void rct_duck::UpdateFlyToWater()
@@ -119,9 +119,8 @@ void rct_duck::UpdateFlyToWater()
Invalidate();
int32_t manhattanDistance = abs(target_x - x) + abs(target_y - y);
int32_t direction = sprite_direction >> 3;
int32_t newX = x + DuckMoveOffset[direction].x;
int32_t newY = y + DuckMoveOffset[direction].y;
int32_t manhattanDistanceN = abs(target_x - newX) + abs(target_y - newY);
auto destination = CoordsXYZ{ CoordsXY{ x, y } + DuckMoveOffset[direction], 0 };
int32_t manhattanDistanceN = abs(target_x - destination.x) + abs(target_y - destination.y);
auto surfaceElement = map_get_surface_element_at(CoordsXY{ target_x, target_y });
int32_t waterHeight = surfaceElement != nullptr ? surfaceElement->GetWaterHeight() : 0;
@@ -132,29 +131,29 @@ void rct_duck::UpdateFlyToWater()
}
else
{
int32_t newZ = abs(z - waterHeight);
destination.z = abs(z - waterHeight);
if (manhattanDistanceN <= manhattanDistance)
{
if (newZ > manhattanDistanceN)
if (destination.z > manhattanDistanceN)
{
newZ = z - 2;
destination.z = z - 2;
if (waterHeight >= z)
{
newZ += 4;
destination.z += 4;
}
frame = 1;
}
else
{
newZ = z;
destination.z = z;
}
MoveTo(newX, newY, newZ);
MoveTo(destination);
Invalidate();
}
else
{
if (newZ > 4)
if (destination.z > 4)
{
state = DUCK_STATE::FLY_AWAY;
UpdateFlyAway();
@@ -220,14 +219,14 @@ void rct_duck::UpdateSwim()
}
int32_t direction = sprite_direction >> 3;
int32_t newX = x + DuckMoveOffset[direction].x;
int32_t newY = y + DuckMoveOffset[direction].y;
landZ = tile_element_height({ newX, newY });
waterZ = tile_element_water_height({ newX, newY });
auto destination = CoordsXYZ{ CoordsXY{ x, y } + DuckMoveOffset[direction], 0 };
landZ = tile_element_height(destination);
waterZ = tile_element_water_height(destination);
if (z >= landZ && z == waterZ)
{
MoveTo(newX, newY, waterZ);
destination.z = waterZ;
MoveTo(destination);
Invalidate();
}
}
@@ -278,12 +277,11 @@ void rct_duck::UpdateFlyAway()
Invalidate();
int32_t direction = sprite_direction >> 3;
int32_t newX = x + (DuckMoveOffset[direction].x * 2);
int32_t newY = y + (DuckMoveOffset[direction].y * 2);
int32_t newZ = std::min(z + 2, 496);
if (map_is_location_valid({ newX, newY }))
auto destination = CoordsXYZ{ x + (DuckMoveOffset[direction].x * 2), y + (DuckMoveOffset[direction].y * 2),
std::min<int32_t>(z + 2, 496) };
if (map_is_location_valid(destination))
{
MoveTo(newX, newY, newZ);
MoveTo(destination);
Invalidate();
}
else
+26 -28
View File
@@ -36,10 +36,10 @@ CoordsXYZD gRideEntranceExitGhostPosition;
uint8_t gRideEntranceExitGhostStationIndex;
static money32 RideEntranceExitPlaceGhost(
ride_id_t rideIndex, int16_t x, int16_t y, uint8_t direction, uint8_t placeType, uint8_t stationNum)
ride_id_t rideIndex, const CoordsXY& entranceExitCoords, uint8_t direction, uint8_t placeType, uint8_t stationNum)
{
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
{ x, y }, direction, rideIndex, stationNum, placeType == ENTRANCE_TYPE_RIDE_EXIT);
entranceExitCoords, direction, rideIndex, stationNum, placeType == ENTRANCE_TYPE_RIDE_EXIT);
rideEntranceExitPlaceAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST);
auto res = GameActions::Execute(&rideEntranceExitPlaceAction);
@@ -61,12 +61,12 @@ void park_entrance_remove_ghost()
}
}
int32_t park_entrance_get_index(int32_t x, int32_t y, int32_t z)
int32_t park_entrance_get_index(const CoordsXYZ& entrancePos)
{
int32_t i = 0;
for (const auto& entrance : gParkEntrances)
{
if (x == entrance.x && y == entrance.y && z == entrance.z)
if (entrancePos == entrance)
{
return i;
}
@@ -85,8 +85,8 @@ void ride_entrance_exit_place_provisional_ghost()
if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT)
{
RideEntranceExitPlaceGhost(
_currentRideIndex, gRideEntranceExitGhostPosition.x, gRideEntranceExitGhostPosition.y,
gRideEntranceExitGhostPosition.direction, gRideEntranceExitPlaceType, gRideEntranceExitGhostStationIndex);
_currentRideIndex, gRideEntranceExitGhostPosition, gRideEntranceExitGhostPosition.direction,
gRideEntranceExitPlaceType, gRideEntranceExitGhostStationIndex);
}
}
@@ -95,8 +95,8 @@ void ride_entrance_exit_remove_ghost()
if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT)
{
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(
{ gRideEntranceExitGhostPosition.x, gRideEntranceExitGhostPosition.y }, _currentRideIndex,
gRideEntranceExitGhostStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
gRideEntranceExitGhostPosition, _currentRideIndex, gRideEntranceExitGhostStationIndex,
gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
rideEntranceExitRemove.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
GameActions::Execute(&rideEntranceExitRemove);
@@ -108,16 +108,16 @@ void ride_entrance_exit_remove_ghost()
* rct2: 0x006CA28C
*/
money32 ride_entrance_exit_place_ghost(
Ride* ride, int32_t x, int32_t y, int32_t direction, int32_t placeType, int32_t stationNum)
Ride* ride, const CoordsXY& entranceExitCoords, int32_t direction, int32_t placeType, int32_t stationNum)
{
ride_construction_remove_ghosts();
money32 result = RideEntranceExitPlaceGhost(ride->id, x, y, direction, placeType, stationNum);
money32 result = RideEntranceExitPlaceGhost(ride->id, entranceExitCoords, direction, placeType, stationNum);
if (result != MONEY32_UNDEFINED)
{
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT;
gRideEntranceExitGhostPosition.x = x;
gRideEntranceExitGhostPosition.y = y;
gRideEntranceExitGhostPosition.x = entranceExitCoords.x;
gRideEntranceExitGhostPosition.y = entranceExitCoords.y;
gRideEntranceExitGhostPosition.direction = direction;
gRideEntranceExitGhostStationIndex = stationNum & 0xFF;
}
@@ -128,15 +128,14 @@ money32 ride_entrance_exit_place_ghost(
* Replaces the outer hedge walls for an entrance placement removal.
* rct2: 0x00666D6F
*/
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement)
void maze_entrance_hedge_replacement(const CoordsXYE& entrance)
{
int32_t direction = tileElement->GetDirection();
x += CoordsDirectionDelta[direction].x;
y += CoordsDirectionDelta[direction].y;
int32_t z = tileElement->GetBaseZ();
ride_id_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
int32_t direction = entrance.element->GetDirection();
auto hedgePos = entrance + CoordsDirectionDelta[direction];
int32_t z = entrance.element->GetBaseZ();
ride_id_t rideIndex = entrance.element->AsEntrance()->GetRideIndex();
tileElement = map_get_first_element_at({ x, y });
auto tileElement = map_get_first_element_at(hedgePos);
if (tileElement == nullptr)
return;
do
@@ -157,7 +156,7 @@ void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElem
// Add the bottom outer wall
tileElement->AsTrack()->MazeEntryAdd(1 << ((mazeSection + 12) & 0x0F));
map_invalidate_tile({ x, y, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
map_invalidate_tile({ hedgePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
return;
} while (!(tileElement++)->IsLastForTile());
}
@@ -166,15 +165,14 @@ void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElem
* Removes the hedge walls for an entrance placement.
* rct2: 0x00666CBE
*/
void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement)
void maze_entrance_hedge_removal(const CoordsXYE& entrance)
{
int32_t direction = tileElement->GetDirection();
x += CoordsDirectionDelta[direction].x;
y += CoordsDirectionDelta[direction].y;
int32_t z = tileElement->GetBaseZ();
ride_id_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
int32_t direction = entrance.element->GetDirection();
auto hedgePos = entrance + CoordsDirectionDelta[direction];
int32_t z = entrance.element->GetBaseZ();
ride_id_t rideIndex = entrance.element->AsEntrance()->GetRideIndex();
tileElement = map_get_first_element_at({ x, y });
auto tileElement = map_get_first_element_at(hedgePos);
if (tileElement == nullptr)
return;
do
@@ -201,7 +199,7 @@ void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement)
// Remove the bottom hedge section
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 15) & 0x0F));
map_invalidate_tile({ x, y, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
map_invalidate_tile({ hedgePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
return;
} while (!(tileElement++)->IsLastForTile());
}
+3 -2
View File
@@ -12,6 +12,7 @@
#include "../common.h"
#include "Location.hpp"
#include "Map.h"
#include <vector>
@@ -44,8 +45,8 @@ void park_entrance_remove_ghost();
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
void reset_park_entrance();
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement);
void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement);
void maze_entrance_hedge_replacement(const CoordsXYE& entrance);
void maze_entrance_hedge_removal(const CoordsXYE& entrance);
void fix_park_entrance_locations();
+18 -5
View File
@@ -38,12 +38,25 @@ namespace FOUNTAIN_FLAG
const uint32_t DIRECTION = 1 << 7;
}; // namespace FOUNTAIN_FLAG
static constexpr const CoordsXY _fountainDirectionsNegative[] = {
{ -32, 0 }, { -32, -32 }, { 0, 0 }, { -32, 0 }, { 0, 0 }, { 0, -32 }, { 0, -32 }, { -32, -32 },
static constexpr const std::array<CoordsXY, 8> _fountainDirectionsNegative = {
CoordsXY{ -COORDS_XY_STEP, 0 },
CoordsXY{ -COORDS_XY_STEP, -COORDS_XY_STEP },
CoordsXY{ 0, 0 },
CoordsXY{ -COORDS_XY_STEP, 0 },
CoordsXY{ 0, 0 },
CoordsXY{ 0, -COORDS_XY_STEP },
CoordsXY{ 0, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, -COORDS_XY_STEP },
};
static constexpr const CoordsXY _fountainDirectionsPositive[] = { { 32, 0 }, { 0, 0 }, { 0, 32 }, { 32, 32 },
{ 32, 32 }, { 32, 0 }, { 0, 0 }, { 0, 32 } };
static constexpr const std::array<CoordsXY, 8> _fountainDirectionsPositive = { CoordsXY{ COORDS_XY_STEP, 0 },
CoordsXY{ 0, 0 },
CoordsXY{ 0, COORDS_XY_STEP },
CoordsXY{ COORDS_XY_STEP, COORDS_XY_STEP },
CoordsXY{ COORDS_XY_STEP, COORDS_XY_STEP },
CoordsXY{ COORDS_XY_STEP, 0 },
CoordsXY{ 0, 0 },
CoordsXY{ 0, COORDS_XY_STEP } };
constexpr auto _FountainChanceOfStoppingEdgeMode = 0x3333; // 0.200
constexpr auto _FountainChanceOfStoppingRandomMode = 0x2000; // 0.125
@@ -192,7 +205,7 @@ void JumpingFountain::AdvanceAnimation()
const CoordsXY newLoc = CoordsXY{ x, y } + CoordsDirectionDelta[direction];
int32_t availableDirections = 0;
for (int32_t i = 0; i < 8; i++)
for (uint32_t i = 0; i < _fountainDirectionsNegative.size(); i++)
{
if (IsJumpingFountain(newType, { newLoc + _fountainDirectionsNegative[i], z }))
{
+12 -2
View File
@@ -63,8 +63,18 @@ using namespace OpenRCT2;
/**
* Replaces 0x00993CCC, 0x00993CCE
*/
const CoordsXY CoordsDirectionDelta[] = { { -32, 0 }, { 0, +32 }, { +32, 0 }, { 0, -32 },
{ -32, +32 }, { +32, +32 }, { +32, -32 }, { -32, -32 } };
// clang-format off
const std::array<CoordsXY, 8> CoordsDirectionDelta = {
CoordsXY{ -COORDS_XY_STEP, 0 },
CoordsXY{ 0, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, 0 },
CoordsXY{ 0, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, -COORDS_XY_STEP }
};
// clang-format on
const TileCoordsXY TileDirectionDelta[] = { { -1, 0 }, { 0, +1 }, { +1, 0 }, { 0, -1 },
{ -1, +1 }, { +1, +1 }, { +1, -1 }, { -1, -1 } };
+1 -1
View File
@@ -96,7 +96,7 @@ enum
CREATE_CROSSING_MODE_PATH_OVER_TRACK,
};
extern const CoordsXY CoordsDirectionDelta[];
extern const std::array<CoordsXY, 8> CoordsDirectionDelta;
extern const TileCoordsXY TileDirectionDelta[];
extern uint16_t gWidePathTileLoopX;
+1 -1
View File
@@ -120,7 +120,7 @@ void update_park_fences_around_tile(CoordsXY coords);
uint8_t calculate_guest_initial_happiness(uint8_t percentage);
void park_set_open(bool open);
int32_t park_entrance_get_index(int32_t x, int32_t y, int32_t z);
int32_t park_entrance_get_index(const CoordsXYZ& entrancePos);
void park_set_entrance_fee(money32 value);
money16 park_get_entrance_fee();
+1 -1
View File
@@ -69,7 +69,7 @@ struct rct_duck : rct_sprite_generic
uint32_t GetFrameImage(int32_t direction) const;
void Invalidate();
void Remove();
void MoveTo(int16_t x, int16_t y, int16_t z);
void MoveTo(const CoordsXYZ& destination);
};
struct rct_money_effect : rct_sprite_common
+9 -9
View File
@@ -38,15 +38,15 @@ uint32_t gScenarioTicks;
uint8_t gCurrentRotation;
// clang-format off
const CoordsXY CoordsDirectionDelta[] = {
{ -32, 0 },
{ 0, +32 },
{ +32, 0 },
{ 0, -32 },
{ -32, +32 },
{ +32, +32 },
{ +32, -32 },
{ -32, -32 },
constexpr const std::array<CoordsXY, 8> CoordsDirectionDelta = {
CoordsXY{ -COORDS_XY_STEP, 0 },
CoordsXY{ 0, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, 0 },
CoordsXY{ 0, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, +COORDS_XY_STEP },
CoordsXY{ +COORDS_XY_STEP, -COORDS_XY_STEP },
CoordsXY{ -COORDS_XY_STEP, -COORDS_XY_STEP },
};
const TileCoordsXY TileDirectionDelta[] = {