forked from rosebudai/OpenRCT2-Web
Merge pull request #10866 from Gymnasiast/refactor/more-tile-element-prep
Refactor/more tile element prep
This commit is contained in:
31 files changed
+380
-219
No files matched your search
@@ -1832,7 +1832,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
// Details
|
||||
// Path name
|
||||
rct_string_id pathNameId = tileElement->AsPath()->GetPathEntry()->string_idx;
|
||||
rct_string_id pathNameId = tileElement->AsPath()->GetSurfaceEntry()->string_idx;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_NAME, &pathNameId, COLOUR_WHITE, x, y);
|
||||
|
||||
// Path addition
|
||||
|
||||
@@ -1527,7 +1527,7 @@ static void sub_6E1F34(
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
*parameter_1 |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED << 8;
|
||||
*parameter_2 = tile_element->base_height;
|
||||
*parameter_2 |= (tile_element->AsPath()->GetPathEntryIndex() << 8);
|
||||
*parameter_2 |= (tile_element->AsPath()->GetSurfaceEntryIndex() << 8);
|
||||
if (tile_element->AsPath()->IsQueue())
|
||||
{
|
||||
*parameter_2 |= LOCATION_NULL;
|
||||
|
||||
@@ -133,7 +133,7 @@ void setup_in_use_selection_flags()
|
||||
case TILE_ELEMENT_TYPE_TRACK:
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
type = iter.element->AsPath()->GetPathEntryIndex();
|
||||
type = iter.element->AsPath()->GetSurfaceEntryIndex();
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_PATHS, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
{
|
||||
const int32_t newFootpathType = (_type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
|
||||
const bool newPathIsQueue = ((_type >> 7) == 1);
|
||||
if (pathElement->GetPathEntryIndex() != newFootpathType || pathElement->IsQueue() != newPathIsQueue)
|
||||
if (pathElement->GetSurfaceEntryIndex() != newFootpathType || pathElement->IsQueue() != newPathIsQueue)
|
||||
{
|
||||
res->Cost += MONEY(6, 00);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
{
|
||||
const int32_t newFootpathType = (_type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
|
||||
const bool newPathIsQueue = ((_type >> 7) == 1);
|
||||
if (pathElement->GetPathEntryIndex() != newFootpathType || pathElement->IsQueue() != newPathIsQueue)
|
||||
if (pathElement->GetSurfaceEntryIndex() != newFootpathType || pathElement->IsQueue() != newPathIsQueue)
|
||||
{
|
||||
res->Cost += MONEY(6, 00);
|
||||
}
|
||||
@@ -185,8 +185,8 @@ private:
|
||||
footpath_remove_edges_at(_loc, reinterpret_cast<TileElement*>(pathElement));
|
||||
}
|
||||
|
||||
pathElement->SetPathEntryIndex(_type);
|
||||
if (_type & (1 << 7))
|
||||
pathElement->SetSurfaceEntryIndex(_type & ~FOOTPATH_ELEMENT_INSERT_QUEUE);
|
||||
if (_type & FOOTPATH_ELEMENT_INSERT_QUEUE)
|
||||
{
|
||||
pathElement->SetIsQueue(true);
|
||||
}
|
||||
@@ -336,7 +336,7 @@ private:
|
||||
tileElement->SetType(TILE_ELEMENT_TYPE_PATH);
|
||||
PathElement* pathElement = tileElement->AsPath();
|
||||
pathElement->clearance_height = zHigh;
|
||||
pathElement->SetPathEntryIndex(_type);
|
||||
pathElement->SetSurfaceEntryIndex(_type & ~FOOTPATH_ELEMENT_INSERT_QUEUE);
|
||||
pathElement->SetSlopeDirection(_slope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK);
|
||||
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ private:
|
||||
tileElement->SetType(TILE_ELEMENT_TYPE_PATH);
|
||||
PathElement* pathElement = tileElement->AsPath();
|
||||
pathElement->clearance_height = zHigh;
|
||||
pathElement->SetPathEntryIndex(_type);
|
||||
pathElement->SetSurfaceEntryIndex(_type & ~FOOTPATH_ELEMENT_INSERT_QUEUE);
|
||||
pathElement->SetSlopeDirection(_slope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK);
|
||||
if (_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ DEFINE_GAME_ACTION(SmallSceneryPlaceAction, GAME_COMMAND_PLACE_SCENERY, SmallSce
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
uint8_t _quadrant;
|
||||
uint8_t _sceneryType;
|
||||
uint16_t _sceneryType;
|
||||
uint8_t _primaryColour;
|
||||
uint8_t _secondaryColour;
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ template<> struct DataSerializerTraits<TileElement>
|
||||
static void encode(IStream* stream, const TileElement& tileElement)
|
||||
{
|
||||
stream->WriteValue(tileElement.type);
|
||||
stream->WriteValue(tileElement.flags);
|
||||
stream->WriteValue(tileElement.Flags);
|
||||
stream->WriteValue(tileElement.base_height);
|
||||
stream->WriteValue(tileElement.clearance_height);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
@@ -445,7 +445,7 @@ template<> struct DataSerializerTraits<TileElement>
|
||||
static void decode(IStream* stream, TileElement& tileElement)
|
||||
{
|
||||
tileElement.type = stream->ReadValue<uint8_t>();
|
||||
tileElement.flags = stream->ReadValue<uint8_t>();
|
||||
tileElement.Flags = stream->ReadValue<uint8_t>();
|
||||
tileElement.base_height = stream->ReadValue<uint8_t>();
|
||||
tileElement.clearance_height = stream->ReadValue<uint8_t>();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
@@ -461,7 +461,7 @@ template<> struct DataSerializerTraits<TileElement>
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(
|
||||
msg, sizeof(msg), "TileElement(type = %u, flags = %u, base_height = %u)", tileElement.type, tileElement.flags,
|
||||
msg, sizeof(msg), "TileElement(type = %u, flags = %u, base_height = %u)", tileElement.type, tileElement.Flags,
|
||||
tileElement.base_height);
|
||||
stream->Write(msg, strlen(msg));
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
|
||||
sub_98196C(session, imageId, 16, 16, 1, 1, 0, heightMarkerBaseZ);
|
||||
}
|
||||
|
||||
PathSurfaceEntry* footpathEntry = tile_element->AsPath()->GetPathEntry();
|
||||
PathSurfaceEntry* footpathEntry = tile_element->AsPath()->GetSurfaceEntry();
|
||||
PathRailingsEntry* railingEntry = tile_element->AsPath()->GetRailingEntry();
|
||||
|
||||
if (footpathEntry != nullptr && railingEntry != nullptr)
|
||||
|
||||
@@ -1989,9 +1989,14 @@ private:
|
||||
uint8_t tileElementType = src->GetType();
|
||||
dst->ClearAs(tileElementType);
|
||||
dst->SetDirection(src->GetDirection());
|
||||
dst->flags = src->flags;
|
||||
dst->SetBaseZ(src->base_height * 4);
|
||||
dst->SetClearanceZ(src->clearance_height * 4);
|
||||
|
||||
// All saved in "flags"
|
||||
dst->SetOccupiedQuadrants(src->GetOccupiedQuadrants());
|
||||
dst->SetGhost(src->IsGhost());
|
||||
dst->SetLastForTile(src->IsLastForTile());
|
||||
|
||||
dst->SetBaseZ(src->base_height * RCT1_COORDS_Z_STEP);
|
||||
dst->SetClearanceZ(src->clearance_height * RCT1_COORDS_Z_STEP);
|
||||
|
||||
switch (tileElementType)
|
||||
{
|
||||
@@ -2037,7 +2042,7 @@ private:
|
||||
dst2->SetIsBroken(false);
|
||||
dst2->SetIsBlockedByVehicle(false);
|
||||
|
||||
dst2->SetPathEntryIndex(entryIndex);
|
||||
dst2->SetSurfaceEntryIndex(entryIndex);
|
||||
dst2->SetShouldDrawPathOverSupports(true);
|
||||
if (RCT1::PathIsQueue(pathType))
|
||||
{
|
||||
@@ -2098,6 +2103,7 @@ private:
|
||||
dst2->SetDoorBState(src2->GetDoorBState());
|
||||
dst2->SetStationIndex(src2->GetStationIndex());
|
||||
dst2->SetHasGreenLight(src2->HasGreenLight());
|
||||
dst2->SetIsIndestructible(src2->IsIndestructible());
|
||||
|
||||
auto trackType = dst2->GetTrackType();
|
||||
if (track_element_has_speed_setting(trackType))
|
||||
|
||||
+111
-24
@@ -29,14 +29,45 @@ uint8_t RCT12TileElementBase::GetDirection() const
|
||||
return this->type & TILE_ELEMENT_DIRECTION_MASK;
|
||||
}
|
||||
|
||||
uint8_t RCT12TileElementBase::GetOccupiedQuadrants() const
|
||||
{
|
||||
return flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
}
|
||||
|
||||
void RCT12TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
|
||||
}
|
||||
|
||||
bool RCT12TileElementBase::IsLastForTile() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
return (this->flags & RCT12_TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
}
|
||||
|
||||
bool RCT12TileElementBase::IsGhost() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
return (this->flags & RCT12_TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
}
|
||||
|
||||
void RCT12TileElementBase::SetLastForTile(bool on)
|
||||
{
|
||||
if (on)
|
||||
flags |= RCT12_TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
else
|
||||
flags &= ~RCT12_TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
}
|
||||
|
||||
void RCT12TileElementBase::SetGhost(bool isGhost)
|
||||
{
|
||||
if (isGhost)
|
||||
{
|
||||
this->flags |= RCT12_TILE_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->flags &= ~RCT12_TILE_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t RCT12SurfaceElement::GetSlope() const
|
||||
@@ -87,7 +118,7 @@ bool RCT12SurfaceElement::HasTrackThatNeedsWater() const
|
||||
|
||||
uint8_t RCT12PathElement::GetEntryIndex() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_TYPE_MASK) >> 4;
|
||||
return (entryIndex & RCT12_FOOTPATH_PROPERTIES_TYPE_MASK) >> 4;
|
||||
}
|
||||
|
||||
uint8_t RCT12PathElement::GetQueueBannerDirection() const
|
||||
@@ -97,12 +128,12 @@ uint8_t RCT12PathElement::GetQueueBannerDirection() const
|
||||
|
||||
bool RCT12PathElement::IsSloped() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) != 0;
|
||||
return (entryIndex & RCT12_FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) != 0;
|
||||
}
|
||||
|
||||
uint8_t RCT12PathElement::GetSlopeDirection() const
|
||||
{
|
||||
return entryIndex & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
return entryIndex & RCT12_FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
}
|
||||
|
||||
uint8_t RCT12PathElement::GetRideIndex() const
|
||||
@@ -112,7 +143,7 @@ uint8_t RCT12PathElement::GetRideIndex() const
|
||||
|
||||
uint8_t RCT12PathElement::GetStationIndex() const
|
||||
{
|
||||
return (additions & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4;
|
||||
return (additions & RCT12_FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
|
||||
bool RCT12PathElement::IsWide() const
|
||||
@@ -127,7 +158,7 @@ bool RCT12PathElement::IsQueue() const
|
||||
|
||||
bool RCT12PathElement::HasQueueBanner() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0;
|
||||
return (entryIndex & RCT12_FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0;
|
||||
}
|
||||
uint8_t RCT12PathElement::GetEdges() const
|
||||
{
|
||||
@@ -141,12 +172,12 @@ uint8_t RCT12PathElement::GetCorners() const
|
||||
|
||||
uint8_t RCT12PathElement::GetAddition() const
|
||||
{
|
||||
return additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
return additions & RCT12_FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
}
|
||||
|
||||
bool RCT12PathElement::AdditionIsGhost() const
|
||||
{
|
||||
return (additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
|
||||
return (additions & RCT12_FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST) != 0;
|
||||
}
|
||||
|
||||
uint8_t RCT12PathElement::GetAdditionStatus() const
|
||||
@@ -157,7 +188,7 @@ uint8_t RCT12PathElement::GetAdditionStatus() const
|
||||
uint8_t RCT12PathElement::GetRCT1PathType() const
|
||||
{
|
||||
uint8_t pathColour = type & 3;
|
||||
uint8_t pathType2 = (entryIndex & FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
|
||||
uint8_t pathType2 = (entryIndex & RCT12_FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
|
||||
|
||||
pathType2 = pathType2 | pathColour;
|
||||
return pathType2;
|
||||
@@ -259,6 +290,23 @@ uint8_t RCT12TrackElement::GetDoorBState() const
|
||||
return (colour & RCT12_TRACK_ELEMENT_DOOR_B_MASK) >> 5;
|
||||
}
|
||||
|
||||
bool RCT12TrackElement::IsIndestructible() const
|
||||
{
|
||||
return (flags & RCT12_TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE) != 0;
|
||||
}
|
||||
|
||||
void RCT12TrackElement::SetIsIndestructible(bool isIndestructible)
|
||||
{
|
||||
if (isIndestructible)
|
||||
{
|
||||
flags |= RCT12_TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~RCT12_TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t RCT12SmallSceneryElement::GetEntryIndex() const
|
||||
{
|
||||
return this->entryIndex;
|
||||
@@ -610,7 +658,7 @@ void RCT12SurfaceElement::SetHasTrackThatNeedsWater(bool on)
|
||||
|
||||
void RCT12PathElement::SetPathEntryIndex(uint8_t newEntryIndex)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_TYPE_MASK;
|
||||
entryIndex &= ~RCT12_FOOTPATH_PROPERTIES_TYPE_MASK;
|
||||
entryIndex |= (newEntryIndex << 4);
|
||||
}
|
||||
|
||||
@@ -644,21 +692,21 @@ void RCT12PathElement::SetCorners(uint8_t newCorners)
|
||||
|
||||
void RCT12PathElement::SetSloped(bool isSloped)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
entryIndex &= ~RCT12_FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
if (isSloped)
|
||||
entryIndex |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
entryIndex |= RCT12_FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetSlopeDirection(uint8_t newSlope)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
entryIndex |= newSlope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
entryIndex &= ~RCT12_FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
entryIndex |= newSlope & RCT12_FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetStationIndex(uint8_t newStationIndex)
|
||||
{
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
additions |= ((newStationIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK);
|
||||
additions &= ~RCT12_FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
additions |= ((newStationIndex << 4) & RCT12_FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK);
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetWide(bool isWide)
|
||||
@@ -677,22 +725,56 @@ void RCT12PathElement::SetIsQueue(bool isQueue)
|
||||
|
||||
void RCT12PathElement::SetHasQueueBanner(bool hasQueueBanner)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
entryIndex &= ~RCT12_FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
if (hasQueueBanner)
|
||||
entryIndex |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
entryIndex |= RCT12_FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetAddition(uint8_t newAddition)
|
||||
{
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
additions &= ~RCT12_FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
additions |= newAddition;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetAdditionIsGhost(bool isGhost)
|
||||
{
|
||||
additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
additions &= ~RCT12_FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST;
|
||||
if (isGhost)
|
||||
additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
additions |= RCT12_FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST;
|
||||
}
|
||||
|
||||
bool RCT12PathElement::IsBroken() const
|
||||
{
|
||||
return (flags & RCT12_TILE_ELEMENT_FLAG_BROKEN) != 0;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetIsBroken(bool isBroken)
|
||||
{
|
||||
if (isBroken)
|
||||
{
|
||||
flags |= RCT12_TILE_ELEMENT_FLAG_BROKEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~RCT12_TILE_ELEMENT_FLAG_BROKEN;
|
||||
}
|
||||
}
|
||||
|
||||
bool RCT12PathElement::IsBlockedByVehicle() const
|
||||
{
|
||||
return (flags & RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE) != 0;
|
||||
}
|
||||
|
||||
void RCT12PathElement::SetIsBlockedByVehicle(bool isBlocked)
|
||||
{
|
||||
if (isBlocked)
|
||||
{
|
||||
flags |= RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE;
|
||||
}
|
||||
}
|
||||
|
||||
void RCT12TrackElement::SetTrackType(uint8_t newType)
|
||||
@@ -754,15 +836,20 @@ void RCT12TrackElement::SetBrakeBoosterSpeed(uint8_t speed)
|
||||
}
|
||||
}
|
||||
|
||||
bool RCT12TrackElement::BlockBrakeClosed() const
|
||||
{
|
||||
return (flags & RCT12_TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) != 0;
|
||||
}
|
||||
|
||||
void RCT12TrackElement::SetBlockBrakeClosed(bool isClosed)
|
||||
{
|
||||
if (isClosed)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
flags |= RCT12_TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
flags &= ~RCT12_TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,17 @@ enum class RCT12TrackDesignVersion : uint8_t
|
||||
unknown
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RCT12_TILE_ELEMENT_FLAG_GHOST = (1 << 4),
|
||||
RCT12_TILE_ELEMENT_FLAG_BROKEN = (1 << 5),
|
||||
RCT12_TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED = (1 << 5),
|
||||
RCT12_TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE = (1 << 6),
|
||||
RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE = (1 << 6),
|
||||
RCT12_TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED = (1 << 6),
|
||||
RCT12_TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RCT12_TRACK_ELEMENT_TYPE_FLAG_CHAIN_LIFT = 1 << 7,
|
||||
@@ -98,6 +109,24 @@ enum
|
||||
RCT12_TRACK_ELEMENT_DOOR_B_MASK = 0b11100000,
|
||||
};
|
||||
|
||||
// Masks and flags for values stored in TileElement.properties.path.type
|
||||
enum
|
||||
{
|
||||
RCT12_FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK = (1 << 0) | (1 << 1),
|
||||
RCT12_FOOTPATH_PROPERTIES_FLAG_IS_SLOPED = (1 << 2),
|
||||
RCT12_FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER = (1 << 3),
|
||||
RCT12_FOOTPATH_PROPERTIES_TYPE_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
|
||||
};
|
||||
|
||||
// Masks and flags for values stored in in RCT12TileElement.properties.path.additions
|
||||
enum
|
||||
{
|
||||
RCT12_FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
|
||||
// The most significant bit in this mask will always be zero, since rides can only have 4 stations
|
||||
RCT12_FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK = (1 << 4) | (1 << 5) | (1 << 6),
|
||||
RCT12_FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST = (1 << 7),
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct RCT12xy8
|
||||
@@ -228,9 +257,15 @@ struct RCT12TileElementBase
|
||||
uint8_t clearance_height; // 3
|
||||
uint8_t GetType() const;
|
||||
uint8_t GetDirection() const;
|
||||
bool IsLastForTile() const;
|
||||
bool IsGhost() const;
|
||||
void SetDirection(uint8_t direction);
|
||||
|
||||
uint8_t GetOccupiedQuadrants() const;
|
||||
void SetOccupiedQuadrants(uint8_t quadrants);
|
||||
|
||||
bool IsLastForTile() const;
|
||||
void SetLastForTile(bool on);
|
||||
bool IsGhost() const;
|
||||
void SetGhost(bool isGhost);
|
||||
};
|
||||
/**
|
||||
* Map element structure
|
||||
@@ -351,6 +386,12 @@ public:
|
||||
void SetAddition(uint8_t newAddition);
|
||||
void SetAdditionIsGhost(bool isGhost);
|
||||
void SetAdditionStatus(uint8_t newStatus);
|
||||
|
||||
bool IsBroken() const;
|
||||
void SetIsBroken(bool isBroken);
|
||||
|
||||
bool IsBlockedByVehicle() const;
|
||||
void SetIsBlockedByVehicle(bool isBlocked);
|
||||
};
|
||||
assert_struct_size(RCT12PathElement, 8);
|
||||
struct RCT12TrackElement : RCT12TileElementBase
|
||||
@@ -405,12 +446,16 @@ public:
|
||||
void SetHasChain(bool on);
|
||||
void SetHasCableLift(bool on);
|
||||
void SetInverted(bool inverted);
|
||||
bool BlockBrakeClosed() const;
|
||||
void SetBlockBrakeClosed(bool isClosed);
|
||||
void SetBrakeBoosterSpeed(uint8_t speed);
|
||||
void SetHasGreenLight(uint8_t greenLight);
|
||||
void SetSeatRotation(uint8_t newSeatRotation);
|
||||
void SetMazeEntry(uint16_t newMazeEntry);
|
||||
void SetPhotoTimeout(uint8_t newValue);
|
||||
|
||||
bool IsIndestructible() const;
|
||||
void SetIsIndestructible(bool isIndestructible);
|
||||
};
|
||||
assert_struct_size(RCT12TrackElement, 8);
|
||||
struct RCT12SmallSceneryElement : RCT12TileElementBase
|
||||
|
||||
@@ -1423,10 +1423,14 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
uint8_t tileElementType = src->GetType();
|
||||
dst->ClearAs(tileElementType);
|
||||
dst->SetDirection(src->GetDirection());
|
||||
dst->flags = src->flags;
|
||||
dst->base_height = src->base_height;
|
||||
dst->clearance_height = src->clearance_height;
|
||||
|
||||
// All saved in "flags"
|
||||
dst->SetOccupiedQuadrants(src->GetOccupiedQuadrants());
|
||||
dst->SetGhost(src->IsGhost());
|
||||
dst->SetLastForTile(src->IsLastForTile());
|
||||
|
||||
switch (tileElementType)
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_SURFACE:
|
||||
@@ -1450,7 +1454,7 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
auto dst2 = dst->AsPath();
|
||||
auto src2 = src->AsPath();
|
||||
|
||||
dst2->SetPathEntryIndex(src2->GetPathEntryIndex());
|
||||
dst2->SetPathEntryIndex(src2->GetSurfaceEntryIndex());
|
||||
dst2->SetQueueBannerDirection(src2->GetQueueBannerDirection());
|
||||
dst2->SetSloped(src2->IsSloped());
|
||||
dst2->SetSlopeDirection(src2->GetSlopeDirection());
|
||||
@@ -1464,6 +1468,8 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
dst2->SetAddition(src2->GetAddition());
|
||||
dst2->SetAdditionIsGhost(src2->AdditionIsGhost());
|
||||
dst2->SetAdditionStatus(src2->GetAdditionStatus());
|
||||
dst2->SetIsBroken(src2->IsBroken());
|
||||
dst2->SetIsBlockedByVehicle(src2->IsBlockedByVehicle());
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1483,6 +1489,8 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
dst2->SetInverted(src2->IsInverted());
|
||||
dst2->SetBrakeBoosterSpeed(src2->GetBrakeBoosterSpeed());
|
||||
dst2->SetPhotoTimeout(src2->GetPhotoTimeout());
|
||||
dst2->SetBlockBrakeClosed(src2->BlockBrakeClosed());
|
||||
dst2->SetIsIndestructible(src2->IsIndestructible());
|
||||
|
||||
auto ride = get_ride(dst2->GetRideIndex());
|
||||
if (ride)
|
||||
|
||||
@@ -1027,10 +1027,14 @@ public:
|
||||
uint8_t tileElementType = src->GetType();
|
||||
dst->ClearAs(tileElementType);
|
||||
dst->SetDirection(src->GetDirection());
|
||||
dst->flags = src->flags;
|
||||
dst->base_height = src->base_height;
|
||||
dst->clearance_height = src->clearance_height;
|
||||
|
||||
// All saved in "flags"
|
||||
dst->SetOccupiedQuadrants(src->GetOccupiedQuadrants());
|
||||
dst->SetGhost(src->IsGhost());
|
||||
dst->SetLastForTile(src->IsLastForTile());
|
||||
|
||||
switch (tileElementType)
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_SURFACE:
|
||||
@@ -1054,7 +1058,7 @@ public:
|
||||
auto dst2 = dst->AsPath();
|
||||
auto src2 = src->AsPath();
|
||||
|
||||
dst2->SetPathEntryIndex(src2->GetEntryIndex());
|
||||
dst2->SetSurfaceEntryIndex(src2->GetEntryIndex());
|
||||
dst2->SetQueueBannerDirection(src2->GetQueueBannerDirection());
|
||||
dst2->SetSloped(src2->IsSloped());
|
||||
dst2->SetSlopeDirection(src2->GetSlopeDirection());
|
||||
@@ -1068,6 +1072,8 @@ public:
|
||||
dst2->SetAddition(src2->GetAddition());
|
||||
dst2->SetAdditionIsGhost(src2->AdditionIsGhost());
|
||||
dst2->SetAdditionStatus(src2->GetAdditionStatus());
|
||||
dst2->SetIsBroken(src2->IsBroken());
|
||||
dst2->SetIsBlockedByVehicle(src2->IsBlockedByVehicle());
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1085,6 +1091,8 @@ public:
|
||||
dst2->SetInverted(src2->IsInverted());
|
||||
dst2->SetStationIndex(src2->GetStationIndex());
|
||||
dst2->SetHasGreenLight(src2->HasGreenLight());
|
||||
dst2->SetBlockBrakeClosed(src2->BlockBrakeClosed());
|
||||
dst2->SetIsIndestructible(src2->IsIndestructible());
|
||||
|
||||
auto trackType = dst2->GetTrackType();
|
||||
if (track_element_has_speed_setting(trackType))
|
||||
|
||||
@@ -611,7 +611,7 @@ static void ride_ratings_score_close_proximity(TileElement* inputTileElement)
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
// Bonus for normal path
|
||||
if (tileElement->AsPath()->GetPathEntryIndex() != 0)
|
||||
if (tileElement->AsPath()->GetSurfaceEntryIndex() != 0)
|
||||
{
|
||||
if (tileElement->clearance_height == inputTileElement->base_height)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "Ride.h"
|
||||
#include "../world/Location.hpp"
|
||||
|
||||
struct Ride;
|
||||
|
||||
using StationIndex = uint8_t;
|
||||
|
||||
void ride_update_station(Ride* ride, int32_t stationIndex);
|
||||
int8_t ride_get_first_valid_station_exit(Ride* ride);
|
||||
|
||||
@@ -1377,35 +1377,35 @@ void TrackElement::SetInverted(bool inverted)
|
||||
|
||||
bool TrackElement::BlockBrakeClosed() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) != 0;
|
||||
return (Flags2 & TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED) != 0;
|
||||
}
|
||||
|
||||
void TrackElement::SetBlockBrakeClosed(bool isClosed)
|
||||
{
|
||||
if (isClosed)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
Flags2 |= TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED;
|
||||
Flags2 &= ~TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
bool TrackElement::IsIndestructible() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE) != 0;
|
||||
return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0;
|
||||
}
|
||||
|
||||
void TrackElement::SetIsIndestructible(bool isIndestructible)
|
||||
{
|
||||
if (isIndestructible)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
Flags2 |= TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
Flags2 &= ~TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ enum
|
||||
TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2,
|
||||
TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3,
|
||||
TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4,
|
||||
TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED = 1 << 5,
|
||||
TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -285,7 +285,7 @@ static void track_design_save_add_wall(const CoordsXY& loc, WallElement* wallEle
|
||||
|
||||
static void track_design_save_add_footpath(const CoordsXY& loc, PathElement* pathElement)
|
||||
{
|
||||
int32_t entryType = pathElement->GetPathEntryIndex();
|
||||
int32_t entryType = pathElement->GetSurfaceEntryIndex();
|
||||
auto entry = object_entry_get_entry(OBJECT_TYPE_PATHS, entryType);
|
||||
|
||||
uint8_t flags = 0;
|
||||
@@ -454,7 +454,7 @@ static void track_design_save_remove_wall(const CoordsXY& loc, WallElement* wall
|
||||
|
||||
static void track_design_save_remove_footpath(const CoordsXY& loc, PathElement* pathElement)
|
||||
{
|
||||
int32_t entryType = pathElement->GetPathEntryIndex();
|
||||
int32_t entryType = pathElement->GetSurfaceEntryIndex();
|
||||
auto entry = object_entry_get_entry(OBJECT_TYPE_PATHS, entryType);
|
||||
|
||||
uint8_t flags = 0;
|
||||
|
||||
@@ -255,12 +255,12 @@ void EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
|
||||
SequenceIndex |= (newSequenceIndex & 0xF);
|
||||
}
|
||||
|
||||
uint8_t EntranceElement::GetPathType() const
|
||||
PathSurfaceIndex EntranceElement::GetPathType() const
|
||||
{
|
||||
return pathType;
|
||||
return PathType;
|
||||
}
|
||||
|
||||
void EntranceElement::SetPathType(uint8_t newPathType)
|
||||
void EntranceElement::SetPathType(PathSurfaceIndex newPathType)
|
||||
{
|
||||
pathType = newPathType;
|
||||
PathType = newPathType;
|
||||
}
|
||||
@@ -1424,25 +1424,24 @@ int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t
|
||||
|
||||
bool PathElement::IsSloped() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) != 0;
|
||||
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetSloped(bool isSloped)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
|
||||
if (isSloped)
|
||||
entryIndex |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
|
||||
}
|
||||
|
||||
Direction PathElement::GetSlopeDirection() const
|
||||
{
|
||||
return static_cast<Direction>(entryIndex & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK);
|
||||
return SlopeDirection;
|
||||
}
|
||||
|
||||
void PathElement::SetSlopeDirection(Direction newSlope)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
entryIndex |= static_cast<uint8_t>(newSlope) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
SlopeDirection = newSlope;
|
||||
}
|
||||
|
||||
bool PathElement::IsQueue() const
|
||||
@@ -1459,59 +1458,58 @@ void PathElement::SetIsQueue(bool isQueue)
|
||||
|
||||
bool PathElement::HasQueueBanner() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0;
|
||||
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetHasQueueBanner(bool hasQueueBanner)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
|
||||
if (hasQueueBanner)
|
||||
entryIndex |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
|
||||
}
|
||||
|
||||
bool PathElement::IsBroken() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_BROKEN) != 0;
|
||||
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetIsBroken(bool isBroken)
|
||||
{
|
||||
if (isBroken)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_BROKEN;
|
||||
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
|
||||
}
|
||||
}
|
||||
|
||||
bool PathElement::IsBlockedByVehicle() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE) != 0;
|
||||
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetIsBlockedByVehicle(bool isBlocked)
|
||||
{
|
||||
if (isBlocked)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE;
|
||||
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE;
|
||||
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetStationIndex() const
|
||||
{
|
||||
return (additions & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4;
|
||||
return StationIndex;
|
||||
}
|
||||
|
||||
void PathElement::SetStationIndex(uint8_t newStationIndex)
|
||||
void PathElement::SetStationIndex(::StationIndex newStationIndex)
|
||||
{
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
additions |= ((newStationIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK);
|
||||
StationIndex = newStationIndex;
|
||||
}
|
||||
|
||||
bool PathElement::IsWide() const
|
||||
@@ -1528,12 +1526,12 @@ void PathElement::SetWide(bool isWide)
|
||||
|
||||
bool PathElement::HasAddition() const
|
||||
{
|
||||
return (additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK) != 0;
|
||||
return Additions != 0;
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetAddition() const
|
||||
{
|
||||
return additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
return Additions;
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetAdditionEntryIndex() const
|
||||
@@ -1548,38 +1546,37 @@ rct_scenery_entry* PathElement::GetAdditionEntry() const
|
||||
|
||||
void PathElement::SetAddition(uint8_t newAddition)
|
||||
{
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
additions |= newAddition;
|
||||
Additions = newAddition;
|
||||
}
|
||||
|
||||
bool PathElement::AdditionIsGhost() const
|
||||
{
|
||||
return (additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
|
||||
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetAdditionIsGhost(bool isGhost)
|
||||
{
|
||||
additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
|
||||
if (isGhost)
|
||||
additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetPathEntryIndex() const
|
||||
PathSurfaceIndex PathElement::GetSurfaceEntryIndex() const
|
||||
{
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_TYPE_MASK) >> 4;
|
||||
return SurfaceIndex;
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetRailingEntryIndex() const
|
||||
PathRailingsIndex PathElement::GetRailingEntryIndex() const
|
||||
{
|
||||
return GetPathEntryIndex();
|
||||
return GetSurfaceEntryIndex();
|
||||
}
|
||||
|
||||
PathSurfaceEntry* PathElement::GetPathEntry() const
|
||||
PathSurfaceEntry* PathElement::GetSurfaceEntry() const
|
||||
{
|
||||
if (!IsQueue())
|
||||
return get_path_surface_entry(GetPathEntryIndex());
|
||||
return get_path_surface_entry(GetSurfaceEntryIndex());
|
||||
else
|
||||
return get_path_surface_entry(GetPathEntryIndex() + MAX_PATH_OBJECTS);
|
||||
return get_path_surface_entry(GetSurfaceEntryIndex() + MAX_PATH_OBJECTS);
|
||||
}
|
||||
|
||||
PathRailingsEntry* PathElement::GetRailingEntry() const
|
||||
@@ -1587,13 +1584,12 @@ PathRailingsEntry* PathElement::GetRailingEntry() const
|
||||
return get_path_railings_entry(GetRailingEntryIndex());
|
||||
}
|
||||
|
||||
void PathElement::SetPathEntryIndex(uint8_t newEntryIndex)
|
||||
void PathElement::SetSurfaceEntryIndex(PathSurfaceIndex newIndex)
|
||||
{
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_TYPE_MASK;
|
||||
entryIndex |= (newEntryIndex << 4);
|
||||
SurfaceIndex = newIndex & ~FOOTPATH_ELEMENT_INSERT_QUEUE;
|
||||
}
|
||||
|
||||
void PathElement::SetRailingEntryIndex(uint8_t newEntryIndex)
|
||||
void PathElement::SetRailingEntryIndex(PathRailingsIndex newEntryIndex)
|
||||
{
|
||||
log_verbose("Setting railing entry index to %d", newEntryIndex);
|
||||
}
|
||||
@@ -2164,7 +2160,7 @@ void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElem
|
||||
tileElement->AsPath()->SetEdgesAndCorners(0);
|
||||
}
|
||||
|
||||
PathSurfaceEntry* get_path_surface_entry(int32_t entryIndex)
|
||||
PathSurfaceEntry* get_path_surface_entry(PathSurfaceIndex entryIndex)
|
||||
{
|
||||
PathSurfaceEntry* result = nullptr;
|
||||
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
|
||||
@@ -2180,7 +2176,7 @@ PathSurfaceEntry* get_path_surface_entry(int32_t entryIndex)
|
||||
return result;
|
||||
}
|
||||
|
||||
PathRailingsEntry* get_path_railings_entry(int32_t entryIndex)
|
||||
PathRailingsEntry* get_path_railings_entry(PathRailingsIndex entryIndex)
|
||||
{
|
||||
PathRailingsEntry* result = nullptr;
|
||||
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
|
||||
@@ -2204,44 +2200,44 @@ void PathElement::SetRideIndex(ride_id_t newRideIndex)
|
||||
|
||||
uint8_t PathElement::GetAdditionStatus() const
|
||||
{
|
||||
return additionStatus;
|
||||
return AdditionStatus;
|
||||
}
|
||||
|
||||
void PathElement::SetAdditionStatus(uint8_t newStatus)
|
||||
{
|
||||
additionStatus = newStatus;
|
||||
AdditionStatus = newStatus;
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetEdges() const
|
||||
{
|
||||
return edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
return Edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
}
|
||||
|
||||
void PathElement::SetEdges(uint8_t newEdges)
|
||||
{
|
||||
edges &= ~FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
edges |= (newEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK);
|
||||
Edges &= ~FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
Edges |= (newEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK);
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetCorners() const
|
||||
{
|
||||
return edges >> 4;
|
||||
return Edges >> 4;
|
||||
}
|
||||
|
||||
void PathElement::SetCorners(uint8_t newCorners)
|
||||
{
|
||||
edges &= ~FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK;
|
||||
edges |= (newCorners << 4);
|
||||
Edges &= ~FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK;
|
||||
Edges |= (newCorners << 4);
|
||||
}
|
||||
|
||||
uint8_t PathElement::GetEdgesAndCorners() const
|
||||
{
|
||||
return edges;
|
||||
return Edges;
|
||||
}
|
||||
|
||||
void PathElement::SetEdgesAndCorners(uint8_t newEdgesAndCorners)
|
||||
{
|
||||
edges = newEdgesAndCorners;
|
||||
Edges = newEdgesAndCorners;
|
||||
}
|
||||
|
||||
bool PathElement::IsLevelCrossing(const CoordsXY& coords) const
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _WORLD_FOOTPATH_H_
|
||||
#define _WORLD_FOOTPATH_H_
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../interface/Viewport.h"
|
||||
@@ -28,6 +27,12 @@ constexpr auto PATH_HEIGHT = 4 * COORDS_Z_STEP;
|
||||
|
||||
#define FOOTPATH_ELEMENT_INSERT_QUEUE 0x80
|
||||
|
||||
using PathSurfaceIndex = uint16_t;
|
||||
constexpr PathSurfaceIndex PATH_SURFACE_INDEX_NULL = (PathSurfaceIndex)-1;
|
||||
|
||||
using PathRailingsIndex = uint8_t;
|
||||
constexpr PathRailingsIndex PATH_RAILINGS_INDEX_NULL = (PathRailingsIndex)-1;
|
||||
|
||||
enum class RailingEntrySupportType : uint8_t
|
||||
{
|
||||
Box = 0,
|
||||
@@ -91,13 +96,13 @@ enum
|
||||
FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
|
||||
};
|
||||
|
||||
// Masks and flags for values stored in in TileElement.properties.path.additions
|
||||
enum
|
||||
{
|
||||
FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
|
||||
// The most significant bit in this mask will always be zero, since rides can only have 4 stations
|
||||
FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK = (1 << 4) | (1 << 5) | (1 << 6),
|
||||
FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST = (1 << 7),
|
||||
FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED = 1 << 0,
|
||||
FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER = (1 << 1),
|
||||
FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST = (1 << 2),
|
||||
FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE = (1 << 3),
|
||||
FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN = (1 << 4),
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -120,16 +125,6 @@ enum
|
||||
FOOTPATH_SEARCH_TOO_COMPLEX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FOOTPATH_ADDITION_FLAG_IS_GHOST = (1 << 7),
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FOOTPATH_CLEAR_DIRECTIONAL = (1 << 8), // Flag set when direction is used.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SLOPE_IS_IRREGULAR_FLAG = (1 << 3), // Flag set in `DefaultPathSlope[]` and checked in `footpath_place_real`
|
||||
@@ -198,10 +193,8 @@ int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t
|
||||
void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElement);
|
||||
int32_t entrance_get_directions(const TileElement* tileElement);
|
||||
|
||||
PathSurfaceEntry* get_path_surface_entry(int32_t entryIndex);
|
||||
PathRailingsEntry* get_path_railings_entry(int32_t entryIndex);
|
||||
PathSurfaceEntry* get_path_surface_entry(PathSurfaceIndex entryIndex);
|
||||
PathRailingsEntry* get_path_railings_entry(PathRailingsIndex entryIndex);
|
||||
|
||||
void footpath_queue_chain_reset();
|
||||
void footpath_queue_chain_push(ride_id_t rideIndex);
|
||||
|
||||
#endif
|
||||
@@ -54,22 +54,22 @@ void LargeSceneryElement::SetBannerIndex(::BannerIndex newIndex)
|
||||
|
||||
bool LargeSceneryElement::IsAccounted() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED) != 0;
|
||||
return (Flags2 & LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED) != 0;
|
||||
}
|
||||
|
||||
void LargeSceneryElement::SetIsAccounted(bool isAccounted)
|
||||
{
|
||||
if (isAccounted)
|
||||
{
|
||||
flags |= TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED;
|
||||
Flags2 |= LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED;
|
||||
Flags2 &= ~LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t LargeSceneryElement::GetEntryIndex() const
|
||||
uint16_t LargeSceneryElement::GetEntryIndex() const
|
||||
{
|
||||
return EntryIndex;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ uint8_t LargeSceneryElement::GetSequenceIndex() const
|
||||
return SequenceIndex;
|
||||
}
|
||||
|
||||
void LargeSceneryElement::SetEntryIndex(uint32_t newIndex)
|
||||
void LargeSceneryElement::SetEntryIndex(uint16_t newIndex)
|
||||
{
|
||||
EntryIndex = newIndex;
|
||||
}
|
||||
|
||||
@@ -14,3 +14,8 @@
|
||||
#include "TileElement.h"
|
||||
|
||||
rct_scenery_entry* get_large_scenery_entry(int32_t entryIndex);
|
||||
|
||||
enum
|
||||
{
|
||||
LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED = 1 << 0,
|
||||
};
|
||||
@@ -655,12 +655,12 @@ void map_update_path_wide_flags()
|
||||
*
|
||||
* rct2: 0x006A7B84
|
||||
*/
|
||||
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slope, bool isSloped)
|
||||
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped)
|
||||
{
|
||||
if (!isSloped)
|
||||
return 0;
|
||||
|
||||
switch (slope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
switch (slopeDirection % NumOrthogonalDirections)
|
||||
{
|
||||
case TILE_ELEMENT_DIRECTION_WEST:
|
||||
return (31 - (coords.x & 31)) / 2;
|
||||
@@ -1174,7 +1174,7 @@ TileElement* tile_element_insert(const TileCoordsXYZ& loc, int32_t occupiedQuadr
|
||||
insertedElement = newTileElement;
|
||||
newTileElement->type = 0;
|
||||
newTileElement->base_height = loc.z;
|
||||
newTileElement->flags = 0;
|
||||
newTileElement->Flags = 0;
|
||||
newTileElement->SetLastForTile(isLastForTile);
|
||||
newTileElement->SetOccupiedQuadrants(occupiedQuadrants);
|
||||
newTileElement->clearance_height = loc.z;
|
||||
|
||||
@@ -153,7 +153,7 @@ void map_update_tile_pointers();
|
||||
TileElement* map_get_first_element_at(const CoordsXY& elementPos);
|
||||
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n);
|
||||
void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements);
|
||||
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slope, bool isSloped);
|
||||
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped);
|
||||
BannerElement* map_get_banner_element_at(const CoordsXYZ& bannerPos, uint8_t direction);
|
||||
SurfaceElement* map_get_surface_element_at(const CoordsXY& coords);
|
||||
PathElement* map_get_path_element_at(const TileCoordsXYZ& loc);
|
||||
|
||||
@@ -74,7 +74,7 @@ void scenery_update_tile(const CoordsXY& sceneryPos)
|
||||
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_SMALL_SCENERY)
|
||||
{
|
||||
scenery_update_age(sceneryPos, tileElement);
|
||||
tileElement->AsSmallScenery()->UpdateAge(sceneryPos);
|
||||
}
|
||||
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
@@ -101,12 +101,9 @@ void scenery_update_tile(const CoordsXY& sceneryPos)
|
||||
*
|
||||
* rct2: 0x006E33D9
|
||||
*/
|
||||
void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||
void SmallSceneryElement::UpdateAge(const CoordsXY& sceneryPos)
|
||||
{
|
||||
TileElement* tileElementAbove;
|
||||
rct_scenery_entry* sceneryEntry;
|
||||
|
||||
sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
|
||||
auto* sceneryEntry = GetEntry();
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -118,14 +115,14 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||
}
|
||||
|
||||
if (!scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED)
|
||||
|| (gClimateCurrent.Weather < WEATHER_RAIN) || (tileElement->AsSmallScenery()->GetAge() < 5))
|
||||
|| (gClimateCurrent.Weather < WEATHER_RAIN) || GetAge() < 5)
|
||||
{
|
||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
||||
IncreaseAge(sceneryPos);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check map elements above, presumably to see if map element is blocked from rain
|
||||
tileElementAbove = tileElement;
|
||||
TileElement* tileElementAbove = reinterpret_cast<TileElement*>(this);
|
||||
// Change from original: RCT2 only checked for the first three quadrants, which was very likely to be a bug.
|
||||
while (!(tileElementAbove->GetOccupiedQuadrants()))
|
||||
{
|
||||
@@ -142,13 +139,13 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
map_invalidate_tile_zoom1({ sceneryPos, tileElementAbove->GetBaseZ(), tileElementAbove->GetClearanceZ() });
|
||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
||||
IncreaseAge(sceneryPos);
|
||||
return;
|
||||
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
|
||||
sceneryEntry = tileElementAbove->AsSmallScenery()->GetEntry();
|
||||
if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE))
|
||||
{
|
||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
||||
IncreaseAge(sceneryPos);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -156,8 +153,8 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||
}
|
||||
|
||||
// Reset age / water plant
|
||||
tileElement->AsSmallScenery()->SetAge(0);
|
||||
map_invalidate_tile_zoom1({ sceneryPos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
|
||||
SetAge(0);
|
||||
map_invalidate_tile_zoom1({ sceneryPos, GetBaseZ(), GetClearanceZ() });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,7 +280,6 @@ extern money32 gClearSceneryCost;
|
||||
|
||||
void init_scenery();
|
||||
void scenery_update_tile(const CoordsXY& sceneryPos);
|
||||
void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement);
|
||||
void scenery_set_default_placement_configuration();
|
||||
void scenery_remove_ghost_tool_placement();
|
||||
|
||||
|
||||
@@ -92,12 +92,12 @@ void SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant)
|
||||
type |= (newQuadrant << 6);
|
||||
}
|
||||
|
||||
uint8_t SmallSceneryElement::GetEntryIndex() const
|
||||
uint16_t SmallSceneryElement::GetEntryIndex() const
|
||||
{
|
||||
return this->entryIndex;
|
||||
}
|
||||
|
||||
void SmallSceneryElement::SetEntryIndex(uint8_t newIndex)
|
||||
void SmallSceneryElement::SetEntryIndex(uint16_t newIndex)
|
||||
{
|
||||
this->entryIndex = newIndex;
|
||||
}
|
||||
|
||||
@@ -46,31 +46,31 @@ Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const
|
||||
|
||||
bool TileElementBase::IsLastForTile() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
}
|
||||
|
||||
void TileElementBase::SetLastForTile(bool on)
|
||||
{
|
||||
if (on)
|
||||
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
Flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
else
|
||||
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
}
|
||||
|
||||
bool TileElementBase::IsGhost() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
}
|
||||
|
||||
void TileElementBase::SetGhost(bool isGhost)
|
||||
{
|
||||
if (isGhost)
|
||||
{
|
||||
this->flags |= TILE_ELEMENT_FLAG_GHOST;
|
||||
this->Flags |= TILE_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->flags &= ~TILE_ELEMENT_FLAG_GHOST;
|
||||
this->Flags &= ~TILE_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ uint8_t tile_element_get_ride_index(const TileElement* tileElement)
|
||||
void TileElement::ClearAs(uint8_t newType)
|
||||
{
|
||||
type = newType;
|
||||
flags = 0;
|
||||
Flags = 0;
|
||||
base_height = 2;
|
||||
clearance_height = 2;
|
||||
std::fill_n(pad_04, sizeof(pad_04), 0x00);
|
||||
@@ -216,13 +216,13 @@ const QuarterTile QuarterTile::Rotate(uint8_t amount) const
|
||||
|
||||
uint8_t TileElementBase::GetOccupiedQuadrants() const
|
||||
{
|
||||
return flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
}
|
||||
|
||||
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
|
||||
Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
|
||||
}
|
||||
|
||||
int32_t TileElementBase::GetBaseZ() const
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "../ride/Station.h"
|
||||
#include "Banner.h"
|
||||
#include "Footpath.h"
|
||||
#include "Location.hpp"
|
||||
@@ -63,24 +64,30 @@ struct CorruptElement;
|
||||
struct TileElementBase
|
||||
{
|
||||
uint8_t type; // 0
|
||||
uint8_t flags; // 1. Upper nibble: flags. Lower nibble: occupied quadrants (one bit per quadrant).
|
||||
uint8_t Flags; // 1. Upper nibble: flags. Lower nibble: occupied quadrants (one bit per quadrant).
|
||||
uint8_t base_height; // 2
|
||||
uint8_t clearance_height; // 3
|
||||
|
||||
void Remove();
|
||||
|
||||
uint8_t GetType() const;
|
||||
void SetType(uint8_t newType);
|
||||
|
||||
Direction GetDirection() const;
|
||||
void SetDirection(Direction direction);
|
||||
Direction GetDirectionWithOffset(uint8_t offset) const;
|
||||
|
||||
bool IsLastForTile() const;
|
||||
void SetLastForTile(bool on);
|
||||
bool IsGhost() const;
|
||||
void SetGhost(bool isGhost);
|
||||
void Remove();
|
||||
|
||||
uint8_t GetOccupiedQuadrants() const;
|
||||
void SetOccupiedQuadrants(uint8_t quadrants);
|
||||
|
||||
int32_t GetBaseZ() const;
|
||||
void SetBaseZ(int32_t newZ);
|
||||
|
||||
int32_t GetClearanceZ() const;
|
||||
void SetClearanceZ(int32_t newZ);
|
||||
};
|
||||
@@ -148,7 +155,7 @@ private:
|
||||
uint8_t EdgeStyle;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_08[6];
|
||||
uint8_t pad_0A[6];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
@@ -183,27 +190,34 @@ assert_struct_size(SurfaceElement, 16);
|
||||
struct PathElement : TileElementBase
|
||||
{
|
||||
private:
|
||||
uint8_t entryIndex; // 4, 0xF0 Path type, 0x08 Ride sign, 0x04 Set when path is sloped, 0x03 Rotation
|
||||
uint8_t additions; // 5, 0bGSSSAAAA: G = Ghost, S = station index, A = addition (0 means no addition)
|
||||
uint8_t edges; // 6
|
||||
union
|
||||
{
|
||||
uint8_t additionStatus; // 7
|
||||
uint8_t rideIndex;
|
||||
};
|
||||
PathSurfaceIndex SurfaceIndex; // 4
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_08[8];
|
||||
PathRailingsIndex RailingsIndex; // 6
|
||||
#pragma clang diagnostic pop
|
||||
uint8_t Additions; // 7 (0 means no addition)
|
||||
uint8_t Edges; // 8
|
||||
uint8_t Flags2; // 9
|
||||
uint8_t SlopeDirection; // 10
|
||||
union
|
||||
{
|
||||
uint8_t AdditionStatus; // 11, only used for litter bins
|
||||
ride_id_t rideIndex; // 11
|
||||
};
|
||||
::StationIndex StationIndex; // 13
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_0E[2];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
uint8_t GetPathEntryIndex() const;
|
||||
PathSurfaceEntry* GetPathEntry() const;
|
||||
void SetPathEntryIndex(uint8_t newIndex);
|
||||
PathSurfaceIndex GetSurfaceEntryIndex() const;
|
||||
PathSurfaceEntry* GetSurfaceEntry() const;
|
||||
void SetSurfaceEntryIndex(PathSurfaceIndex newIndex);
|
||||
|
||||
uint8_t GetRailingEntryIndex() const;
|
||||
PathRailingsIndex GetRailingEntryIndex() const;
|
||||
PathRailingsEntry* GetRailingEntry() const;
|
||||
void SetRailingEntryIndex(uint8_t newIndex);
|
||||
void SetRailingEntryIndex(PathRailingsIndex newIndex);
|
||||
|
||||
uint8_t GetQueueBannerDirection() const;
|
||||
void SetQueueBannerDirection(uint8_t direction);
|
||||
@@ -217,8 +231,8 @@ public:
|
||||
ride_id_t GetRideIndex() const;
|
||||
void SetRideIndex(ride_id_t newRideIndex);
|
||||
|
||||
uint8_t GetStationIndex() const;
|
||||
void SetStationIndex(uint8_t newStationIndex);
|
||||
::StationIndex GetStationIndex() const;
|
||||
void SetStationIndex(::StationIndex newStationIndex);
|
||||
|
||||
bool IsWide() const;
|
||||
void SetWide(bool isWide);
|
||||
@@ -359,18 +373,18 @@ assert_struct_size(TrackElement, 16);
|
||||
struct SmallSceneryElement : TileElementBase
|
||||
{
|
||||
private:
|
||||
uint8_t entryIndex; // 4
|
||||
uint8_t age; // 5
|
||||
uint8_t colour_1; // 6
|
||||
uint8_t colour_2; // 7
|
||||
uint16_t entryIndex; // 4
|
||||
uint8_t age; // 5
|
||||
uint8_t colour_1; // 6
|
||||
uint8_t colour_2; // 7
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_08[8];
|
||||
uint8_t pad_09[7];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
uint8_t GetEntryIndex() const;
|
||||
void SetEntryIndex(uint8_t newIndex);
|
||||
uint16_t GetEntryIndex() const;
|
||||
void SetEntryIndex(uint16_t newIndex);
|
||||
rct_scenery_entry* GetEntry() const;
|
||||
uint8_t GetAge() const;
|
||||
void SetAge(uint8_t newAge);
|
||||
@@ -383,24 +397,26 @@ public:
|
||||
void SetSecondaryColour(colour_t colour);
|
||||
bool NeedsSupports() const;
|
||||
void SetNeedsSupports();
|
||||
void UpdateAge(const CoordsXY& sceneryPos);
|
||||
};
|
||||
assert_struct_size(SmallSceneryElement, 16);
|
||||
|
||||
struct LargeSceneryElement : TileElementBase
|
||||
{
|
||||
private:
|
||||
uint32_t EntryIndex;
|
||||
uint16_t EntryIndex;
|
||||
::BannerIndex BannerIndex;
|
||||
uint8_t SequenceIndex;
|
||||
uint8_t Colour[3];
|
||||
uint8_t Flags2;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad[2];
|
||||
uint8_t pad[3];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
uint32_t GetEntryIndex() const;
|
||||
void SetEntryIndex(uint32_t newIndex);
|
||||
uint16_t GetEntryIndex() const;
|
||||
void SetEntryIndex(uint16_t newIndex);
|
||||
rct_scenery_entry* GetEntry() const;
|
||||
|
||||
uint8_t GetSequenceIndex() const;
|
||||
@@ -470,14 +486,14 @@ assert_struct_size(WallElement, 16);
|
||||
struct EntranceElement : TileElementBase
|
||||
{
|
||||
private:
|
||||
uint8_t entranceType; // 4
|
||||
uint8_t SequenceIndex; // 5. Only uses the lower nibble.
|
||||
uint8_t StationIndex; // 6
|
||||
uint8_t pathType; // 7
|
||||
ride_id_t rideIndex; // 8
|
||||
uint8_t entranceType; // 4
|
||||
uint8_t SequenceIndex; // 5. Only uses the lower nibble.
|
||||
uint8_t StationIndex; // 6
|
||||
PathSurfaceIndex PathType; // 7
|
||||
ride_id_t rideIndex; // 8
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_0A[6];
|
||||
uint8_t pad_0B[5];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
@@ -493,8 +509,8 @@ public:
|
||||
uint8_t GetSequenceIndex() const;
|
||||
void SetSequenceIndex(uint8_t newSequenceIndex);
|
||||
|
||||
uint8_t GetPathType() const;
|
||||
void SetPathType(uint8_t newPathType);
|
||||
PathSurfaceIndex GetPathType() const;
|
||||
void SetPathType(PathSurfaceIndex newPathType);
|
||||
};
|
||||
assert_struct_size(EntranceElement, 16);
|
||||
|
||||
@@ -587,11 +603,6 @@ enum
|
||||
enum
|
||||
{
|
||||
TILE_ELEMENT_FLAG_GHOST = (1 << 4),
|
||||
TILE_ELEMENT_FLAG_BROKEN = (1 << 5),
|
||||
TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED = (1 << 5),
|
||||
TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE = (1 << 6),
|
||||
TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE = (1 << 6),
|
||||
TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED = (1 << 6),
|
||||
TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7)
|
||||
};
|
||||
|
||||
|
||||
@@ -157,15 +157,15 @@ rct_sprite* get_sprite(size_t sprite_idx)
|
||||
|
||||
bool TileElementBase::IsLastForTile() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
}
|
||||
|
||||
void TileElementBase::SetLastForTile(bool on)
|
||||
{
|
||||
if (on)
|
||||
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
Flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
else
|
||||
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
}
|
||||
|
||||
uint8_t TileElementBase::GetType() const
|
||||
@@ -175,12 +175,12 @@ uint8_t TileElementBase::GetType() const
|
||||
|
||||
bool TileElementBase::IsGhost() const
|
||||
{
|
||||
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
}
|
||||
|
||||
bool TrackElement::BlockBrakeClosed() const
|
||||
{
|
||||
return (flags & TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) != 0;
|
||||
return (Flags2 & TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED) != 0;
|
||||
}
|
||||
|
||||
TileElement* map_get_first_element_at(const CoordsXY& elementPos)
|
||||
@@ -439,7 +439,7 @@ bool TrackElement::IsHighlighted() const
|
||||
|
||||
uint8_t PathElement::GetEdges() const
|
||||
{
|
||||
return edges & 0xF;
|
||||
return Edges & 0xF;
|
||||
}
|
||||
|
||||
StationObject* ride_get_station_object(const Ride* ride)
|
||||
@@ -455,13 +455,13 @@ bool Vehicle::IsGhost() const
|
||||
|
||||
uint8_t TileElementBase::GetOccupiedQuadrants() const
|
||||
{
|
||||
return flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
}
|
||||
|
||||
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
|
||||
{
|
||||
flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
|
||||
Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
|
||||
Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
|
||||
}
|
||||
|
||||
int32_t TileElementBase::GetBaseZ() const
|
||||
|
||||
Reference in new issue
Block a user