Merge pull request #9531 from 0Cufox0/CoordsXY(ZD)

refactor CoordsXY(ZD)
This commit is contained in:
Duncan authored and GitHub committed 2019-08-05 21:33:52 +01:00
commit 2fd91fd8ef
18 files changed
+167 -206

No files matched your search

@@ -496,7 +496,7 @@ int32_t viewport_interaction_right_click(int32_t x, int32_t y)
static void viewport_interaction_remove_scenery(TileElement* tileElement, int32_t x, int32_t y)
{
auto removeSceneryAction = SmallSceneryRemoveAction(
x, y, tileElement->base_height, tileElement->AsSmallScenery()->GetSceneryQuadrant(),
{ x, y, tileElement->base_height * 8 }, tileElement->AsSmallScenery()->GetSceneryQuadrant(),
tileElement->AsSmallScenery()->GetEntryIndex());
GameActions::Execute(&removeSceneryAction);
@@ -574,7 +574,7 @@ static void viewport_interaction_remove_park_wall(TileElement* tileElement, int3
}
else
{
TileCoordsXYZD wallLocation = { x >> 5, y >> 5, tileElement->base_height, tileElement->GetDirection() };
CoordsXYZD wallLocation = { x, y, tileElement->base_height * 8, tileElement->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
}
@@ -596,7 +596,8 @@ static void viewport_interaction_remove_large_scenery(TileElement* tileElement,
else
{
auto removeSceneryAction = LargeSceneryRemoveAction(
x, y, tileElement->base_height, tileElement->GetDirection(), tileElement->AsLargeScenery()->GetSequenceIndex());
{ x, y, tileElement->base_height * 8, tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&removeSceneryAction);
}
}
+2 -1
View File
@@ -4349,7 +4349,8 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_
z = tileElement->base_height * 8;
direction = tileElement->GetDirection();
auto gameAction = RideSetColourSchemeAction(x, y, z, direction, tileElement->AsTrack()->GetTrackType(), newColourScheme);
auto gameAction = RideSetColourSchemeAction(
CoordsXYZD{ x, y, z, static_cast<Direction>(direction) }, tileElement->AsTrack()->GetTrackType(), newColourScheme);
GameActions::Execute(&gameAction);
}
+2 -3
View File
@@ -232,10 +232,9 @@ static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
}
auto sceneryRemoveAction = LargeSceneryRemoveAction(
x, y, tile_element->base_height, tile_element->GetDirection(),
{ x, y, tile_element->base_height * 8, tile_element->GetDirection() },
tile_element->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&sceneryRemoveAction);
break;
}
case WIDX_SIGN_TEXT:
@@ -474,7 +473,7 @@ static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex
}
tile_element++;
}
TileCoordsXYZD wallLocation = { x >> 5, y >> 5, tile_element->base_height, tile_element->GetDirection() };
CoordsXYZD wallLocation = { x, y, tile_element->base_height * 8, tile_element->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
break;
+6 -4
View File
@@ -152,7 +152,7 @@ private:
case TILE_ELEMENT_TYPE_PATH:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_FOOTPATH)
{
auto footpathRemoveAction = FootpathRemoveAction(x * 32, y * 32, tileElement->base_height);
auto footpathRemoveAction = FootpathRemoveAction({ x * 32, y * 32, tileElement->base_height * 8 });
footpathRemoveAction.SetFlags(GetFlags());
auto res = executing ? GameActions::ExecuteNested(&footpathRemoveAction)
@@ -169,7 +169,8 @@ private:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
{
auto removeSceneryAction = SmallSceneryRemoveAction(
x * 32, y * 32, tileElement->base_height, tileElement->AsSmallScenery()->GetSceneryQuadrant(),
{ x * 32, y * 32, tileElement->base_height * 8 },
tileElement->AsSmallScenery()->GetSceneryQuadrant(),
tileElement->AsSmallScenery()->GetEntryIndex());
removeSceneryAction.SetFlags(GetFlags());
@@ -186,7 +187,8 @@ private:
case TILE_ELEMENT_TYPE_WALL:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_SMALL)
{
TileCoordsXYZD wallLocation = { x, y, tileElement->base_height, tileElement->GetDirection() };
CoordsXYZD wallLocation = { x * 32, y * 32, tileElement->base_height * 8,
tileElement->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
wallRemoveAction.SetFlags(GetFlags());
@@ -204,7 +206,7 @@ private:
if (_itemsToClear & CLEARABLE_ITEMS::SCENERY_LARGE)
{
auto removeSceneryAction = LargeSceneryRemoveAction(
x * 32, y * 32, tileElement->base_height, tileElement->GetDirection(),
{ x * 32, y * 32, tileElement->base_height * 8, tileElement->GetDirection() },
tileElement->AsLargeScenery()->GetSequenceIndex());
removeSceneryAction.SetFlags(GetFlags() | GAME_COMMAND_FLAG_PATH_SCENERY);
+14 -17
View File
@@ -25,16 +25,12 @@
DEFINE_GAME_ACTION(FootpathRemoveAction, GAME_COMMAND_REMOVE_PATH, GameActionResult)
{
private:
int32_t _x;
int32_t _y;
int32_t _z;
CoordsXYZ _loc;
public:
FootpathRemoveAction() = default;
FootpathRemoveAction(int32_t x, int32_t y, int32_t z)
: _x(x)
, _y(y)
, _z(z)
FootpathRemoveAction(CoordsXYZ location)
: _loc(location)
{
}
@@ -47,7 +43,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z);
stream << DS_TAG(_loc);
}
GameActionResult::Ptr Query() const override
@@ -55,9 +51,10 @@ public:
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position = { _x + 16, _y + 16, _z * 8 };
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_x, _y, _z * 8))
if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode)
&& !map_is_location_owned(_loc.x, _loc.y, _loc.z))
{
return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
@@ -78,25 +75,25 @@ public:
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position = { _x + 16, _y + 16, _z * 8 };
res->Position = { _loc.x + 16, _loc.y + 16, _loc.z };
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
footpath_interrupt_peeps(_x, _y, _z * 8);
footpath_remove_litter(_x, _y, _z * 8);
footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z);
footpath_remove_litter(_loc.x, _loc.y, _loc.z);
}
TileElement* footpathElement = GetFootpathElement();
if (footpathElement != nullptr)
{
footpath_queue_chain_reset();
auto bannerRes = RemoveBannersAtElement(_x, _y, footpathElement);
auto bannerRes = RemoveBannersAtElement(_loc.x, _loc.y, footpathElement);
if (bannerRes->Error == GA_ERROR::OK)
{
res->Cost += bannerRes->Cost;
}
footpath_remove_edges_at(_x, _y, footpathElement);
map_invalidate_tile_full(_x, _y);
footpath_remove_edges_at(_loc.x, _loc.y, footpathElement);
map_invalidate_tile_full(_loc.x, _loc.y);
tile_element_remove(footpathElement);
footpath_update_queue_chains();
}
@@ -115,7 +112,7 @@ private:
{
bool getGhostPath = GetFlags() & GAME_COMMAND_FLAG_GHOST;
TileElement* tileElement = map_get_footpath_element(_x / 32, _y / 32, _z);
TileElement* tileElement = map_get_footpath_element(_loc.x / 32, _loc.y / 32, _loc.z / 32);
TileElement* footpathElement = nullptr;
if (tileElement != nullptr)
{
+3 -3
View File
@@ -23,7 +23,7 @@
#pragma region PlaceParkEntranceAction
money32 place_park_entrance(int16_t x, int16_t y, int16_t z, uint8_t direction)
{
auto gameAction = PlaceParkEntranceAction(x, y, z, direction);
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, direction });
auto result = GameActions::Execute(&gameAction);
if (result->Error == GA_ERROR::OK)
{
@@ -43,7 +43,7 @@ money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direc
{
park_entrance_remove_ghost();
auto gameAction = PlaceParkEntranceAction(x, y, z, direction);
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, (Direction)direction });
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
auto result = GameActions::Execute(&gameAction);
@@ -178,7 +178,7 @@ money32 maze_set_track(
uint16_t x, uint16_t y, uint16_t z, uint8_t flags, bool initialPlacement, uint8_t direction, ride_id_t rideIndex,
uint8_t mode)
{
auto gameAction = MazeSetTrackAction(x, y, z, initialPlacement, direction, rideIndex, mode);
auto gameAction = MazeSetTrackAction({ x, y, z, direction }, initialPlacement, rideIndex, mode);
gameAction.SetFlags(flags);
GameActionResult::Ptr res;
@@ -26,20 +26,14 @@
DEFINE_GAME_ACTION(LargeSceneryRemoveAction, GAME_COMMAND_REMOVE_LARGE_SCENERY, GameActionResult)
{
private:
int16_t _x;
int16_t _y;
uint8_t _baseHeight;
uint8_t _direction;
CoordsXYZD _loc;
uint16_t _tileIndex;
public:
LargeSceneryRemoveAction() = default;
LargeSceneryRemoveAction(int16_t x, int16_t y, uint8_t baseHeight, uint8_t direction, uint16_t tileIndex)
: _x(x)
, _y(y)
, _baseHeight(baseHeight)
, _direction(direction)
LargeSceneryRemoveAction(CoordsXYZD location, uint16_t tileIndex)
: _loc(location)
, _tileIndex(tileIndex)
{
}
@@ -53,7 +47,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_baseHeight) << DS_TAG(_direction) << DS_TAG(_tileIndex);
stream << DS_TAG(_loc) << DS_TAG(_tileIndex);
}
GameActionResult::Ptr Query() const override
@@ -62,9 +56,9 @@ public:
const uint32_t flags = GetFlags();
int32_t z = tile_element_height(_x, _y);
res->Position.x = _x + 16;
res->Position.y = _y + 16;
int32_t z = tile_element_height(_loc.x, _loc.x);
res->Position.x = _loc.x + 16;
res->Position.y = _loc.y + 16;
res->Position.z = z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Cost = 0;
@@ -72,21 +66,20 @@ public:
TileElement* tileElement = FindLargeSceneryElement();
if (tileElement == nullptr)
{
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _x, _y);
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
}
rct_scenery_entry* scenery_entry = tileElement->AsLargeScenery()->GetEntry();
LocationXYZ16 firstTile = {
scenery_entry->large_scenery.tiles[_tileIndex].x_offset, scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_baseHeight * 8) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset)
};
LocationXYZ16 firstTile = { scenery_entry->large_scenery.tiles[_tileIndex].x_offset,
scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset) };
rotate_map_coordinates(&firstTile.x, &firstTile.y, _direction);
rotate_map_coordinates(&firstTile.x, &firstTile.y, _loc.direction);
firstTile.x = _x - firstTile.x;
firstTile.y = _y - firstTile.y;
firstTile.x = _loc.x - firstTile.x;
firstTile.y = _loc.y - firstTile.y;
bool calculate_cost = true;
for (int32_t i = 0; scenery_entry->large_scenery.tiles[i].x_offset != -1; i++)
@@ -95,7 +88,7 @@ public:
scenery_entry->large_scenery.tiles[i].y_offset,
scenery_entry->large_scenery.tiles[i].z_offset };
rotate_map_coordinates(&currentTile.x, &currentTile.y, _direction);
rotate_map_coordinates(&currentTile.x, &currentTile.y, _loc.direction);
currentTile.x += firstTile.x;
currentTile.y += firstTile.y;
@@ -133,9 +126,9 @@ public:
const uint32_t flags = GetFlags();
int32_t z = tile_element_height(_x, _y);
res->Position.x = _x + 16;
res->Position.y = _y + 16;
int32_t z = tile_element_height(_loc.x, _loc.y);
res->Position.x = _loc.x + 16;
res->Position.y = _loc.y + 16;
res->Position.z = z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Cost = 0;
@@ -143,7 +136,7 @@ public:
TileElement* tileElement = FindLargeSceneryElement();
if (tileElement == nullptr)
{
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _x, _y);
log_warning("Invalid game command for scenery removal, x = %d, y = %d", _loc.x, _loc.y);
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
}
@@ -151,15 +144,14 @@ public:
rct_scenery_entry* scenery_entry = tileElement->AsLargeScenery()->GetEntry();
LocationXYZ16 firstTile = {
scenery_entry->large_scenery.tiles[_tileIndex].x_offset, scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_baseHeight * 8) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset)
};
LocationXYZ16 firstTile = { scenery_entry->large_scenery.tiles[_tileIndex].x_offset,
scenery_entry->large_scenery.tiles[_tileIndex].y_offset,
static_cast<int16_t>((_loc.z) - scenery_entry->large_scenery.tiles[_tileIndex].z_offset) };
rotate_map_coordinates(&firstTile.x, &firstTile.y, _direction);
rotate_map_coordinates(&firstTile.x, &firstTile.y, _loc.direction);
firstTile.x = _x - firstTile.x;
firstTile.y = _y - firstTile.y;
firstTile.x = _loc.x - firstTile.x;
firstTile.y = _loc.y - firstTile.y;
for (int32_t i = 0; scenery_entry->large_scenery.tiles[i].x_offset != -1; i++)
{
@@ -167,7 +159,7 @@ public:
scenery_entry->large_scenery.tiles[i].y_offset,
scenery_entry->large_scenery.tiles[i].z_offset };
rotate_map_coordinates(&currentTile.x, &currentTile.y, _direction);
rotate_map_coordinates(&currentTile.x, &currentTile.y, _loc.direction);
currentTile.x += firstTile.x;
currentTile.y += firstTile.y;
@@ -188,7 +180,7 @@ public:
if (sceneryElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
continue;
if (sceneryElement->GetDirection() != _direction)
if (sceneryElement->GetDirection() != _loc.direction)
continue;
if (sceneryElement->AsLargeScenery()->GetSequenceIndex() != i)
@@ -222,7 +214,7 @@ public:
private:
TileElement* FindLargeSceneryElement() const
{
TileElement* tileElement = map_get_first_element_at(_x / 32, _y / 32);
TileElement* tileElement = map_get_first_element_at(_loc.x / 32, _loc.y / 32);
if (tileElement == nullptr)
return nullptr;
@@ -231,13 +223,13 @@ private:
if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY)
continue;
if (tileElement->base_height != _baseHeight)
if (tileElement->base_height != _loc.z / 8)
continue;
if (tileElement->AsLargeScenery()->GetSequenceIndex() != _tileIndex)
continue;
if (tileElement->GetDirection() != _direction)
if (tileElement->GetDirection() != _loc.direction)
continue;
// If we are removing ghost elements
+34 -45
View File
@@ -6,7 +6,6 @@
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "../Cheats.h"
@@ -20,7 +19,6 @@
#include "../world/Footpath.h"
#include "../world/Park.h"
#include "GameAction.h"
// clang-format off
/** rct2: 0x00993CE9 */
static constexpr const uint8_t byte_993CE9[] = {
@@ -51,11 +49,8 @@ static constexpr const uint8_t byte_993D0C[] = {
DEFINE_GAME_ACTION(MazeSetTrackAction, GAME_COMMAND_SET_MAZE_TRACK, GameActionResult)
{
private:
uint16_t _x;
uint16_t _y;
uint16_t _z;
CoordsXYZD _loc;
bool _initialPlacement;
uint8_t _direction;
NetworkRideId_t _rideIndex;
uint8_t _mode;
@@ -63,13 +58,9 @@ public:
MazeSetTrackAction()
{
}
MazeSetTrackAction(
uint16_t x, uint16_t y, uint16_t z, bool initialPlacement, uint8_t direction, NetworkRideId_t rideIndex, uint8_t mode)
: _x(x)
, _y(y)
, _z(z)
MazeSetTrackAction(CoordsXYZD location, bool initialPlacement, NetworkRideId_t rideIndex, uint8_t mode)
: _loc(location)
, _initialPlacement(initialPlacement)
, _direction(direction)
, _rideIndex(rideIndex)
, _mode(mode)
{
@@ -78,43 +69,39 @@ public:
void Serialise(DataSerialiser & stream) override
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z) << DS_TAG(_initialPlacement) << DS_TAG(_direction)
<< DS_TAG(_rideIndex) << DS_TAG(_mode);
stream << DS_TAG(_loc) << DS_TAG(_loc.direction) << DS_TAG(_initialPlacement) << DS_TAG(_rideIndex) << DS_TAG(_mode);
}
GameActionResult::Ptr Query() const override
{
auto res = std::make_unique<GameActionResult>();
res->Position.x = _x + 8;
res->Position.y = _y + 8;
res->Position.z = _z;
res->Position.x = _loc.x + 8;
res->Position.y = _loc.y + 8;
res->Position.z = _loc.z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
if (!map_check_free_elements_and_reorganise(1))
{
res->Error = GA_ERROR::NO_FREE_ELEMENTS;
res->ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res;
}
if ((_z & 0xF) != 0)
if ((_loc.z & 0xF) != 0)
{
res->Error = GA_ERROR::UNKNOWN;
res->ErrorMessage = STR_CONSTRUCTION_ERR_UNKNOWN;
return res;
}
if (!map_is_location_owned(floor2(_x, 32), floor2(_y, 32), _z) && !gCheatsSandboxMode)
if (!map_is_location_owned(floor2(_loc.x, 32), floor2(_loc.y, 32), _loc.z) && !gCheatsSandboxMode)
{
res->Error = GA_ERROR::NOT_OWNED;
res->ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK;
return res;
}
TileElement* tileElement = map_get_surface_element_at(_x / 32, _y / 32);
TileElement* tileElement = map_get_surface_element_at(_loc.x / 32, _loc.y / 32);
if (tileElement == nullptr)
{
res->Error = GA_ERROR::UNKNOWN;
@@ -122,8 +109,8 @@ public:
return res;
}
uint8_t baseHeight = _z >> 3;
uint8_t clearanceHeight = (_z + 32) >> 3;
uint8_t baseHeight = _loc.z / 8;
uint8_t clearanceHeight = (_loc.z + 32) / 8;
int8_t heightDifference = baseHeight - tileElement->base_height;
if (heightDifference >= 0 && !gCheatsDisableSupportLimits)
@@ -138,7 +125,7 @@ public:
}
}
tileElement = map_get_track_element_at_of_type_from_ride(_x, _y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
tileElement = map_get_track_element_at_of_type_from_ride(_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
if (tileElement == nullptr)
{
if (_mode != GC_SET_MAZE_TRACK_BUILD)
@@ -148,7 +135,7 @@ public:
return res;
}
if (!map_can_construct_at(floor2(_x, 32), floor2(_y, 32), baseHeight, clearanceHeight, { 0b1111, 0 }))
if (!map_can_construct_at(floor2(_loc.x, 32), floor2(_loc.y, 32), baseHeight, clearanceHeight, { 0b1111, 0 }))
{
return MakeResult(GA_ERROR::NO_CLEARANCE, res->ErrorTitle, gGameCommandErrorText, gCommonFormatArgs);
}
@@ -188,9 +175,9 @@ public:
{
auto res = std::make_unique<GameActionResult>();
res->Position.x = _x + 8;
res->Position.y = _y + 8;
res->Position.z = _z;
res->Position.x = _loc.x + 8;
res->Position.y = _loc.y + 8;
res->Position.z = _loc.z;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
res->ErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
@@ -204,14 +191,15 @@ public:
uint32_t flags = GetFlags();
if (!(flags & GAME_COMMAND_FLAG_GHOST))
{
footpath_remove_litter(_x, _y, _z);
wall_remove_at(floor2(_x, 32), floor2(_y, 32), _z, _z + 32);
footpath_remove_litter(_loc.x, _loc.y, _loc.z);
wall_remove_at(floor2(_loc.x, 32), floor2(_loc.y, 32), _loc.z, _loc.z + 32);
}
uint8_t baseHeight = _z >> 3;
uint8_t clearanceHeight = (_z + 32) >> 3;
uint8_t baseHeight = _loc.z / 8;
uint8_t clearanceHeight = (_loc.z + 32) / 8;
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(_x, _y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(
_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
if (tileElement == nullptr)
{
Ride* ride = get_ride(_rideIndex);
@@ -220,10 +208,10 @@ public:
money32 price = (((RideTrackCosts[ride->type].track_price * TrackPricing[TRACK_ELEM_MAZE]) >> 16));
res->Cost = price / 2 * 10;
uint16_t flooredX = floor2(_x, 32);
uint16_t flooredY = floor2(_y, 32);
uint16_t flooredX = floor2(_loc.x, 32);
uint16_t flooredY = floor2(_loc.y, 32);
tileElement = tile_element_insert(_x / 32, _y / 32, baseHeight, 0xF);
tileElement = tile_element_insert(_loc.x / 32, _loc.y / 32, baseHeight, 0xF);
assert(tileElement != nullptr);
tileElement->clearance_height = clearanceHeight;
@@ -255,20 +243,20 @@ public:
{
case GC_SET_MAZE_TRACK_BUILD:
{
uint8_t segmentOffset = MazeGetSegmentBit(_x, _y);
uint8_t segmentOffset = MazeGetSegmentBit(_loc.x, _loc.y);
tileElement->AsTrack()->MazeEntrySubtract(1 << segmentOffset);
if (!_initialPlacement)
{
segmentOffset = byte_993CE9[(_direction + segmentOffset)];
segmentOffset = byte_993CE9[(_loc.direction + segmentOffset)];
tileElement->AsTrack()->MazeEntrySubtract(1 << segmentOffset);
uint8_t temp_edx = byte_993CFC[segmentOffset];
if (temp_edx != 0xFF)
{
uint16_t previousElementX = floor2(_x, 32) - CoordsDirectionDelta[_direction].x;
uint16_t previousElementY = floor2(_y, 32) - CoordsDirectionDelta[_direction].y;
uint16_t previousElementX = floor2(_loc.x, 32) - CoordsDirectionDelta[_loc.direction].x;
uint16_t previousElementY = floor2(_loc.y, 32) - CoordsDirectionDelta[_loc.direction].y;
TileElement* previousTileElement = map_get_track_element_at_of_type_from_ride(
previousElementX, previousElementY, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
@@ -293,8 +281,8 @@ public:
case GC_SET_MAZE_TRACK_FILL:
if (!_initialPlacement)
{
uint16_t previousSegmentX = _x - CoordsDirectionDelta[_direction].x / 2;
uint16_t previousSegmentY = _y - CoordsDirectionDelta[_direction].y / 2;
uint16_t previousSegmentX = _loc.x - CoordsDirectionDelta[_loc.direction].x / 2;
uint16_t previousSegmentY = _loc.y - CoordsDirectionDelta[_loc.direction].y / 2;
tileElement = map_get_track_element_at_of_type_from_ride(
previousSegmentX, previousSegmentY, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
@@ -340,7 +328,8 @@ public:
break;
}
map_invalidate_tile(floor2(_x, 32), floor2(_y, 32), tileElement->base_height * 8, tileElement->clearance_height * 8);
map_invalidate_tile(
floor2(_loc.x, 32), floor2(_loc.y, 32), tileElement->base_height * 8, tileElement->clearance_height * 8);
if ((tileElement->AsTrack()->GetMazeEntry() & 0x8888) == 0x8888)
{
@@ -25,20 +25,14 @@
DEFINE_GAME_ACTION(PlaceParkEntranceAction, GAME_COMMAND_PLACE_PARK_ENTRANCE, GameActionResult)
{
private:
int16_t _x;
int16_t _y;
int16_t _z;
uint8_t _direction;
CoordsXYZD _loc;
public:
PlaceParkEntranceAction()
{
}
PlaceParkEntranceAction(int16_t x, int16_t y, int16_t z, int16_t direction)
: _x(x)
, _y(y)
, _z(z)
, _direction(direction)
PlaceParkEntranceAction(CoordsXYZD location)
: _loc(location)
{
}
@@ -51,7 +45,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z) << DS_TAG(_direction);
stream << DS_TAG(_loc);
}
GameActionResult::Ptr Query() const override
@@ -64,14 +58,14 @@ public:
auto res = std::make_unique<GameActionResult>();
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
res->Position = CoordsXYZ{ _x, _y, _z * 16 };
res->Position = { _loc.x, _loc.y, _loc.z };
if (!map_check_free_elements_and_reorganise(3))
{
return std::make_unique<GameActionResult>(GA_ERROR::NO_FREE_ELEMENTS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_NONE);
}
if (_x <= 32 || _y <= 32 || _x >= (gMapSizeUnits - 32) || _y >= (gMapSizeUnits - 32))
if (_loc.x <= 32 || _loc.y <= 32 || _loc.x >= (gMapSizeUnits - 32) || _loc.y >= (gMapSizeUnits - 32))
{
return std::make_unique<GameActionResult>(
GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);
@@ -83,20 +77,20 @@ public:
GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_ERR_TOO_MANY_PARK_ENTRANCES);
}
int8_t zLow = _z * 2;
int8_t zLow = _loc.z / 8;
int8_t zHigh = zLow + 12;
LocationXY16 entranceLoc = { _x, _y };
LocationXY16 entranceLoc = { (int16_t)_loc.x, (int16_t)_loc.y };
for (uint8_t index = 0; index < 3; index++)
{
if (index == 1)
{
entranceLoc.x += CoordsDirectionDelta[(_direction - 1) & 0x3].x;
entranceLoc.y += CoordsDirectionDelta[(_direction - 1) & 0x3].y;
entranceLoc.x += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].x;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].y;
}
else if (index == 2)
{
entranceLoc.x += CoordsDirectionDelta[(_direction + 1) & 0x3].x * 2;
entranceLoc.y += CoordsDirectionDelta[(_direction + 1) & 0x3].y * 2;
entranceLoc.x += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].x * 2;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
}
if (!map_can_construct_at(entranceLoc.x, entranceLoc.y, zLow, zHigh, { 0b1111, 0 }))
@@ -121,31 +115,29 @@ public:
{
auto res = std::make_unique<GameActionResult>();
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
res->Position = CoordsXYZ{ _x, _y, _z * 16 };
res->Position = CoordsXYZ{ _loc.x, _loc.y, _loc.z };
uint32_t flags = GetFlags();
CoordsXYZD parkEntrance;
parkEntrance.x = _x;
parkEntrance.y = _y;
parkEntrance.z = _z * 16;
parkEntrance.direction = _direction;
parkEntrance = _loc;
gParkEntrances.push_back(parkEntrance);
int8_t zLow = _z * 2;
int8_t zLow = _loc.z / 8;
int8_t zHigh = zLow + 12;
CoordsXY entranceLoc = { _x, _y };
CoordsXY entranceLoc = { _loc.x, _loc.y };
for (uint8_t index = 0; index < 3; index++)
{
if (index == 1)
{
entranceLoc.x += CoordsDirectionDelta[(_direction - 1) & 0x3].x;
entranceLoc.y += CoordsDirectionDelta[(_direction - 1) & 0x3].y;
entranceLoc.x += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].x;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction - 1) & 0x3].y;
}
else if (index == 2)
{
entranceLoc.x += CoordsDirectionDelta[(_direction + 1) & 0x3].x * 2;
entranceLoc.y += CoordsDirectionDelta[(_direction + 1) & 0x3].y * 2;
entranceLoc.x += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].x * 2;
entranceLoc.y += CoordsDirectionDelta[(_loc.direction + 1) & 0x3].y * 2;
}
if (!(flags & GAME_COMMAND_FLAG_GHOST))
@@ -170,7 +162,7 @@ public:
newElement->SetGhost(true);
}
entranceElement->SetDirection(_direction);
entranceElement->SetDirection(_loc.direction);
entranceElement->SetSequenceIndex(index);
entranceElement->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
entranceElement->SetPathType(gFootpathSelectedId);
+1 -1
View File
@@ -268,7 +268,7 @@ private:
money32 MazeRemoveTrack(uint16_t x, uint16_t y, uint16_t z, uint8_t direction) const
{
auto setMazeTrack = MazeSetTrackAction(x, y, z, false, direction, _rideIndex, GC_SET_MAZE_TRACK_FILL);
auto setMazeTrack = MazeSetTrackAction(CoordsXYZD{ x, y, z, direction }, false, _rideIndex, GC_SET_MAZE_TRACK_FILL);
setMazeTrack.SetFlags(GetFlags());
auto execRes = GameActions::ExecuteNested(&setMazeTrack);
+7 -10
View File
@@ -24,16 +24,14 @@
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GAME_COMMAND_SET_COLOUR_SCHEME, GameActionResult)
{
private:
int32_t _x = 0, _y = 0, _z = 0, _direction = 0, _trackType = 0;
CoordsXYZD _loc{ 0, 0, 0, 0 };
int32_t _trackType = 0;
uint16_t _newColourScheme = 0;
public:
RideSetColourSchemeAction() = default;
RideSetColourSchemeAction(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t trackType, uint16_t newColourScheme)
: _x(x)
, _y(y)
, _z(z)
, _direction(direction)
RideSetColourSchemeAction(CoordsXYZD location, int32_t trackType, uint16_t newColourScheme)
: _loc(location)
, _trackType(trackType)
, _newColourScheme(newColourScheme)
{
@@ -48,8 +46,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z) << DS_TAG(_direction) << DS_TAG(_trackType)
<< DS_TAG(_newColourScheme);
stream << DS_TAG(_loc) << DS_TAG(_trackType) << DS_TAG(_newColourScheme);
}
GameActionResult::Ptr Query() const override
@@ -63,8 +60,8 @@ public:
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
res->ErrorTitle = STR_CANT_SET_COLOUR_SCHEME;
int32_t x = _x, y = _y, z = _z;
sub_6C683D(&x, &y, &z, _direction, _trackType, _newColourScheme, nullptr, 4);
int32_t x = _loc.x, y = _loc.y, z = _loc.z;
sub_6C683D(&x, &y, &z, _loc.direction, _trackType, _newColourScheme, nullptr, 4);
return res;
}
@@ -26,19 +26,15 @@
DEFINE_GAME_ACTION(SmallSceneryRemoveAction, GAME_COMMAND_REMOVE_SCENERY, GameActionResult)
{
private:
int16_t _x;
int16_t _y;
uint8_t _baseHeight;
CoordsXYZ _loc;
uint8_t _quadrant;
uint8_t _sceneryType;
public:
SmallSceneryRemoveAction() = default;
SmallSceneryRemoveAction(int16_t x, int16_t y, uint8_t baseHeight, uint8_t quadrant, uint8_t sceneryType)
: _x(x)
, _y(y)
, _baseHeight(baseHeight)
SmallSceneryRemoveAction(CoordsXYZ location, uint8_t quadrant, uint8_t sceneryType)
: _loc(location)
, _quadrant(quadrant)
, _sceneryType(sceneryType)
{
@@ -53,14 +49,14 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_baseHeight) << DS_TAG(_quadrant) << DS_TAG(_sceneryType);
stream << DS_TAG(_loc) << DS_TAG(_quadrant) << DS_TAG(_sceneryType);
}
GameActionResult::Ptr Query() const override
{
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
if (!map_is_location_valid({ _x, _y }))
if (!map_is_location_valid({ _loc.x, _loc.y }))
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
@@ -73,9 +69,7 @@ public:
res->Cost = entry->small_scenery.removal_price * 10;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position.x = _x;
res->Position.y = _y;
res->Position.z = _baseHeight * 8;
res->Position = _loc;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsSandboxMode)
{
@@ -92,7 +86,7 @@ public:
}
// Check if the land is owned
if (!map_is_location_owned(_x, _y, _baseHeight * 8))
if (!map_is_location_owned(_loc.x, _loc.y, _loc.z))
{
res->Error = GA_ERROR::NO_CLEARANCE;
res->ErrorTitle = STR_CANT_REMOVE_THIS;
@@ -122,9 +116,7 @@ public:
res->Cost = entry->small_scenery.removal_price * 10;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
res->Position.x = _x;
res->Position.y = _y;
res->Position.z = _baseHeight * 8;
res->Position = _loc;
TileElement* tileElement = FindSceneryElement();
if (tileElement == nullptr)
@@ -134,7 +126,7 @@ public:
res->Position.z = tile_element_height(res->Position.x, res->Position.y);
map_invalidate_tile_full(_x, _y);
map_invalidate_tile_full(_loc.x, _loc.y);
tile_element_remove(tileElement);
return res;
@@ -143,7 +135,7 @@ public:
private:
TileElement* FindSceneryElement() const
{
TileElement* tileElement = map_get_first_element_at(_x / 32, _y / 32);
TileElement* tileElement = map_get_first_element_at(_loc.x / 32, _loc.y / 32);
if (!tileElement)
return nullptr;
@@ -153,7 +145,7 @@ private:
continue;
if ((tileElement->AsSmallScenery()->GetSceneryQuadrant()) != _quadrant)
continue;
if (tileElement->base_height != _baseHeight)
if (tileElement->base_height != _loc.z / 8)
continue;
if (tileElement->AsSmallScenery()->GetEntryIndex() != _sceneryType)
continue;
+14 -15
View File
@@ -22,12 +22,12 @@
DEFINE_GAME_ACTION(WallRemoveAction, GAME_COMMAND_REMOVE_WALL, GameActionResult)
{
private:
TileCoordsXYZD _location;
CoordsXYZD _loc;
public:
WallRemoveAction() = default;
WallRemoveAction(const TileCoordsXYZD& location)
: _location(location)
WallRemoveAction(const CoordsXYZD& loc)
: _loc(loc)
{
}
@@ -35,7 +35,7 @@ public:
{
GameAction::Serialise(stream);
stream << DS_TAG(_location.x) << DS_TAG(_location.y) << DS_TAG(_location.z) << DS_TAG(_location.direction);
stream << DS_TAG(_loc);
}
GameActionResult::Ptr Query() const override
@@ -44,7 +44,7 @@ public:
res->Cost = 0;
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
if (!map_is_location_valid({ _location.x << 5, _location.y << 5 }))
if (!map_is_location_valid({ _loc.x, _loc.y }))
{
return std::make_unique<GameActionResult>(
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
@@ -52,12 +52,12 @@ public:
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
&& !map_is_location_owned(_location.x << 5, _location.y << 5, _location.z << 3))
&& !map_is_location_owned(_loc.x, _loc.y, _loc.z))
{
return std::make_unique<GameActionResult>(GA_ERROR::NOT_OWNED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
TileElement* wallElement = GetFirstWallElementAt(_location, isGhost);
TileElement* wallElement = GetFirstWallElementAt(_loc, isGhost);
if (wallElement == nullptr)
{
return std::make_unique<GameActionResult>(
@@ -76,29 +76,28 @@ public:
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
TileElement* wallElement = GetFirstWallElementAt(_location, isGhost);
TileElement* wallElement = GetFirstWallElementAt(_loc, isGhost);
if (wallElement == nullptr)
{
return std::make_unique<GameActionResult>(
GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS);
}
res->Position.x = (_location.x << 5) + 16;
res->Position.y = (_location.y << 5) + 16;
res->Position.x = _loc.x + 16;
res->Position.y = _loc.y + 16;
res->Position.z = tile_element_height(res->Position.x, res->Position.y);
tile_element_remove_banner_entry(wallElement);
map_invalidate_tile_zoom1(
_location.x << 5, _location.y << 5, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
map_invalidate_tile_zoom1(_loc.x, _loc.y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
tile_element_remove(wallElement);
return res;
}
private:
TileElement* GetFirstWallElementAt(const TileCoordsXYZD& location, bool isGhost) const
TileElement* GetFirstWallElementAt(const CoordsXYZD& location, bool isGhost) const
{
TileElement* tileElement = map_get_first_element_at(location.x, location.y);
TileElement* tileElement = map_get_first_element_at(location.x / 32, location.y / 32);
if (!tileElement)
return nullptr;
@@ -106,7 +105,7 @@ private:
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
continue;
if (tileElement->base_height != location.z)
if (tileElement->base_height != location.z / 8)
continue;
if (tileElement->GetDirection() != location.direction)
continue;
+1 -1
View File
@@ -34,7 +34,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "2"
#define NETWORK_STREAM_VERSION "3"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;
+4 -4
View File
@@ -776,17 +776,17 @@ static bool TrackDesignPlaceSceneryElementRemoveGhost(
quadrant = 0;
}
ga = std::make_unique<SmallSceneryRemoveAction>(mapCoord.x, mapCoord.y, z, quadrant, entry_index);
ga = std::make_unique<SmallSceneryRemoveAction>(CoordsXYZ{ mapCoord.x, mapCoord.y, z * 8 }, quadrant, entry_index);
break;
}
case OBJECT_TYPE_LARGE_SCENERY:
ga = std::make_unique<LargeSceneryRemoveAction>(mapCoord.x, mapCoord.y, z, sceneryRotation, 0);
ga = std::make_unique<LargeSceneryRemoveAction>(CoordsXYZD{ mapCoord.x, mapCoord.y, z * 8, sceneryRotation }, 0);
break;
case OBJECT_TYPE_WALLS:
ga = std::make_unique<WallRemoveAction>(TileCoordsXYZD{ mapCoord.x / 32, mapCoord.y / 32, z, sceneryRotation });
ga = std::make_unique<WallRemoveAction>(CoordsXYZD{ mapCoord.x, mapCoord.y, z * 8, sceneryRotation });
break;
case OBJECT_TYPE_PATHS:
ga = std::make_unique<FootpathRemoveAction>(mapCoord.x, mapCoord.y, z);
ga = std::make_unique<FootpathRemoveAction>(CoordsXYZ{ mapCoord.x, mapCoord.y, z * 8 });
break;
default:
return true;
+1 -1
View File
@@ -127,7 +127,7 @@ TileElement* map_get_footpath_element(int32_t x, int32_t y, int32_t z)
money32 footpath_remove(int32_t x, int32_t y, int32_t z, int32_t flags)
{
auto action = FootpathRemoveAction(x, y, z);
auto action = FootpathRemoveAction({ x, y, z * 8 });
action.SetFlags(flags);
if (flags & GAME_COMMAND_FLAG_APPLY)
+8 -8
View File
@@ -1755,7 +1755,7 @@ static void clear_element_at(int32_t x, int32_t y, TileElement** elementPtr)
}
case TILE_ELEMENT_TYPE_WALL:
{
TileCoordsXYZD wallLocation = { x >> 5, y >> 5, element->base_height, element->GetDirection() };
CoordsXYZD wallLocation = { x, y, element->base_height * 8, element->GetDirection() };
auto wallRemoveAction = WallRemoveAction(wallLocation);
GameActions::Execute(&wallRemoveAction);
}
@@ -1763,7 +1763,7 @@ static void clear_element_at(int32_t x, int32_t y, TileElement** elementPtr)
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
{
auto removeSceneryAction = LargeSceneryRemoveAction(
x, y, element->base_height, element->GetDirection(), element->AsLargeScenery()->GetSequenceIndex());
{ x, y, element->base_height * 8, element->GetDirection() }, element->AsLargeScenery()->GetSequenceIndex());
GameActions::Execute(&removeSceneryAction);
}
break;
@@ -1793,7 +1793,7 @@ static void clear_elements_at(int32_t x, int32_t y)
[x, y](const auto& spawn) { return floor2(spawn.x, 32) == x && floor2(spawn.y, 32) == y; }),
gPeepSpawns.end());
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
// Remove all elements except the last one
while (!tileElement->IsLastForTile())
@@ -1826,7 +1826,7 @@ int32_t map_get_highest_z(int32_t tileX, int32_t tileY)
LargeSceneryElement* map_get_large_scenery_segment(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t sequence)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement == nullptr)
{
return nullptr;
@@ -1849,7 +1849,7 @@ LargeSceneryElement* map_get_large_scenery_segment(int32_t x, int32_t y, int32_t
EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@@ -1874,7 +1874,7 @@ EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t
EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@@ -1899,7 +1899,7 @@ EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t
EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
@@ -1924,7 +1924,7 @@ EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, b
SmallSceneryElement* map_get_small_scenery_element_at(int32_t x, int32_t y, int32_t z, int32_t type, uint8_t quadrant)
{
TileElement* tileElement = map_get_first_element_at(x >> 5, y >> 5);
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32);
if (tileElement != nullptr)
{
do
+3 -3
View File
@@ -186,7 +186,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_0;
auto removeSceneryAction = SmallSceneryRemoveAction(x, y, z, gSceneryQuadrant, gSceneryPlaceObject);
auto removeSceneryAction = SmallSceneryRemoveAction({ x, y, z * 8 }, gSceneryQuadrant, gSceneryPlaceObject);
removeSceneryAction.SetFlags(
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
removeSceneryAction.Execute();
@@ -216,7 +216,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_2;
TileCoordsXYZD wallLocation = { x >> 5, y >> 5, z, gSceneryGhostWallRotation };
CoordsXYZD wallLocation = { x, y, z * 8, gSceneryGhostWallRotation };
auto wallRemoveAction = WallRemoveAction(wallLocation);
wallRemoveAction.SetFlags(GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_PATH_SCENERY);
wallRemoveAction.Execute();
@@ -226,7 +226,7 @@ void scenery_remove_ghost_tool_placement()
{
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_3;
auto removeSceneryAction = LargeSceneryRemoveAction(x, y, z, gSceneryPlaceRotation, 0);
auto removeSceneryAction = LargeSceneryRemoveAction({ x, y, z * 8, gSceneryPlaceRotation }, 0);
removeSceneryAction.SetFlags(
GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED
| GAME_COMMAND_FLAG_NO_SPEND);