Merge pull request #8044 from Gymnasiast/locopath-1

Small tile element and GC cleanup
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2018-10-03 20:16:25 +02:00
commit 65dcc381f4
25 files changed
+215 -167

No files matched your search

@@ -357,7 +357,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
set_map_tooltip_format_arg(2, rct_string_id, STR_FOOTPATH_MAP_TIP);
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
set_map_tooltip_format_arg(2, rct_string_id, STR_QUEUE_LINE_MAP_TIP);
return info->type;
@@ -467,8 +467,8 @@ static void viewport_interaction_remove_scenery(rct_tile_element* tileElement, i
{
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
game_do_command(
x, (tileElement->type << 8) | 1, y, (tileElement->AsSmallScenery()->GetEntryIndex() << 8) | tileElement->base_height,
GAME_COMMAND_REMOVE_SCENERY, 0, 0);
x, (tileElement->AsSmallScenery()->GetSceneryQuadrant() << 8) | GAME_COMMAND_FLAG_APPLY, y,
(tileElement->AsSmallScenery()->GetEntryIndex() << 8) | tileElement->base_height, GAME_COMMAND_REMOVE_SCENERY, 0, 0);
}
/**
@@ -507,7 +507,7 @@ static void viewport_interaction_remove_footpath_item(rct_tile_element* tileElem
int32_t type;
type = footpath_element_get_type(tileElement);
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
type |= 0x80;
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
+1 -1
View File
@@ -3620,7 +3620,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
}
}
if (pathsByDir[i] && footpath_element_is_queue(pathsByDir[i]))
if (pathsByDir[i] && (pathsByDir[i])->AsPath()->IsQueue())
{
pathsByDir[i] = nullptr;
}
+2 -2
View File
@@ -2140,8 +2140,8 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
typeName = language_get_string(STR_TILE_INSPECTOR_SURFACE);
break;
case TILE_ELEMENT_TYPE_PATH:
typeName = footpath_element_is_queue(tileElement) ? language_get_string(STR_QUEUE_LINE_MAP_TIP)
: language_get_string(STR_FOOTPATH_MAP_TIP);
typeName = tileElement->AsPath()->IsQueue() ? language_get_string(STR_QUEUE_LINE_MAP_TIP)
: language_get_string(STR_FOOTPATH_MAP_TIP);
break;
case TILE_ELEMENT_TYPE_TRACK:
typeName = language_get_string(STR_RIDE_COMPONENT_TRACK_CAPITALISED);
+6 -4
View File
@@ -1455,7 +1455,7 @@ static void sub_6E1F34(
<< 8;
*parameter_2 = tile_element->base_height;
*parameter_2 |= ((footpath_element_get_type(tile_element)) << 8);
if (footpath_element_is_queue(tile_element))
if (tile_element->AsPath()->IsQueue())
{
*parameter_2 |= LOCATION_NULL;
}
@@ -2403,8 +2403,10 @@ static money32 try_place_ghost_scenery(
// Small Scenery
// 6e252b
cost = game_do_command(
map_tile.x, parameter_1 | 0x69, map_tile.y, parameter_2, GAME_COMMAND_PLACE_SCENERY, parameter_3,
gSceneryPlaceZ);
map_tile.x,
parameter_1 | GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
| GAME_COMMAND_FLAG_GHOST,
map_tile.y, parameter_2, GAME_COMMAND_PLACE_SCENERY, parameter_3, gSceneryPlaceZ);
if (cost == MONEY32_UNDEFINED)
return cost;
@@ -2416,7 +2418,7 @@ static money32 try_place_ghost_scenery(
tileElement = gSceneryTileElement;
gSceneryGhostPosition.z = tileElement->base_height;
gSceneryTileElementType = tileElement->type;
gSceneryQuadrant = tileElement->AsSmallScenery()->GetSceneryQuadrant();
if (gSceneryGroundFlags & ELEMENT_IS_UNDERGROUND)
{
// Set underground on
+1 -1
View File
@@ -28,7 +28,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 "1"
#define NETWORK_STREAM_VERSION "2"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static rct_peep* _pickup_peep = nullptr;
+12 -8
View File
@@ -320,7 +320,7 @@ static void sub_6A4101(
paint_session* session, const rct_tile_element* tile_element, uint16_t height, uint32_t ebp, bool word_F3F038,
rct_footpath_entry* footpathEntry, uint32_t base_image_id, uint32_t imageFlags)
{
if (footpath_element_is_queue(tile_element))
if (tile_element->AsPath()->IsQueue())
{
uint8_t local_ebp = ebp & 0x0F;
if (footpath_element_is_sloped(tile_element))
@@ -798,7 +798,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
if (gTrackDesignSaveMode)
{
if (footpath_element_is_queue(tile_element))
if (tile_element->AsPath()->IsQueue())
{
if (tile_element->properties.path.ride_index != gTrackDesignSaveRideIndex)
{
@@ -974,6 +974,8 @@ void path_paint_box_support(
paint_session* session, const rct_tile_element* tileElement, int32_t height, rct_footpath_entry* footpathEntry,
bool hasFences, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
PathElement* pathElement = tileElement->AsPath();
// Rol edges around rotation
uint8_t edges = ((tileElement->properties.path.edges << session->CurrentRotation) & 0xF)
| (((tileElement->properties.path.edges & 0xF) << session->CurrentRotation) >> 4);
@@ -999,7 +1001,7 @@ void path_paint_box_support(
}
imageId += footpathEntry->image;
if (footpath_element_is_queue(tileElement))
if (pathElement->IsQueue())
{
imageId += 51;
}
@@ -1049,7 +1051,7 @@ void path_paint_box_support(
session, image_id | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y,
height + boundingBoxZOffset);
if (!footpath_element_is_queue(tileElement) && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE))
if (!pathElement->IsQueue() && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE))
{
// don't draw
}
@@ -1086,7 +1088,7 @@ void path_paint_box_support(
paint_util_set_general_support_height(session, height, 0x20);
if (footpath_element_is_queue(tileElement) || (tileElement->properties.path.edges != 0xFF && hasFences))
if (pathElement->IsQueue() || (tileElement->properties.path.edges != 0xFF && hasFences))
{
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
return;
@@ -1125,6 +1127,8 @@ void path_paint_pole_support(
paint_session* session, const rct_tile_element* tileElement, int16_t height, rct_footpath_entry* footpathEntry,
bool hasFences, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
PathElement* pathElement = tileElement->AsPath();
// Rol edges around rotation
uint8_t edges = ((tileElement->properties.path.edges << session->CurrentRotation) & 0xF)
| (((tileElement->properties.path.edges & 0xF) << session->CurrentRotation) >> 4);
@@ -1149,7 +1153,7 @@ void path_paint_pole_support(
}
imageId += footpathEntry->image;
if (footpath_element_is_queue(tileElement))
if (pathElement->IsQueue())
{
imageId += 51;
}
@@ -1201,7 +1205,7 @@ void path_paint_pole_support(
session, bridgeImage | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
boundBoxOffset.y, height + boundingBoxZOffset);
if (footpath_element_is_queue(tileElement) || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE))
if (pathElement->IsQueue() || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE))
{
sub_98199C(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
@@ -1240,7 +1244,7 @@ void path_paint_pole_support(
paint_util_set_general_support_height(session, height, 0x20);
if (footpath_element_is_queue(tileElement) || (tileElement->properties.path.edges != 0xFF && hasFences))
if (pathElement->IsQueue() || (tileElement->properties.path.edges != 0xFF && hasFences))
{
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
return;
+4 -4
View File
@@ -247,7 +247,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, rct_tile_el
if (footpath_element_is_wide(nextTileElement))
return PATH_SEARCH_WIDE;
// Only queue tiles that are connected to a ride are returned as ride queues.
if (footpath_element_is_queue(nextTileElement) && nextTileElement->properties.path.ride_index != 0xFF)
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->properties.path.ride_index != 0xFF)
return PATH_SEARCH_RIDE_QUEUE;
return PATH_SEARCH_OTHER;
@@ -750,7 +750,7 @@ static void peep_pathfind_heuristic_search(
}
else
{ // numEdges == 2
if (footpath_element_is_queue(tileElement)
if (tileElement->AsPath()->IsQueue()
&& tileElement->properties.path.ride_index != gPeepPathFindQueueRideIndex)
{
if (gPeepPathFindIgnoreForeignQueues && (tileElement->properties.path.ride_index != 0xFF))
@@ -1814,7 +1814,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (found == false)
break;
if (!footpath_element_is_queue(tileElement))
if (!tileElement->AsPath()->IsQueue())
break;
if (!(tileElement->properties.path.edges & (1 << (direction ^ (1 << 1)))))
@@ -1848,7 +1848,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (tileElement == nullptr)
return;
if (!footpath_element_is_queue(tileElement))
if (!tileElement->AsPath()->IsQueue())
return;
loc.x = queueEnd.x;
+2 -2
View File
@@ -2631,7 +2631,7 @@ static void peep_interact_with_entrance(
if (nextTileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue;
if (footpath_element_is_queue(nextTileElement))
if (nextTileElement->AsPath()->IsQueue())
continue;
if (footpath_element_is_sloped(nextTileElement))
@@ -2902,7 +2902,7 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, rct_ti
}
}
if (peep->type == PEEP_TYPE_GUEST && footpath_element_is_queue(tile_element))
if (peep->type == PEEP_TYPE_GUEST && tile_element->AsPath()->IsQueue())
{
uint8_t rideIndex = tile_element->properties.path.ride_index;
+11 -19
View File
@@ -60,8 +60,6 @@
using namespace OpenRCT2;
static uint8_t GetPathType(rct_tile_element* tileElement);
class EntryList
{
private:
@@ -480,7 +478,7 @@ private:
{
case TILE_ELEMENT_TYPE_PATH:
{
uint8_t pathType = GetPathType(tileElement);
uint8_t pathType = tileElement->AsPath()->GetRCT1PathType();
uint8_t pathAdditionsType = tileElement->properties.path.additions & 0x0F;
AddEntryForPath(pathType);
@@ -2404,11 +2402,8 @@ private:
// Fill the rest of the row with blank tiles
for (int32_t y = 0; y < RCT1_MAX_MAP_SIZE; y++)
{
memset(nextFreeTileElement, 0, sizeof(rct_tile_element));
nextFreeTileElement->SetType(TILE_ELEMENT_TYPE_SURFACE);
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
nextFreeTileElement->flags = TILE_ELEMENT_FLAG_LAST_TILE;
nextFreeTileElement->base_height = 2;
nextFreeTileElement->clearance_height = 2;
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
@@ -2421,11 +2416,8 @@ private:
// 128 extra rows left to fill with blank tiles
for (int32_t y = 0; y < 128 * 256; y++)
{
memset(nextFreeTileElement, 0, sizeof(rct_tile_element));
nextFreeTileElement->SetType(TILE_ELEMENT_TYPE_SURFACE);
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
nextFreeTileElement->flags = TILE_ELEMENT_FLAG_LAST_TILE;
nextFreeTileElement->base_height = 2;
nextFreeTileElement->clearance_height = 2;
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
@@ -2507,16 +2499,16 @@ private:
case TILE_ELEMENT_TYPE_PATH:
{
// Type
uint8_t pathType = GetPathType(tileElement);
uint8_t pathType = tileElement->AsPath()->GetRCT1PathType();
uint8_t entryIndex = _pathTypeToEntryMap[pathType];
tileElement->type &= ~TILE_ELEMENT_DIRECTION_MASK;
tileElement->SetDirection(0);
tileElement->flags &= ~(TILE_ELEMENT_FLAG_BROKEN | TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE);
footpath_element_set_type(tileElement, entryIndex);
if (RCT1::PathIsQueue(pathType))
{
footpath_element_set_queue(tileElement);
tileElement->AsPath()->SetIsQueue(true);
}
footpath_scenery_set_is_ghost(tileElement, false);
@@ -2886,13 +2878,13 @@ void load_from_sc4(const utf8* path)
s4Importer->Import();
}
static uint8_t GetPathType(rct_tile_element* tileElement)
uint8_t PathElement::GetRCT1PathType() const
{
uint8_t pathColour = tileElement->type & 3;
uint8_t pathType = (tileElement->properties.path.type & FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
uint8_t pathColour = type & 3;
uint8_t pathType2 = (pathType & FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
pathType = pathType | pathColour;
return pathType;
pathType2 = pathType2 | pathColour;
return pathType2;
}
int32_t WallElement::GetRCT1WallType(int32_t edge) const
+2 -2
View File
@@ -1389,11 +1389,11 @@ int32_t sub_6C683D(
}
if (flags & (1 << 0))
{
tileElement->type &= ~TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT;
tileElement->AsTrack()->SetHighlight(false);
}
if (flags & (1 << 1))
{
tileElement->type |= TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT;
tileElement->AsTrack()->SetHighlight(true);
}
if (flags & (1 << 2))
{
+17 -7
View File
@@ -1448,14 +1448,12 @@ static money32 track_place(
tileElement = tile_element_insert(x / 32, y / 32, baseZ, bl & 0xF);
assert(tileElement != nullptr);
tileElement->clearance_height = clearanceZ;
uint8_t map_type = direction;
map_type |= TILE_ELEMENT_TYPE_TRACK;
tileElement->SetType(TILE_ELEMENT_TYPE_TRACK);
tileElement->SetDirection(direction);
if (liftHillAndAlternativeState & CONSTRUCTION_LIFT_HILL_SELECTED)
{
map_type |= (1 << 7);
tileElement->AsTrack()->SetHasChain(true);
}
tileElement->type = map_type;
tileElement->AsTrack()->SetSequenceIndex(trackBlock->index);
tileElement->AsTrack()->SetRideIndex(rideIndex);
@@ -1518,7 +1516,7 @@ static money32 track_place(
if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER)
{
rct_tile_element* surfaceElement = map_get_surface_element_at({ x, y });
surfaceElement->type |= (1 << 6);
surfaceElement->AsSurface()->SetHasTrackThatNeedsWater(true);
tileElement = surfaceElement;
}
@@ -1786,7 +1784,7 @@ static money32 track_remove(
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER))
{
surfaceElement->type &= ~(1 << 6);
surfaceElement->AsSurface()->SetHasTrackThatNeedsWater(false);
}
invalidate_test_results(rideIndex);
@@ -2357,3 +2355,15 @@ void TrackElement::SetHasGreenLight(uint8_t greenLight)
sequence |= MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT;
}
}
bool TrackElement::IsHighlighted() const
{
return (type & TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT);
}
void TrackElement::SetHighlight(bool on)
{
type &= ~TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT;
if (on)
type |= TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT;
}
+47 -40
View File
@@ -816,8 +816,6 @@ static int32_t track_design_place_scenery(
uint8_t quadrant = (scenery->flags >> 2) + _currentTrackPieceDirection;
quadrant &= 3;
uint8_t bh = rotation | (quadrant << 6) | TILE_ELEMENT_TYPE_SMALL_SCENERY;
rct_scenery_entry* small_scenery = get_small_scenery_entry(entry_index);
if (!(!scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_FULL_TILE)
&& scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_DIAGONAL))
@@ -826,12 +824,13 @@ static int32_t track_design_place_scenery(
SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE
| SMALL_SCENERY_FLAG_THREE_QUARTERS))
{
bh &= 0x3F;
quadrant = 0;
}
z = (scenery->z * 8 + originZ) / 8;
game_do_command(
mapCoord.x, flags | bh << 8, mapCoord.y, (entry_index << 8) | z, GAME_COMMAND_REMOVE_SCENERY, 0, 0);
mapCoord.x, flags | quadrant << 8, mapCoord.y, (entry_index << 8) | z, GAME_COMMAND_REMOVE_SCENERY,
0, 0);
break;
}
case OBJECT_TYPE_LARGE_SCENERY:
@@ -913,7 +912,7 @@ static int32_t track_design_place_scenery(
money32 cost;
int16_t z;
uint8_t bl;
uint8_t flags;
uint8_t quadrant;
switch (entry_type)
@@ -933,24 +932,26 @@ static int32_t track_design_place_scenery(
z = scenery->z * 8 + originZ;
quadrant = ((scenery->flags >> 2) + _currentTrackPieceDirection) & 3;
bl = 0x81;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY;
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
{
bl = 0xA9;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY
| GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_4)
else if (_trackDesignPlaceOperation == PTD_OPERATION_4)
{
bl = 0xE9;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY
| GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_1)
else if (_trackDesignPlaceOperation == PTD_OPERATION_1)
{
bl = 0x80;
flags = GAME_COMMAND_FLAG_PATH_SCENERY;
}
gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE;
cost = game_do_command(
mapCoord.x, bl | (entry_index << 8), mapCoord.y, quadrant | (scenery->primary_colour << 8),
mapCoord.x, flags | (entry_index << 8), mapCoord.y, quadrant | (scenery->primary_colour << 8),
GAME_COMMAND_PLACE_SCENERY, rotation | (scenery->secondary_colour << 16), z);
if (cost == MONEY32_UNDEFINED)
@@ -973,22 +974,24 @@ static int32_t track_design_place_scenery(
z = scenery->z * 8 + originZ;
bl = 0x81;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY;
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
{
bl = 0xA9;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY
| GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_4)
else if (_trackDesignPlaceOperation == PTD_OPERATION_4)
{
bl = 0xE9;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY
| GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_1)
else if (_trackDesignPlaceOperation == PTD_OPERATION_1)
{
bl = 0x80;
flags = GAME_COMMAND_FLAG_PATH_SCENERY;
}
cost = game_do_command(
mapCoord.x, bl | (rotation << 8), mapCoord.y,
mapCoord.x, flags | (rotation << 8), mapCoord.y,
scenery->primary_colour | (scenery->secondary_colour << 8), GAME_COMMAND_PLACE_LARGE_SCENERY,
entry_index, z);
@@ -1011,24 +1014,26 @@ static int32_t track_design_place_scenery(
rotation += scenery->flags;
rotation &= 3;
bl = 1;
flags = GAME_COMMAND_FLAG_APPLY;
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
{
bl = 0xA9;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY
| GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_4)
else if (_trackDesignPlaceOperation == PTD_OPERATION_4)
{
bl = 105;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
| GAME_COMMAND_FLAG_GHOST;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_1)
else if (_trackDesignPlaceOperation == PTD_OPERATION_1)
{
bl = 0;
flags = 0;
}
gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
cost = game_do_command(
mapCoord.x, bl | (entry_index << 8), mapCoord.y, rotation | (scenery->primary_colour << 8),
mapCoord.x, flags | (entry_index << 8), mapCoord.y, rotation | (scenery->primary_colour << 8),
GAME_COMMAND_PLACE_WALL, z, scenery->secondary_colour | ((scenery->flags & 0xFC) << 6));
if (cost == MONEY32_UNDEFINED)
@@ -1052,30 +1057,31 @@ static int32_t track_design_place_scenery(
}
uint8_t bh = ((scenery->flags & 0xF) << rotation);
bl = bh >> 4;
bh = (bh | bl) & 0xF;
bl = (((scenery->flags >> 5) + rotation) & 3) << 5;
bh |= bl;
flags = bh >> 4;
bh = (bh | flags) & 0xF;
flags = (((scenery->flags >> 5) + rotation) & 3) << 5;
bh |= flags;
bh |= scenery->flags & 0x90;
bl = 1;
flags = GAME_COMMAND_FLAG_APPLY;
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
{
bl = 41;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_4)
{
bl = 105;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
| GAME_COMMAND_FLAG_GHOST;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_1)
{
bl = 0;
flags = 0;
}
gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
cost = game_do_command(
mapCoord.x, bl | (bh << 8), mapCoord.y, z | (entry_index << 8),
mapCoord.x, flags | (bh << 8), mapCoord.y, z | (entry_index << 8),
GAME_COMMAND_PLACE_PATH_FROM_TRACK, 0, 0);
}
else
@@ -1095,17 +1101,18 @@ static int32_t track_design_place_scenery(
footpath_queue_chain_reset();
footpath_remove_edges_at(mapCoord.x, mapCoord.y, tile_element);
bl = 1;
flags = GAME_COMMAND_FLAG_APPLY;
if (_trackDesignPlaceOperation == PTD_OPERATION_GET_COST)
{
bl = 41;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
}
if (_trackDesignPlaceOperation == PTD_OPERATION_4)
{
bl = 105;
flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
| GAME_COMMAND_FLAG_GHOST;
}
footpath_connect_edges(mapCoord.x, mapCoord.y, tile_element, bl);
footpath_connect_edges(mapCoord.x, mapCoord.y, tile_element, flags);
footpath_update_queue_chains();
continue;
}
@@ -2105,7 +2112,7 @@ static money32 place_maze_design(uint8_t flags, uint8_t rideIndex, uint16_t maze
int32_t fz = z >> 3;
rct_tile_element* tileElement = tile_element_insert(fx >> 5, fy >> 5, fz, 15);
tileElement->clearance_height = fz + 4;
tileElement->type = TILE_ELEMENT_TYPE_TRACK;
tileElement->SetType(TILE_ELEMENT_TYPE_TRACK);
tileElement->AsTrack()->SetTrackType(TRACK_ELEM_MAZE);
tileElement->AsTrack()->SetRideIndex(rideIndex);
tileElement->AsTrack()->SetMazeEntry(mazeEntry);
+22 -20
View File
@@ -296,8 +296,8 @@ static void track_design_save_add_scenery(int32_t x, int32_t y, rct_tile_element
auto entry = object_entry_get_entry(OBJECT_TYPE_SMALL_SCENERY, entryType);
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= (tileElement->type & 0xC0) >> 4;
flags |= tileElement->GetDirection();
flags |= tileElement->AsSmallScenery()->GetSceneryQuadrant() << 2;
uint8_t primaryColour = sceneryElement->GetPrimaryColour();
uint8_t secondaryColour = sceneryElement->GetSecondaryColour();
@@ -317,7 +317,7 @@ static void track_design_save_add_large_scenery(int32_t x, int32_t y, rct_tile_e
sceneryTiles = get_large_scenery_entry(entryType)->large_scenery.tiles;
z = tileElement->base_height;
direction = tileElement->type & 3;
direction = tileElement->GetDirection();
sequence = tileElement->AsLargeScenery()->GetSequenceIndex();
if (!map_large_scenery_get_origin(x, y, z, direction, sequence, &x0, &y0, &z0, nullptr))
@@ -341,7 +341,7 @@ static void track_design_save_add_large_scenery(int32_t x, int32_t y, rct_tile_e
{
if (sequence == 0)
{
uint8_t flags = tileElement->type & 3;
uint8_t flags = tileElement->GetDirection();
uint8_t primaryColour = tileElement->AsLargeScenery()->GetPrimaryColour();
uint8_t secondaryColour = tileElement->AsLargeScenery()->GetSecondaryColour();
@@ -358,7 +358,7 @@ static void track_design_save_add_wall(int32_t x, int32_t y, rct_tile_element* t
auto entry = object_entry_get_entry(OBJECT_TYPE_WALLS, entryType);
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= tileElement->GetDirection();
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
uint8_t secondaryColour = tileElement->AsWall()->GetSecondaryColour();
@@ -377,7 +377,8 @@ static void track_design_save_add_footpath(int32_t x, int32_t y, rct_tile_elemen
flags |= tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) << 2;
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK) << 5;
flags |= (tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) << 7;
if (tileElement->AsPath()->IsQueue())
flags |= 1 << 7;
track_design_save_push_tile_element(x, y, tileElement);
track_design_save_push_tile_element_desc(entry, x, y, tileElement->base_height, flags, 0, 0);
@@ -490,8 +491,8 @@ static void track_design_save_remove_scenery(int32_t x, int32_t y, rct_tile_elem
auto entry = object_entry_get_entry(OBJECT_TYPE_SMALL_SCENERY, entryType);
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= (tileElement->type & 0xC0) >> 4;
flags |= tileElement->GetDirection();
flags |= tileElement->AsSmallScenery()->GetSceneryQuadrant() << 2;
track_design_save_pop_tile_element(x, y, tileElement);
track_design_save_pop_tile_element_desc(entry, x, y, tileElement->base_height, flags);
@@ -508,7 +509,7 @@ static void track_design_save_remove_large_scenery(int32_t x, int32_t y, rct_til
sceneryTiles = get_large_scenery_entry(entryType)->large_scenery.tiles;
z = tileElement->base_height;
direction = tileElement->type & 3;
direction = tileElement->GetDirection();
sequence = tileElement->AsLargeScenery()->GetSequenceIndex();
if (!map_large_scenery_get_origin(x, y, z, direction, sequence, &x0, &y0, &z0, nullptr))
@@ -532,7 +533,7 @@ static void track_design_save_remove_large_scenery(int32_t x, int32_t y, rct_til
{
if (sequence == 0)
{
uint8_t flags = tileElement->type & 3;
uint8_t flags = tileElement->GetDirection();
track_design_save_pop_tile_element_desc(entry, x, y, z, flags);
}
track_design_save_pop_tile_element(x, y, tileElement);
@@ -546,7 +547,7 @@ static void track_design_save_remove_wall(int32_t x, int32_t y, rct_tile_element
auto entry = object_entry_get_entry(OBJECT_TYPE_WALLS, entryType);
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= tileElement->GetDirection();
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
track_design_save_pop_tile_element(x, y, tileElement);
@@ -562,7 +563,8 @@ static void track_design_save_remove_footpath(int32_t x, int32_t y, rct_tile_ele
flags |= tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) << 2;
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK) << 5;
flags |= (tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) << 7;
if (tileElement->AsPath()->IsQueue())
flags |= (1 << 7);
track_design_save_pop_tile_element(x, y, tileElement);
track_design_save_pop_tile_element_desc(entry, x, y, tileElement->base_height, flags);
@@ -596,8 +598,7 @@ static bool track_design_save_should_select_scenery_around(int32_t rideIndex, rc
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_PATH:
if ((tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE)
&& tileElement->properties.path.addition_status == rideIndex)
if (tileElement->AsPath()->IsQueue() && tileElement->properties.path.ride_index == rideIndex)
return true;
break;
case TILE_ELEMENT_TYPE_TRACK:
@@ -632,9 +633,9 @@ static void track_design_save_select_nearby_scenery_for_tile(int32_t rideIndex,
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_PATH:
if (!(tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE))
if (!tileElement->AsPath()->IsQueue())
interactionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
else if (tileElement->properties.path.addition_status == rideIndex)
else if (tileElement->properties.path.ride_index == rideIndex)
interactionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
break;
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
@@ -1046,17 +1047,18 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8_t rideIndex, rct_tra
track->type = TRACK_ELEM_255_ALIAS;
}
uint8_t bh;
uint8_t flags;
if (track_element_has_speed_setting(track->type))
{
bh = trackElement.element->AsTrack()->GetBrakeBoosterSpeed() >> 1;
flags = trackElement.element->AsTrack()->GetBrakeBoosterSpeed() >> 1;
}
else
{
bh = trackElement.element->AsTrack()->GetSeatRotation();
flags = trackElement.element->AsTrack()->GetSeatRotation();
}
uint8_t flags = (trackElement.element->type & (1 << 7)) | bh;
if (trackElement.element->AsTrack()->HasChain())
flags |= (1 << 7);
flags |= trackElement.element->AsTrack()->GetColourScheme() << 4;
if (RideData4[ride->type].flags & RIDE_TYPE_FLAG4_HAS_ALTERNATIVE_TRACK_TYPE
&& trackElement.element->AsTrack()->IsInverted())
+1 -1
View File
@@ -2185,7 +2185,7 @@ void track_paint(paint_session* session, uint8_t direction, int32_t height, cons
session->TrackColours[SCHEME_SUPPORTS] = SPRITE_ID_PALETTE_COLOUR_1(ride->track_colour_supports[trackColourScheme]);
session->TrackColours[SCHEME_MISC] = IMAGE_TYPE_REMAP;
session->TrackColours[SCHEME_3] = 0x20C00000;
if (tileElement->type & TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT)
if (tileElement->AsTrack()->IsHighlighted())
{
session->TrackColours[SCHEME_TRACK] = 0x21600000;
session->TrackColours[SCHEME_SUPPORTS] = 0x21600000;
+27 -31
View File
@@ -270,7 +270,7 @@ static money32 footpath_element_insert(
footpath_element_set_type(tileElement, type);
tileElement->properties.path.type |= (slope & TILE_ELEMENT_SLOPE_W_CORNER_DN);
if (type & FOOTPATH_ELEMENT_INSERT_QUEUE)
footpath_element_set_queue(tileElement);
tileElement->AsPath()->SetIsQueue(true);
tileElement->properties.path.additions = pathItemType;
tileElement->properties.path.addition_status = 255;
tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
@@ -302,7 +302,7 @@ static money32 footpath_element_update(
const int32_t newFootpathType = (type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
const bool newPathIsQueue = ((type >> 7) == 1);
if (footpath_element_get_type(tileElement) != newFootpathType || footpath_element_is_queue(tileElement) != newPathIsQueue)
if (footpath_element_get_type(tileElement) != newFootpathType || tileElement->AsPath()->IsQueue() != newPathIsQueue)
{
gFootpathPrice += MONEY(6, 00);
}
@@ -328,7 +328,7 @@ static money32 footpath_element_update(
return MONEY32_UNDEFINED;
}
if ((unk6 & PATH_BIT_FLAG_DONT_ALLOW_ON_QUEUE) && footpath_element_is_queue(tileElement))
if ((unk6 & PATH_BIT_FLAG_DONT_ALLOW_ON_QUEUE) && tileElement->AsPath()->IsQueue())
{
gGameCommandErrorText = STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA;
return MONEY32_UNDEFINED;
@@ -341,7 +341,7 @@ static money32 footpath_element_update(
return MONEY32_UNDEFINED;
}
if ((unk6 & PATH_BIT_FLAG_IS_QUEUE_SCREEN) && !footpath_element_is_queue(tileElement))
if ((unk6 & PATH_BIT_FLAG_IS_QUEUE_SCREEN) && !tileElement->AsPath()->IsQueue())
{
gGameCommandErrorText = STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA;
return MONEY32_UNDEFINED;
@@ -1056,7 +1056,7 @@ static rct_tile_element* footpath_connect_corners_get_neighbour(int32_t x, int32
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue;
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
continue;
if (tileElement->base_height != z)
continue;
@@ -1081,7 +1081,7 @@ static void footpath_connect_corners(int32_t initialX, int32_t initialY, rct_til
{
rct_tile_element* tileElement[4];
if (footpath_element_is_queue(initialTileElement))
if (initialTileElement->AsPath()->IsQueue())
return;
if (footpath_element_is_sloped(initialTileElement))
return;
@@ -1264,7 +1264,7 @@ static bool sub_footpath_disconnect_queue_from_path(
int32_t y1 = y + CoordsDirectionDelta[direction].y;
int32_t z = tileElement->base_height;
rct_tile_element* otherTileElement = footpath_get_element(x1, y1, z - 2, z, direction);
if (otherTileElement != nullptr && !footpath_element_is_queue(otherTileElement))
if (otherTileElement != nullptr && !otherTileElement->AsPath()->IsQueue())
{
tileElement->properties.path.type &= ~FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
if (action > 0)
@@ -1288,7 +1288,7 @@ static bool sub_footpath_disconnect_queue_from_path(
static bool footpath_disconnect_queue_from_path(int32_t x, int32_t y, rct_tile_element* tileElement, int32_t action)
{
if (!footpath_element_is_queue(tileElement))
if (!tileElement->AsPath()->IsQueue())
return false;
if (footpath_element_is_sloped(tileElement))
@@ -1423,7 +1423,7 @@ static void loc_6A6D7E(
{
return;
}
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
if (connected_path_count[tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK] < 2)
{
@@ -1433,8 +1433,7 @@ static void loc_6A6D7E(
}
else
{
if ((initialTileElement)->GetType() == TILE_ELEMENT_TYPE_PATH
&& footpath_element_is_queue(initialTileElement))
if ((initialTileElement)->GetType() == TILE_ELEMENT_TYPE_PATH && initialTileElement->AsPath()->IsQueue())
{
if (footpath_disconnect_queue_from_path(x, y, tileElement, 0))
{
@@ -1454,7 +1453,7 @@ static void loc_6A6D7E(
{
footpath_disconnect_queue_from_path(x, y, tileElement, 1 + ((flags >> 6) & 1));
tileElement->properties.path.edges |= (1 << (direction ^ 2));
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
footpath_queue_chain_push(tileElement->properties.path.ride_index);
}
@@ -1552,7 +1551,7 @@ void footpath_connect_edges(int32_t x, int32_t y, rct_tile_element* tileElement,
neighbour_list_sort(&neighbourList);
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && footpath_element_is_queue(tileElement))
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && tileElement->AsPath()->IsQueue())
{
int32_t rideIndex = -1;
uint8_t entranceIndex = 255;
@@ -1655,7 +1654,7 @@ void footpath_chain_ride_queue(
break;
foundNextPath:
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
// Fix #2051: Stop queue paths that are already connected to two other tiles
// from connecting to the tile we are coming from.
@@ -1699,7 +1698,7 @@ void footpath_chain_ride_queue(
if (rideIndex != 255 && lastPathElement != nullptr)
{
if (footpath_element_is_queue(lastPathElement))
if (lastPathElement->AsPath()->IsQueue())
{
lastPathElement->properties.path.type |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
lastPathElement->type &= 0x3F; // Clear the ride sign direction
@@ -1859,7 +1858,7 @@ static int32_t footpath_is_connected_to_map_edge_recurse(
if (!(flags & (1 << 0)))
{
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
continue;
}
@@ -1976,19 +1975,16 @@ uint8_t footpath_element_get_slope_direction(const rct_tile_element* tileElement
return tileElement->properties.path.type & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
}
bool footpath_element_is_queue(const rct_tile_element* tileElement)
bool PathElement::IsQueue() const
{
return (tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) != 0;
return (type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) != 0;
}
void footpath_element_set_queue(rct_tile_element* tileElement)
void PathElement::SetIsQueue(bool isQueue)
{
tileElement->type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
}
void footpath_element_clear_queue(rct_tile_element* tileElement)
{
tileElement->type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
if (isQueue)
type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
}
bool footpath_element_has_queue_banner(const rct_tile_element* tileElement)
@@ -2097,7 +2093,7 @@ static rct_tile_element* footpath_can_be_wide(int32_t x, int32_t y, uint8_t heig
continue;
if (height != tileElement->base_height)
continue;
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
continue;
if (footpath_element_is_sloped(tileElement))
continue;
@@ -2147,7 +2143,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue;
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
continue;
if (footpath_element_is_sloped(tileElement))
@@ -2324,7 +2320,7 @@ void footpath_update_queue_entrance_banner(int32_t x, int32_t y, rct_tile_elemen
switch (elementType)
{
case TILE_ELEMENT_TYPE_PATH:
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
footpath_queue_chain_push(tileElement->properties.path.ride_index);
for (int32_t direction = 0; direction < 4; direction++)
@@ -2356,7 +2352,7 @@ static void footpath_remove_edges_towards_here(
{
int32_t d;
if (footpath_element_is_queue(tileElement))
if (tileElement->AsPath()->IsQueue())
{
footpath_queue_chain_push(tileElement->properties.path.ride_index);
}
@@ -2588,10 +2584,10 @@ void footpath_remove_edges_at(int32_t x, int32_t y, rct_tile_element* tileElemen
// to.
if (!tile_element_wants_path_connection_towards({ x / 32, y / 32, z1, direction }, tileElement))
{
bool isQueue = tileElement->GetType() == TILE_ELEMENT_TYPE_PATH ? tileElement->AsPath()->IsQueue() : false;
int32_t z0 = z1 - 2;
footpath_remove_edges_towards(
x + CoordsDirectionDelta[direction].x, y + CoordsDirectionDelta[direction].y, z0, z1, direction,
footpath_element_is_queue(tileElement));
x + CoordsDirectionDelta[direction].x, y + CoordsDirectionDelta[direction].y, z0, z1, direction, isQueue);
}
else
{
-3
View File
@@ -157,9 +157,6 @@ int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32
bool footpath_element_is_sloped(const rct_tile_element* tileElement);
void footpath_element_set_sloped(rct_tile_element* tileElement, bool isSloped);
uint8_t footpath_element_get_slope_direction(const rct_tile_element* tileElement);
bool footpath_element_is_queue(const rct_tile_element* tileElement);
void footpath_element_set_queue(rct_tile_element* tileElement);
void footpath_element_clear_queue(rct_tile_element* tileElement);
bool footpath_element_has_queue_banner(const rct_tile_element* tileElement);
bool footpath_element_is_wide(const rct_tile_element* tileElement);
uint8_t footpath_element_get_type(const rct_tile_element* tileElement);
+8 -8
View File
@@ -342,8 +342,7 @@ void map_init(int32_t size)
for (int32_t i = 0; i < MAX_TILE_TILE_ELEMENT_POINTERS; i++)
{
rct_tile_element* tile_element = &gTileElements[i];
memset(tile_element, 0, sizeof(rct_tile_element));
tile_element->type = (TILE_ELEMENT_TYPE_SURFACE << 2);
tile_element->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
tile_element->flags = TILE_ELEMENT_FLAG_LAST_TILE;
tile_element->base_height = 14;
tile_element->clearance_height = 14;
@@ -1095,7 +1094,7 @@ restart_from_beginning:
if (clear & (1 << 0))
{
int32_t eax = x * 32;
int32_t ebx = (tileElement->type << 8) | flags;
int32_t ebx = (tileElement->AsSmallScenery()->GetSceneryQuadrant() << 8) | flags;
int32_t ecx = y * 32;
int32_t edx = (tileElement->AsSmallScenery()->GetEntryIndex() << 8) | (tileElement->base_height);
int32_t edi = 0, ebp = 0;
@@ -1628,7 +1627,7 @@ static money32 map_set_land_height(int32_t flags, int32_t x, int32_t y, int32_t
uint8_t zCorner = height; // z position of highest corner of tile
rct_tile_element* surfaceElement = map_get_surface_element_at({ x, y });
if (surfaceElement->type & TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT)
if (surfaceElement->AsSurface()->HasTrackThatNeedsWater())
{
uint32_t waterHeight = surfaceElement->AsSurface()->GetWaterHeight();
if (waterHeight != 0)
@@ -3059,7 +3058,8 @@ void game_command_place_large_scenery(
map_animation_create(MAP_ANIMATION_TYPE_LARGE_SCENERY, curTile.x, curTile.y, zLow);
new_tile_element->clearance_height = zHigh;
new_tile_element->type = TILE_ELEMENT_TYPE_LARGE_SCENERY | rotation;
new_tile_element->SetType(TILE_ELEMENT_TYPE_LARGE_SCENERY);
new_tile_element->SetDirection(rotation);
auto newSceneryElement = new_tile_element->AsLargeScenery();
newSceneryElement->SetEntryIndex(entry_index);
@@ -3137,7 +3137,7 @@ void map_remove_all_rides()
switch (it.element->GetType())
{
case TILE_ELEMENT_TYPE_PATH:
if (footpath_element_is_queue(it.element))
if (it.element->AsPath()->IsQueue())
{
it.element->properties.path.type &= ~8;
it.element->properties.path.addition_status = 255;
@@ -3586,7 +3586,7 @@ bool map_can_construct_with_clear_at(
// Crossing mode 1: building track over path
if (crossingMode == 1 && canBuildCrossing && tileElement->GetType() == TILE_ELEMENT_TYPE_PATH
&& tileElement->base_height == zLow && !footpath_element_is_queue(tileElement)
&& tileElement->base_height == zLow && !tileElement->AsPath()->IsQueue()
&& !footpath_element_is_sloped(tileElement))
{
continue;
@@ -4043,7 +4043,7 @@ rct_tile_element* map_get_small_scenery_element_at(int32_t x, int32_t y, int32_t
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
continue;
if (tileElement->type >> 6 != quadrant)
if (tileElement->AsSmallScenery()->GetSceneryQuadrant() != quadrant)
continue;
if (tileElement->base_height != z)
continue;
+2 -2
View File
@@ -245,8 +245,8 @@ static void mapgen_place_tree(int32_t type, int32_t x, int32_t y)
tileElement = tile_element_insert(x, y, surfaceZ, (1 | 2 | 4 | 8));
assert(tileElement != nullptr);
tileElement->clearance_height = surfaceZ + (sceneryEntry->small_scenery.height >> 3);
tileElement->type = TILE_ELEMENT_TYPE_SMALL_SCENERY | (util_rand() & 3);
tileElement->SetType(TILE_ELEMENT_TYPE_SMALL_SCENERY);
tileElement->SetDirection(util_rand() & 3);
SmallSceneryElement* sceneryElement = tileElement->AsSmallScenery();
sceneryElement->SetEntryIndex(type);
sceneryElement->SetAge(0);
+4 -2
View File
@@ -38,7 +38,7 @@ colour_t gWindowSceneryTertiaryColour;
bool gWindowSceneryEyedropperEnabled;
rct_tile_element* gSceneryTileElement;
uint8_t gSceneryTileElementType;
uint8_t gSceneryQuadrant;
money32 gSceneryPlaceCost;
int16_t gSceneryPlaceObject;
@@ -184,8 +184,10 @@ void scenery_remove_ghost_tool_placement()
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_0)
{
gSceneryGhostType &= ~SCENERY_ENTRY_FLAG_0;
uint8_t flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
| GAME_COMMAND_FLAG_GHOST;
game_do_command(
x, 105 | (gSceneryTileElementType << 8), y, z | (gSceneryPlaceObject << 8), GAME_COMMAND_REMOVE_SCENERY, 0, 0);
x, flags | (gSceneryQuadrant << 8), y, z | (gSceneryPlaceObject << 8), GAME_COMMAND_REMOVE_SCENERY, 0, 0);
}
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_1)
+1 -1
View File
@@ -266,7 +266,7 @@ extern colour_t gWindowSceneryTertiaryColour;
extern bool gWindowSceneryEyedropperEnabled;
extern rct_tile_element* gSceneryTileElement;
extern uint8_t gSceneryTileElementType;
extern uint8_t gSceneryQuadrant;
extern money32 gSceneryPlaceCost;
extern int16_t gSceneryPlaceObject;
+1 -2
View File
@@ -419,8 +419,7 @@ void game_command_remove_scenery(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi, [[maybe_unused]] int32_t* edi,
[[maybe_unused]] int32_t* ebp)
{
*ebx = SmallSceneryRemove(
*eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, ((*ebx >> 8) & 0xFF) >> 6, (*edx >> 8) & 0xFF, *ebx & 0xFF);
*ebx = SmallSceneryRemove(*eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, ((*ebx >> 8) & 0xFF), (*edx >> 8) & 0xFF, *ebx & 0xFF);
}
/**
+12
View File
@@ -215,3 +215,15 @@ void SurfaceElement::SetSlope(uint8_t newSlope)
slope &= ~TILE_ELEMENT_SURFACE_SLOPE_MASK;
slope |= (newSlope & TILE_ELEMENT_SURFACE_SLOPE_MASK);
}
bool SurfaceElement::HasTrackThatNeedsWater() const
{
return (type & SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER) != 0;
}
void SurfaceElement::SetHasTrackThatNeedsWater(bool on)
{
type &= ~SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
if (on)
type |= SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
}
+22 -2
View File
@@ -178,12 +178,28 @@ public:
uint8_t GetParkFences() const;
void SetParkFences(uint8_t newParkFences);
bool HasTrackThatNeedsWater() const;
void SetHasTrackThatNeedsWater(bool on);
};
assert_struct_size(SurfaceElement, 8);
struct PathElement : TileElementBase
{
rct_tile_element_path_properties temp;
uint8_t pathType; // 4 0xF0 Path type, 0x08 Ride sign, 0x04 Set when path is diagonal, 0x03 Rotation
uint8_t additions; // 5
uint8_t edges; // 6
union
{
uint8_t additionStatus; // 7
uint8_t rideIndex;
};
public:
bool IsQueue() const;
void SetIsQueue(bool isQueue);
uint8_t GetRCT1PathType() const;
};
assert_struct_size(PathElement, 8);
@@ -255,6 +271,9 @@ public:
void SetPhotoTimeout();
void DecrementPhotoTimeout();
bool IsHighlighted() const;
void SetHighlight(bool on);
// Used in RCT1, will be reintroduced at some point.
// (See https://github.com/OpenRCT2/OpenRCT2/issues/7059)
uint8_t GetDoorAState() const;
@@ -419,7 +438,8 @@ enum
enum
{
TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT = (1 << 6)
TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT = (1 << 6),
SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER = (1 << 6),
};
enum
+1 -1
View File
@@ -967,7 +967,7 @@ int32_t tile_inspector_track_set_chain(
if (tileElement->AsTrack()->HasChain() != setChain)
{
tileElement->type ^= TRACK_ELEMENT_TYPE_FLAG_CHAIN_LIFT;
tileElement->AsTrack()->SetHasChain(setChain);
}
}
}
+5
View File
@@ -409,3 +409,8 @@ uint32_t SurfaceElement::GetWaterHeight() const
{
return terrain & TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK;
}
bool TrackElement::IsHighlighted() const
{
return (type & TILE_ELEMENT_TYPE_FLAG_HIGHLIGHT);
}