mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #10363 from duncanspumpkin/refactor
Refactor to reduce LocationXY usage
This commit is contained in:
commit
fb2f907414
|
@ -534,7 +534,7 @@ static void viewport_interaction_remove_footpath(TileElement* tileElement, Coord
|
|||
{
|
||||
if (tileElement2->GetType() == TILE_ELEMENT_TYPE_PATH && tileElement2->base_height == z)
|
||||
{
|
||||
footpath_remove(mapCoords.x, mapCoords.y, z, GAME_COMMAND_FLAG_APPLY);
|
||||
footpath_remove({ mapCoords, z * 8 }, GAME_COMMAND_FLAG_APPLY);
|
||||
break;
|
||||
}
|
||||
} while (!(tileElement2++)->IsLastForTile());
|
||||
|
|
|
@ -183,7 +183,7 @@ static void window_footpath_start_bridge_at_point(ScreenCoordsXY screenCoords);
|
|||
static void window_footpath_construct();
|
||||
static void window_footpath_remove();
|
||||
static void window_footpath_set_enabled_and_pressed_widgets();
|
||||
static void footpath_get_next_path_info(int32_t* type, int32_t* x, int32_t* y, int32_t* z, int32_t* slope);
|
||||
static void footpath_get_next_path_info(int32_t* type, CoordsXYZ& footpathLoc, int32_t* slope);
|
||||
static bool footpath_select_default();
|
||||
|
||||
/**
|
||||
|
@ -463,7 +463,7 @@ static void window_footpath_toolup(rct_window* w, rct_widgetindex widgetIndex, S
|
|||
*/
|
||||
static void window_footpath_update_provisional_path_for_bridge_mode(rct_window* w)
|
||||
{
|
||||
int32_t type, x, y, z, slope;
|
||||
int32_t type, slope;
|
||||
|
||||
if (gFootpathConstructionMode != PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL)
|
||||
{
|
||||
|
@ -480,8 +480,9 @@ static void window_footpath_update_provisional_path_for_bridge_mode(rct_window*
|
|||
// Update provisional bridge mode path
|
||||
if (!(gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_1))
|
||||
{
|
||||
footpath_get_next_path_info(&type, &x, &y, &z, &slope);
|
||||
_window_footpath_cost = footpath_provisional_set(type, x, y, z, slope);
|
||||
CoordsXYZ footpathLoc;
|
||||
footpath_get_next_path_info(&type, footpathLoc, &slope);
|
||||
_window_footpath_cost = footpath_provisional_set(type, footpathLoc, slope);
|
||||
widget_invalidate(w, WIDX_CONSTRUCT);
|
||||
}
|
||||
|
||||
|
@ -490,10 +491,11 @@ static void window_footpath_update_provisional_path_for_bridge_mode(rct_window*
|
|||
{
|
||||
_window_footpath_provisional_path_arrow_timer = 5;
|
||||
gFootpathProvisionalFlags ^= PROVISIONAL_PATH_FLAG_SHOW_ARROW;
|
||||
footpath_get_next_path_info(&type, &x, &y, &z, &slope);
|
||||
gMapSelectArrowPosition.x = x;
|
||||
gMapSelectArrowPosition.y = y;
|
||||
gMapSelectArrowPosition.z = z * 8;
|
||||
CoordsXYZ footpathLoc;
|
||||
footpath_get_next_path_info(&type, footpathLoc, &slope);
|
||||
gMapSelectArrowPosition.x = footpathLoc.x;
|
||||
gMapSelectArrowPosition.y = footpathLoc.y;
|
||||
gMapSelectArrowPosition.z = footpathLoc.z;
|
||||
gMapSelectArrowDirection = gFootpathConstructDirection;
|
||||
if (gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_SHOW_ARROW)
|
||||
{
|
||||
|
@ -503,7 +505,7 @@ static void window_footpath_update_provisional_path_for_bridge_mode(rct_window*
|
|||
{
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
}
|
||||
map_invalidate_tile_full(x, y);
|
||||
map_invalidate_tile_full(footpathLoc.x, footpathLoc.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -729,7 +731,7 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
|
|||
{
|
||||
// Check for change
|
||||
if ((gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_1) && gFootpathProvisionalPosition.x == mapCoord.x
|
||||
&& gFootpathProvisionalPosition.y == mapCoord.y && gFootpathProvisionalPosition.z == tileElement->base_height)
|
||||
&& gFootpathProvisionalPosition.y == mapCoord.y && gFootpathProvisionalPosition.z / 8 == tileElement->base_height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -737,10 +739,8 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
|
|||
// Set map selection
|
||||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
||||
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
||||
gMapSelectPositionA.x = mapCoord.x;
|
||||
gMapSelectPositionA.y = mapCoord.y;
|
||||
gMapSelectPositionB.x = mapCoord.x;
|
||||
gMapSelectPositionB.y = mapCoord.y;
|
||||
gMapSelectPositionA = mapCoord;
|
||||
gMapSelectPositionB = mapCoord;
|
||||
|
||||
footpath_provisional_update();
|
||||
|
||||
|
@ -779,7 +779,7 @@ static void window_footpath_set_provisional_path_at_point(ScreenCoordsXY screenC
|
|||
}
|
||||
int32_t pathType = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF);
|
||||
|
||||
_window_footpath_cost = footpath_provisional_set(pathType, mapCoord.x, mapCoord.y, z, slope);
|
||||
_window_footpath_cost = footpath_provisional_set(pathType, { mapCoord, z * 8 }, slope);
|
||||
window_invalidate_by_class(WC_FOOTPATH);
|
||||
}
|
||||
}
|
||||
|
@ -971,11 +971,12 @@ static void window_footpath_construct()
|
|||
_window_footpath_cost = MONEY32_UNDEFINED;
|
||||
footpath_provisional_update();
|
||||
|
||||
int32_t type, x, y, z, slope;
|
||||
footpath_get_next_path_info(&type, &x, &y, &z, &slope);
|
||||
int32_t type, slope;
|
||||
CoordsXYZ footpathLoc;
|
||||
footpath_get_next_path_info(&type, footpathLoc, &slope);
|
||||
|
||||
gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
auto footpathPlaceAction = FootpathPlaceAction({ x, y, z * 8 }, slope, type, gFootpathConstructDirection);
|
||||
auto footpathPlaceAction = FootpathPlaceAction(footpathLoc, slope, type, gFootpathConstructDirection);
|
||||
footpathPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
{
|
||||
|
@ -995,20 +996,14 @@ static void window_footpath_construct()
|
|||
viewport_set_visibility(1);
|
||||
}
|
||||
|
||||
gFootpathConstructFromPosition = footpathLoc;
|
||||
// If we have just built an upwards slope, the next path to construct is
|
||||
// a bit higher. Note that the z returned by footpath_get_next_path_info
|
||||
// already is lowered if we are building a downwards slope.
|
||||
if (gFootpathConstructSlope == 2)
|
||||
{
|
||||
gFootpathConstructFromPosition.z = (z + 2) * 8;
|
||||
gFootpathConstructFromPosition.z += (2 * 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
gFootpathConstructFromPosition.z = z * 8;
|
||||
}
|
||||
|
||||
gFootpathConstructFromPosition.x = x;
|
||||
gFootpathConstructFromPosition.y = y;
|
||||
}
|
||||
window_footpath_set_enabled_and_pressed_widgets();
|
||||
});
|
||||
|
@ -1021,9 +1016,7 @@ static void window_footpath_construct()
|
|||
*/
|
||||
static void footpath_remove_tile_element(TileElement* tileElement)
|
||||
{
|
||||
int32_t x, y, z;
|
||||
|
||||
z = tileElement->base_height;
|
||||
auto z = tileElement->base_height;
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
uint8_t slopeDirection = tileElement->AsPath()->GetSlopeDirection();
|
||||
|
@ -1053,18 +1046,15 @@ static void footpath_remove_tile_element(TileElement* tileElement)
|
|||
}
|
||||
}
|
||||
|
||||
gFootpathConstructFromPosition.z = tileElement->base_height * 8;
|
||||
// Remove path
|
||||
footpath_remove(
|
||||
gFootpathConstructFromPosition.x, gFootpathConstructFromPosition.y, tileElement->base_height, GAME_COMMAND_FLAG_APPLY);
|
||||
footpath_remove(gFootpathConstructFromPosition, GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
// Move selection
|
||||
edge = direction_reverse(edge);
|
||||
x = gFootpathConstructFromPosition.x - CoordsDirectionDelta[edge].x;
|
||||
y = gFootpathConstructFromPosition.y - CoordsDirectionDelta[edge].y;
|
||||
gFootpathConstructFromPosition.x = x;
|
||||
gFootpathConstructFromPosition.y = y;
|
||||
gFootpathConstructFromPosition.z = z << 3;
|
||||
gFootpathConstructDirection = edge;
|
||||
gFootpathConstructFromPosition.x -= CoordsDirectionDelta[edge].x;
|
||||
gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y;
|
||||
gFootpathConstructFromPosition.z = z * 8;
|
||||
gFootpathConstructDirection = direction_reverse(edge);
|
||||
gFootpathConstructValidDirections = 255;
|
||||
}
|
||||
|
||||
|
@ -1223,14 +1213,14 @@ static void window_footpath_set_enabled_and_pressed_widgets()
|
|||
*
|
||||
* rct2: 0x006A7B20
|
||||
*/
|
||||
static void footpath_get_next_path_info(int32_t* type, int32_t* x, int32_t* y, int32_t* z, int32_t* slope)
|
||||
static void footpath_get_next_path_info(int32_t* type, CoordsXYZ& footpathLoc, int32_t* slope)
|
||||
{
|
||||
int32_t direction;
|
||||
|
||||
direction = gFootpathConstructDirection;
|
||||
*x = gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x;
|
||||
*y = gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y;
|
||||
*z = gFootpathConstructFromPosition.z / 8;
|
||||
footpathLoc.x = gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x;
|
||||
footpathLoc.y = gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y;
|
||||
footpathLoc.z = gFootpathConstructFromPosition.z;
|
||||
*type = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF);
|
||||
*slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
if (gFootpathConstructSlope != 0)
|
||||
|
@ -1238,7 +1228,7 @@ static void footpath_get_next_path_info(int32_t* type, int32_t* x, int32_t* y, i
|
|||
*slope = gFootpathConstructDirection | TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
if (gFootpathConstructSlope != 2)
|
||||
{
|
||||
*z -= 2;
|
||||
footpathLoc.z -= (2 * 8);
|
||||
*slope ^= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1179,8 +1179,7 @@ static void window_map_set_land_rights_tool_update(ScreenCoordsXY screenCoords)
|
|||
int32_t radius = (landRightsToolSize * 16) - 16;
|
||||
mapCoords->x = (mapCoords->x - radius) & 0xFFE0;
|
||||
mapCoords->y = (mapCoords->y - radius) & 0xFFE0;
|
||||
gMapSelectPositionA.x = mapCoords->x;
|
||||
gMapSelectPositionA.y = mapCoords->y;
|
||||
gMapSelectPositionA = *mapCoords;
|
||||
gMapSelectPositionB.x = mapCoords->x + size;
|
||||
gMapSelectPositionB.y = mapCoords->y + size;
|
||||
map_invalidate_selection_rect();
|
||||
|
@ -1257,16 +1256,13 @@ static void window_map_place_park_entrance_tool_update(ScreenCoordsXY screenCoor
|
|||
|
||||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
map_invalidate_map_selection_tiles();
|
||||
if (gParkEntranceGhostExists && parkEntrancePosition.x == gParkEntranceGhostPosition.x
|
||||
&& parkEntrancePosition.y == gParkEntranceGhostPosition.y
|
||||
&& parkEntrancePosition.direction == gParkEntranceGhostDirection)
|
||||
if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
park_entrance_remove_ghost();
|
||||
park_entrance_place_ghost(
|
||||
parkEntrancePosition.x, parkEntrancePosition.y, parkEntrancePosition.z / 16, parkEntrancePosition.direction);
|
||||
park_entrance_place_ghost(parkEntrancePosition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3704,10 +3704,8 @@ void ride_construction_toolupdate_entrance_exit(ScreenCoordsXY screenCoords)
|
|||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
||||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
||||
gMapSelectPositionA.x = entranceOrExitCoords.x;
|
||||
gMapSelectPositionA.y = entranceOrExitCoords.y;
|
||||
gMapSelectPositionB.x = entranceOrExitCoords.x;
|
||||
gMapSelectPositionB.y = entranceOrExitCoords.y;
|
||||
gMapSelectPositionA = entranceOrExitCoords;
|
||||
gMapSelectPositionB = entranceOrExitCoords;
|
||||
gMapSelectArrowDirection = direction_reverse(entranceOrExitCoords.direction);
|
||||
gMapSelectArrowPosition.x = entranceOrExitCoords.x;
|
||||
gMapSelectArrowPosition.y = entranceOrExitCoords.y;
|
||||
|
|
|
@ -1237,13 +1237,11 @@ static void window_tile_inspector_tool_update(rct_window* w, rct_widgetindex wid
|
|||
|
||||
if (mapCoords.x != LOCATION_NULL)
|
||||
{
|
||||
gMapSelectPositionA.x = gMapSelectPositionB.x = mapCoords.x;
|
||||
gMapSelectPositionA.y = gMapSelectPositionB.y = mapCoords.y;
|
||||
gMapSelectPositionA = gMapSelectPositionB = mapCoords;
|
||||
}
|
||||
else if (windowTileInspectorTileSelected)
|
||||
{
|
||||
gMapSelectPositionA.x = gMapSelectPositionB.x = windowTileInspectorToolMap.x;
|
||||
gMapSelectPositionA.y = gMapSelectPositionB.y = windowTileInspectorToolMap.y;
|
||||
gMapSelectPositionA = gMapSelectPositionB = windowTileInspectorToolMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -323,8 +323,7 @@ static void window_view_clipping_tool_update(rct_window* w, rct_widgetindex widg
|
|||
{
|
||||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
||||
map_invalidate_tile_full(gMapSelectPositionA.x, gMapSelectPositionA.y);
|
||||
gMapSelectPositionA.x = gMapSelectPositionB.x = mapCoords.x;
|
||||
gMapSelectPositionA.y = gMapSelectPositionB.y = mapCoords.y;
|
||||
gMapSelectPositionA = gMapSelectPositionB = mapCoords;
|
||||
map_invalidate_tile_full(mapCoords.x, mapCoords.y);
|
||||
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
||||
}
|
||||
|
|
|
@ -21,25 +21,21 @@
|
|||
#include "WallRemoveAction.hpp"
|
||||
|
||||
#pragma region PlaceParkEntranceAction
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00666F4E
|
||||
*/
|
||||
money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direction)
|
||||
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc)
|
||||
{
|
||||
park_entrance_remove_ghost();
|
||||
|
||||
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, (Direction)direction });
|
||||
auto gameAction = PlaceParkEntranceAction(entranceLoc);
|
||||
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
|
||||
|
||||
auto result = GameActions::Execute(&gameAction);
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
{
|
||||
gParkEntranceGhostPosition.x = x;
|
||||
gParkEntranceGhostPosition.y = y;
|
||||
gParkEntranceGhostPosition.z = z;
|
||||
gParkEntranceGhostDirection = direction;
|
||||
gParkEntranceGhostPosition = entranceLoc;
|
||||
gParkEntranceGhostExists = true;
|
||||
}
|
||||
return result->Cost;
|
||||
|
|
|
@ -94,8 +94,8 @@ void virtual_floor_disable()
|
|||
void virtual_floor_invalidate()
|
||||
{
|
||||
// First, let's figure out how big our selection is.
|
||||
LocationXY16 min_position = { std::numeric_limits<int16_t>::max(), std::numeric_limits<int16_t>::max() };
|
||||
LocationXY16 max_position = { std::numeric_limits<int16_t>::lowest(), std::numeric_limits<int16_t>::lowest() };
|
||||
CoordsXY min_position = { std::numeric_limits<int32_t>::max(), std::numeric_limits<int32_t>::max() };
|
||||
CoordsXY max_position = { std::numeric_limits<int32_t>::lowest(), std::numeric_limits<int32_t>::lowest() };
|
||||
|
||||
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
|
||||
{
|
||||
|
@ -107,10 +107,10 @@ void virtual_floor_invalidate()
|
|||
{
|
||||
for (const auto& tile : gMapSelectionTiles)
|
||||
{
|
||||
min_position.x = std::min<int16_t>(min_position.x, tile.x);
|
||||
min_position.y = std::min<int16_t>(min_position.y, tile.y);
|
||||
max_position.x = std::max<int16_t>(max_position.x, tile.x);
|
||||
max_position.y = std::max<int16_t>(max_position.y, tile.y);
|
||||
min_position.x = std::min(min_position.x, tile.x);
|
||||
min_position.y = std::min(min_position.y, tile.y);
|
||||
max_position.x = std::max(max_position.x, tile.x);
|
||||
max_position.y = std::max(max_position.y, tile.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,8 @@ void virtual_floor_invalidate()
|
|||
&& _virtualFloorLastMaxPos.x != std::numeric_limits<int16_t>::lowest()
|
||||
&& _virtualFloorLastMaxPos.y != std::numeric_limits<int16_t>::lowest())
|
||||
{
|
||||
LocationXY16 prevMins = { _virtualFloorLastMinPos.x, _virtualFloorLastMinPos.y };
|
||||
LocationXY16 prevMaxs = { _virtualFloorLastMaxPos.x, _virtualFloorLastMaxPos.y };
|
||||
CoordsXY prevMins = { _virtualFloorLastMinPos.x, _virtualFloorLastMinPos.y };
|
||||
CoordsXY prevMaxs = { _virtualFloorLastMaxPos.x, _virtualFloorLastMaxPos.y };
|
||||
|
||||
if (prevMins.x != min_position.x || prevMins.y != min_position.y || prevMaxs.x != max_position.x
|
||||
|| prevMaxs.y != max_position.y || (_virtualFloorFlags & VIRTUAL_FLOOR_FORCE_INVALIDATION) != 0)
|
||||
|
|
|
@ -30,7 +30,7 @@ enum DUCK_STATE
|
|||
};
|
||||
constexpr const int32_t DUCK_MAX_STATES = 5;
|
||||
|
||||
static constexpr const LocationXY16 DuckMoveOffset[] =
|
||||
static constexpr const CoordsXY DuckMoveOffset[] =
|
||||
{
|
||||
{ -1, 0 },
|
||||
{ 0, 1 },
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
bool gParkEntranceGhostExists = false;
|
||||
LocationXYZ16 gParkEntranceGhostPosition = { 0, 0, 0 };
|
||||
uint8_t gParkEntranceGhostDirection = 0;
|
||||
CoordsXYZD gParkEntranceGhostPosition = { 0, 0, 0, 0 };
|
||||
std::vector<CoordsXYZD> gParkEntrances;
|
||||
|
||||
CoordsXYZD gRideEntranceExitGhostPosition;
|
||||
|
@ -56,8 +55,7 @@ void park_entrance_remove_ghost()
|
|||
if (gParkEntranceGhostExists)
|
||||
{
|
||||
gParkEntranceGhostExists = false;
|
||||
auto parkEntranceRemoveAction = ParkEntranceRemoveAction(
|
||||
{ gParkEntranceGhostPosition.x, gParkEntranceGhostPosition.y, gParkEntranceGhostPosition.z * 16 });
|
||||
auto parkEntranceRemoveAction = ParkEntranceRemoveAction(gParkEntranceGhostPosition);
|
||||
parkEntranceRemoveAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
GameActions::Execute(&parkEntranceRemoveAction);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@ assert_struct_size(rct_entrance_type, 8);
|
|||
struct TileElement;
|
||||
|
||||
extern bool gParkEntranceGhostExists;
|
||||
extern LocationXYZ16 gParkEntranceGhostPosition;
|
||||
extern uint8_t gParkEntranceGhostDirection;
|
||||
extern CoordsXYZD gParkEntranceGhostPosition;
|
||||
|
||||
#define MAX_PARK_ENTRANCES 4
|
||||
|
||||
|
@ -42,7 +41,7 @@ extern CoordsXYZD gRideEntranceExitGhostPosition;
|
|||
extern uint8_t gRideEntranceExitGhostStationIndex;
|
||||
|
||||
void park_entrance_remove_ghost();
|
||||
money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direction);
|
||||
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
|
||||
|
||||
void reset_park_entrance();
|
||||
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement);
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
void footpath_update_queue_entrance_banner(int32_t x, int32_t y, TileElement* tileElement);
|
||||
|
||||
uint8_t gFootpathProvisionalFlags;
|
||||
LocationXYZ16 gFootpathProvisionalPosition;
|
||||
CoordsXYZ gFootpathProvisionalPosition;
|
||||
uint8_t gFootpathProvisionalType;
|
||||
uint8_t gFootpathProvisionalSlope;
|
||||
uint8_t gFootpathConstructionMode;
|
||||
uint16_t gFootpathSelectedId;
|
||||
uint8_t gFootpathSelectedType;
|
||||
LocationXYZ16 gFootpathConstructFromPosition;
|
||||
CoordsXYZ gFootpathConstructFromPosition;
|
||||
uint8_t gFootpathConstructDirection;
|
||||
uint8_t gFootpathConstructSlope;
|
||||
uint8_t gFootpathConstructValidDirections;
|
||||
|
@ -125,9 +125,9 @@ TileElement* map_get_footpath_element(int32_t x, int32_t y, int32_t z)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
money32 footpath_remove(int32_t x, int32_t y, int32_t z, int32_t flags)
|
||||
money32 footpath_remove(CoordsXYZ footpathLoc, int32_t flags)
|
||||
{
|
||||
auto action = FootpathRemoveAction({ x, y, z * 8 });
|
||||
auto action = FootpathRemoveAction(footpathLoc);
|
||||
action.SetFlags(flags);
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
|
@ -143,22 +143,20 @@ money32 footpath_remove(int32_t x, int32_t y, int32_t z, int32_t flags)
|
|||
*
|
||||
* rct2: 0x006A76FF
|
||||
*/
|
||||
money32 footpath_provisional_set(int32_t type, int32_t x, int32_t y, int32_t z, int32_t slope)
|
||||
money32 footpath_provisional_set(int32_t type, CoordsXYZ footpathLoc, int32_t slope)
|
||||
{
|
||||
money32 cost;
|
||||
|
||||
footpath_provisional_remove();
|
||||
|
||||
auto footpathPlaceAction = FootpathPlaceAction({ x, y, z * 8 }, slope, type);
|
||||
auto footpathPlaceAction = FootpathPlaceAction(footpathLoc, slope, type);
|
||||
footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
auto res = GameActions::Execute(&footpathPlaceAction);
|
||||
cost = res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
{
|
||||
gFootpathProvisionalType = type;
|
||||
gFootpathProvisionalPosition.x = x;
|
||||
gFootpathProvisionalPosition.y = y;
|
||||
gFootpathProvisionalPosition.z = z & 0xFF;
|
||||
gFootpathProvisionalPosition = footpathLoc;
|
||||
gFootpathProvisionalSlope = slope;
|
||||
gFootpathProvisionalFlags |= PROVISIONAL_PATH_FLAG_1;
|
||||
|
||||
|
@ -184,15 +182,15 @@ money32 footpath_provisional_set(int32_t type, int32_t x, int32_t y, int32_t z,
|
|||
}
|
||||
else if (
|
||||
gFootpathConstructSlope == TILE_ELEMENT_SLOPE_FLAT
|
||||
|| gFootpathProvisionalPosition.z * 8 < gFootpathConstructFromPosition.z)
|
||||
|| gFootpathProvisionalPosition.z < gFootpathConstructFromPosition.z)
|
||||
{
|
||||
// Going either straight on, or down.
|
||||
virtual_floor_set_height(gFootpathProvisionalPosition.z * 8);
|
||||
virtual_floor_set_height(gFootpathProvisionalPosition.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Going up in the world!
|
||||
virtual_floor_set_height((gFootpathProvisionalPosition.z + 2) * 8);
|
||||
virtual_floor_set_height(gFootpathProvisionalPosition.z + (2 * 8));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +208,7 @@ void footpath_provisional_remove()
|
|||
gFootpathProvisionalFlags &= ~PROVISIONAL_PATH_FLAG_1;
|
||||
|
||||
footpath_remove(
|
||||
gFootpathProvisionalPosition.x, gFootpathProvisionalPosition.y, gFootpathProvisionalPosition.z,
|
||||
gFootpathProvisionalPosition,
|
||||
GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND
|
||||
| GAME_COMMAND_FLAG_GHOST);
|
||||
}
|
||||
|
|
|
@ -155,13 +155,13 @@ enum
|
|||
};
|
||||
|
||||
extern uint8_t gFootpathProvisionalFlags;
|
||||
extern LocationXYZ16 gFootpathProvisionalPosition;
|
||||
extern CoordsXYZ gFootpathProvisionalPosition;
|
||||
extern uint8_t gFootpathProvisionalType;
|
||||
extern uint8_t gFootpathProvisionalSlope;
|
||||
extern uint8_t gFootpathConstructionMode;
|
||||
extern uint16_t gFootpathSelectedId;
|
||||
extern uint8_t gFootpathSelectedType;
|
||||
extern LocationXYZ16 gFootpathConstructFromPosition;
|
||||
extern CoordsXYZ gFootpathConstructFromPosition;
|
||||
extern uint8_t gFootpathConstructDirection;
|
||||
extern uint8_t gFootpathConstructSlope;
|
||||
extern uint8_t gFootpathConstructValidDirections;
|
||||
|
@ -176,8 +176,8 @@ TileElement* map_get_footpath_element(int32_t x, int32_t y, int32_t z);
|
|||
struct PathElement;
|
||||
PathElement* map_get_footpath_element_slope(int32_t x, int32_t y, int32_t z, int32_t slope);
|
||||
void footpath_interrupt_peeps(int32_t x, int32_t y, int32_t z);
|
||||
money32 footpath_remove(int32_t x, int32_t y, int32_t z, int32_t flags);
|
||||
money32 footpath_provisional_set(int32_t type, int32_t x, int32_t y, int32_t z, int32_t slope);
|
||||
money32 footpath_remove(CoordsXYZ footpathLoc, int32_t flags);
|
||||
money32 footpath_provisional_set(int32_t type, CoordsXYZ footpathLoc, int32_t slope);
|
||||
void footpath_provisional_remove();
|
||||
void footpath_provisional_update();
|
||||
void footpath_get_coordinates_from_pos(
|
||||
|
|
|
@ -71,8 +71,8 @@ const TileCoordsXY TileDirectionDelta[] = { { -1, 0 }, { 0, +1 }, { +1, 0 },
|
|||
|
||||
uint16_t gMapSelectFlags;
|
||||
uint16_t gMapSelectType;
|
||||
LocationXY16 gMapSelectPositionA;
|
||||
LocationXY16 gMapSelectPositionB;
|
||||
CoordsXY gMapSelectPositionA;
|
||||
CoordsXY gMapSelectPositionB;
|
||||
LocationXYZ16 gMapSelectArrowPosition;
|
||||
uint8_t gMapSelectArrowDirection;
|
||||
|
||||
|
@ -1508,9 +1508,7 @@ void map_restore_provisional_elements()
|
|||
if (gFootpathProvisionalFlags & PROVISIONAL_PATH_FLAG_1)
|
||||
{
|
||||
gFootpathProvisionalFlags &= ~PROVISIONAL_PATH_FLAG_1;
|
||||
footpath_provisional_set(
|
||||
gFootpathProvisionalType, gFootpathProvisionalPosition.x, gFootpathProvisionalPosition.y,
|
||||
gFootpathProvisionalPosition.z, gFootpathProvisionalSlope);
|
||||
footpath_provisional_set(gFootpathProvisionalType, gFootpathProvisionalPosition, gFootpathProvisionalSlope);
|
||||
}
|
||||
if (window_find_by_class(WC_RIDE_CONSTRUCTION) != nullptr)
|
||||
{
|
||||
|
@ -2023,7 +2021,7 @@ void map_invalidate_element(int32_t x, int32_t y, TileElement* tileElement)
|
|||
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
}
|
||||
|
||||
void map_invalidate_region(const LocationXY16& mins, const LocationXY16& maxs)
|
||||
void map_invalidate_region(const CoordsXY& mins, const CoordsXY& maxs)
|
||||
{
|
||||
int32_t x0, y0, x1, y1, left, right, top, bottom;
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ extern int16_t gMapBaseZ;
|
|||
|
||||
extern uint16_t gMapSelectFlags;
|
||||
extern uint16_t gMapSelectType;
|
||||
extern LocationXY16 gMapSelectPositionA;
|
||||
extern LocationXY16 gMapSelectPositionB;
|
||||
extern CoordsXY gMapSelectPositionA;
|
||||
extern CoordsXY gMapSelectPositionB;
|
||||
extern LocationXYZ16 gMapSelectArrowPosition;
|
||||
extern uint8_t gMapSelectArrowDirection;
|
||||
|
||||
|
@ -213,7 +213,7 @@ void map_invalidate_tile_zoom1(int32_t x, int32_t y, int32_t z0, int32_t z1);
|
|||
void map_invalidate_tile_zoom0(int32_t x, int32_t y, int32_t z0, int32_t z1);
|
||||
void map_invalidate_tile_full(int32_t x, int32_t y);
|
||||
void map_invalidate_element(int32_t x, int32_t y, TileElement* tileElement);
|
||||
void map_invalidate_region(const LocationXY16& mins, const LocationXY16& maxs);
|
||||
void map_invalidate_region(const CoordsXY& mins, const CoordsXY& maxs);
|
||||
|
||||
int32_t map_get_tile_side(int32_t mapX, int32_t mapY);
|
||||
int32_t map_get_tile_quadrant(int32_t mapX, int32_t mapY);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "Map.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
static constexpr const LocationXY16 _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, { -1, 1 }, { -1, -1 } };
|
||||
static constexpr const CoordsXY _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, { -1, 1 }, { -1, -1 } };
|
||||
|
||||
bool rct_sprite::IsMoneyEffect()
|
||||
{
|
||||
|
|
|
@ -91,8 +91,8 @@ int object_entry_group_counts[] = {
|
|||
GeneralConfiguration gConfigGeneral;
|
||||
uint16_t gMapSelectFlags;
|
||||
uint16_t gMapSelectType;
|
||||
LocationXY16 gMapSelectPositionA;
|
||||
LocationXY16 gMapSelectPositionB;
|
||||
CoordsXY gMapSelectPositionA;
|
||||
CoordsXY gMapSelectPositionB;
|
||||
LocationXYZ16 gMapSelectArrowPosition;
|
||||
uint8_t gMapSelectArrowDirection;
|
||||
|
||||
|
|
Loading…
Reference in New Issue