OpenRCT2/src/openrct2/world/TileElement.h

715 lines
19 KiB
C
Raw Normal View History

2018-05-01 17:47:00 +02:00
/*****************************************************************************
* Copyright (c) 2014-2023 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2018-05-01 17:47:00 +02:00
#pragma once
2022-04-07 21:42:08 +02:00
#include "../Identifiers.h"
2018-05-01 17:47:00 +02:00
#include "../common.h"
2019-01-12 11:11:55 +01:00
#include "../ride/RideTypes.h"
2020-03-04 18:43:09 +01:00
#include "../ride/Station.h"
2020-02-08 17:42:36 +01:00
#include "Banner.h"
#include "Footpath.h"
2021-12-18 19:43:30 +01:00
#include "tile_element/TileElementType.h"
2018-05-01 17:47:00 +02:00
2019-07-25 18:51:22 +02:00
struct Banner;
struct CoordsXY;
struct LargeSceneryEntry;
2021-06-04 03:14:41 +02:00
struct SmallSceneryEntry;
struct WallSceneryEntry;
struct PathBitEntry;
struct BannerSceneryEntry;
struct FootpathEntry;
class LargeSceneryObject;
class TerrainSurfaceObject;
class TerrainEdgeObject;
class FootpathObject;
class FootpathSurfaceObject;
class FootpathRailingsObject;
using track_type_t = uint16_t;
2020-05-05 11:35:42 +02:00
constexpr const uint8_t MAX_ELEMENT_HEIGHT = 255;
2021-01-29 16:56:33 +01:00
constexpr const uint8_t OWNER_MASK = 0b00001111;
2020-05-05 11:35:42 +02:00
2018-05-01 17:47:00 +02:00
#pragma pack(push, 1)
2021-02-04 16:59:06 +01:00
struct TileElement;
struct SurfaceElement;
struct PathElement;
struct TrackElement;
struct SmallSceneryElement;
struct LargeSceneryElement;
struct WallElement;
struct EntranceElement;
struct BannerElement;
struct TileElementBase
2018-06-22 23:17:03 +02:00
{
uint8_t Type; // 0
uint8_t Flags; // 1. Upper nibble: flags. Lower nibble: occupied quadrants (one bit per quadrant).
uint8_t BaseHeight; // 2
uint8_t ClearanceHeight; // 3
uint8_t Owner; // 4
2019-08-18 14:36:16 +02:00
2020-03-04 21:47:34 +01:00
void Remove();
2021-12-11 00:39:39 +01:00
TileElementType GetType() const;
void SetType(TileElementType newType);
2021-12-03 22:44:34 +01:00
Direction GetDirection() const;
void SetDirection(Direction direction);
Direction GetDirectionWithOffset(uint8_t offset) const;
2020-03-04 21:47:34 +01:00
2018-06-22 23:17:03 +02:00
bool IsLastForTile() const;
void SetLastForTile(bool on);
2018-06-22 23:17:03 +02:00
bool IsGhost() const;
void SetGhost(bool isGhost);
bool IsInvisible() const;
void SetInvisible(bool on);
2020-03-04 21:47:34 +01:00
uint8_t GetOccupiedQuadrants() const;
void SetOccupiedQuadrants(uint8_t quadrants);
2020-03-04 21:47:34 +01:00
int32_t GetBaseZ() const;
void SetBaseZ(int32_t newZ);
2020-03-04 21:47:34 +01:00
int32_t GetClearanceZ() const;
void SetClearanceZ(int32_t newZ);
2021-01-29 16:56:33 +01:00
uint8_t GetOwner() const;
void SetOwner(uint8_t newOwner);
template<typename TType> const TType* as() const
{
2021-02-04 16:59:06 +01:00
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<const TileElement*>(this);
else
2021-12-11 00:39:39 +01:00
return GetType() == TType::ElementType ? reinterpret_cast<const TType*>(this) : nullptr;
}
2021-02-04 16:59:06 +01:00
template<typename TType> TType* as()
{
2021-02-04 16:59:06 +01:00
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<TileElement*>(this);
else
2021-12-11 00:39:39 +01:00
return GetType() == TType::ElementType ? reinterpret_cast<TType*>(this) : nullptr;
}
const SurfaceElement* AsSurface() const
2018-09-13 19:42:33 +02:00
{
return as<SurfaceElement>();
2018-09-13 19:42:33 +02:00
}
SurfaceElement* AsSurface()
{
return as<SurfaceElement>();
}
const PathElement* AsPath() const
2018-09-13 19:42:33 +02:00
{
return as<PathElement>();
2018-09-13 19:42:33 +02:00
}
PathElement* AsPath()
{
return as<PathElement>();
}
const TrackElement* AsTrack() const
{
return as<TrackElement>();
}
TrackElement* AsTrack()
2018-09-13 19:42:33 +02:00
{
return as<TrackElement>();
2018-09-13 19:42:33 +02:00
}
const SmallSceneryElement* AsSmallScenery() const
{
return as<SmallSceneryElement>();
}
SmallSceneryElement* AsSmallScenery()
2018-09-13 19:42:33 +02:00
{
return as<SmallSceneryElement>();
2018-09-13 19:42:33 +02:00
}
const LargeSceneryElement* AsLargeScenery() const
{
return as<LargeSceneryElement>();
}
LargeSceneryElement* AsLargeScenery()
2018-09-13 19:42:33 +02:00
{
return as<LargeSceneryElement>();
2018-09-13 19:42:33 +02:00
}
const WallElement* AsWall() const
{
return as<WallElement>();
}
WallElement* AsWall()
2018-09-13 19:42:33 +02:00
{
return as<WallElement>();
2018-09-13 19:42:33 +02:00
}
const EntranceElement* AsEntrance() const
2018-09-13 19:42:33 +02:00
{
return as<EntranceElement>();
2018-09-13 19:42:33 +02:00
}
EntranceElement* AsEntrance()
{
return as<EntranceElement>();
}
const BannerElement* AsBanner() const
{
return as<BannerElement>();
}
BannerElement* AsBanner()
2018-09-13 19:42:33 +02:00
{
return as<BannerElement>();
2018-09-13 19:42:33 +02:00
}
};
/**
* Map element structure
* size: 0x10
*/
struct TileElement : public TileElementBase
{
2023-01-21 16:39:35 +01:00
uint8_t Pad05[3];
uint8_t Pad08[8];
2018-09-23 14:05:17 +02:00
2021-12-11 00:39:39 +01:00
void ClearAs(TileElementType newType);
2022-01-19 14:17:11 +01:00
RideId GetRideIndex() const;
void SetBannerIndex(BannerIndex newIndex);
void RemoveBannerEntry();
BannerIndex GetBannerIndex() const;
2018-05-01 17:47:00 +02:00
};
2019-08-18 14:03:36 +02:00
assert_struct_size(TileElement, 16);
struct SurfaceElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Surface;
2018-09-14 14:54:12 +02:00
private:
uint8_t Slope;
uint8_t WaterHeight;
uint8_t GrassLength;
uint8_t Ownership;
uint8_t SurfaceStyle;
uint8_t EdgeStyle;
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2023-01-21 16:39:35 +01:00
uint8_t Pad0B[5];
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic pop
2018-09-14 14:54:12 +02:00
public:
uint8_t GetSlope() const;
void SetSlope(uint8_t newSlope);
uint32_t GetSurfaceStyle() const;
TerrainSurfaceObject* GetSurfaceStyleObject() const;
2018-09-14 14:54:12 +02:00
void SetSurfaceStyle(uint32_t newStyle);
uint32_t GetEdgeStyle() const;
TerrainEdgeObject* GetEdgeStyleObject() const;
2018-09-14 14:54:12 +02:00
void SetEdgeStyle(uint32_t newStyle);
bool CanGrassGrow() const;
2018-09-14 14:54:12 +02:00
uint8_t GetGrassLength() const;
void SetGrassLength(uint8_t newLength);
void SetGrassLengthAndInvalidate(uint8_t newLength, const CoordsXY& coords);
void UpdateGrassLength(const CoordsXY& coords);
2018-09-14 14:54:12 +02:00
uint8_t GetOwnership() const;
void SetOwnership(uint8_t newOwnership);
int32_t GetWaterHeight() const;
void SetWaterHeight(int32_t newWaterHeight);
2018-09-14 14:54:12 +02:00
uint8_t GetParkFences() const;
void SetParkFences(uint8_t newParkFences);
bool HasTrackThatNeedsWater() const;
void SetHasTrackThatNeedsWater(bool on);
};
2019-08-18 14:03:36 +02:00
assert_struct_size(SurfaceElement, 16);
struct PathElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Path;
2018-09-16 16:17:35 +02:00
private:
ObjectEntryIndex SurfaceIndex; // 5
ObjectEntryIndex RailingsIndex; // 7
uint8_t Additions; // 9 (0 means no addition)
uint8_t EdgesAndCorners; // 10 (edges in lower 4 bits, corners in upper 4)
uint8_t Flags2; // 11
uint8_t SlopeDirection; // 12
union
{
uint8_t AdditionStatus; // 13, only used for litter bins
2022-01-19 17:36:26 +01:00
RideId rideIndex; // 13
};
::StationIndex StationIndex; // 15
public:
ObjectEntryIndex GetLegacyPathEntryIndex() const;
const FootpathObject* GetLegacyPathEntry() const;
void SetLegacyPathEntryIndex(ObjectEntryIndex newIndex);
bool HasLegacyPathEntry() const;
ObjectEntryIndex GetSurfaceEntryIndex() const;
const FootpathSurfaceObject* GetSurfaceEntry() const;
void SetSurfaceEntryIndex(ObjectEntryIndex newIndex);
ObjectEntryIndex GetRailingsEntryIndex() const;
const FootpathRailingsObject* GetRailingsEntry() const;
void SetRailingsEntryIndex(ObjectEntryIndex newIndex);
2019-01-02 19:52:53 +01:00
const PathSurfaceDescriptor* GetSurfaceDescriptor() const;
const PathRailingsDescriptor* GetRailingsDescriptor() const;
uint8_t GetQueueBannerDirection() const;
void SetQueueBannerDirection(uint8_t direction);
bool IsSloped() const;
void SetSloped(bool isSloped);
bool HasJunctionRailings() const;
void SetJunctionRailings(bool hasJunctionRailings);
Direction GetSlopeDirection() const;
void SetSlopeDirection(Direction newSlope);
2022-01-19 14:17:11 +01:00
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
2020-03-04 18:43:09 +01:00
::StationIndex GetStationIndex() const;
void SetStationIndex(::StationIndex newStationIndex);
bool IsWide() const;
void SetWide(bool isWide);
2018-10-03 21:45:52 +02:00
2018-10-03 10:57:29 +02:00
bool IsQueue() const;
void SetIsQueue(bool isQueue);
bool HasQueueBanner() const;
void SetHasQueueBanner(bool hasQueueBanner);
2018-10-03 10:57:29 +02:00
bool IsBroken() const;
void SetIsBroken(bool isBroken);
bool IsBlockedByVehicle() const;
void SetIsBlockedByVehicle(bool isBlocked);
uint8_t GetEdges() const;
void SetEdges(uint8_t newEdges);
uint8_t GetCorners() const;
void SetCorners(uint8_t newCorners);
uint8_t GetEdgesAndCorners() const;
void SetEdgesAndCorners(uint8_t newEdgesAndCorners);
bool HasAddition() const;
uint8_t GetAddition() const;
ObjectEntryIndex GetAdditionEntryIndex() const;
const PathBitEntry* GetAdditionEntry() const;
void SetAddition(uint8_t newAddition);
bool AdditionIsGhost() const;
void SetAdditionIsGhost(bool isGhost);
2018-10-03 21:45:52 +02:00
uint8_t GetAdditionStatus() const;
void SetAdditionStatus(uint8_t newStatus);
bool ShouldDrawPathOverSupports() const;
void SetShouldDrawPathOverSupports(bool on);
bool IsLevelCrossing(const CoordsXY& coords) const;
};
2019-08-18 14:03:36 +02:00
assert_struct_size(PathElement, 16);
struct TrackElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Track;
2019-08-31 13:14:19 +02:00
private:
track_type_t TrackType;
union
{
2022-01-27 11:04:33 +01:00
struct
{
2019-08-31 13:14:19 +02:00
uint8_t Sequence;
uint8_t ColourScheme;
union
{
// - Bits 3 and 4 are never set
// - Bits 1 and 2 are set when a vehicle triggers the on-ride photo and act like a countdown from 3.
// - If any of the bits 1-4 are set, the game counts it as a photo being taken.
uint8_t OnridePhotoBits;
// Contains the brake/booster speed, divided by 2.
uint8_t BrakeBoosterSpeed;
};
StationIndex stationIndex;
} URide;
2022-01-27 11:04:33 +01:00
struct
2019-08-31 13:14:19 +02:00
{
2021-01-29 16:56:33 +01:00
uint16_t MazeEntry; // 6
} UMaze;
};
2019-08-31 13:14:19 +02:00
uint8_t Flags2;
2022-01-19 14:17:11 +01:00
RideId RideIndex;
2021-09-19 21:02:24 +02:00
ride_type_t RideType;
2018-09-23 11:55:37 +02:00
public:
2019-08-31 13:14:19 +02:00
track_type_t GetTrackType() const;
void SetTrackType(track_type_t newEntryIndex);
2018-09-23 11:55:37 +02:00
2021-09-19 21:02:24 +02:00
ride_type_t GetRideType() const;
void SetRideType(const ride_type_t rideType);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
2018-09-23 11:55:37 +02:00
2022-01-19 14:17:11 +01:00
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
2018-09-23 11:55:37 +02:00
uint8_t GetColourScheme() const;
void SetColourScheme(uint8_t newColourScheme);
2018-09-23 11:55:37 +02:00
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
2018-09-18 13:01:09 +02:00
bool HasChain() const;
void SetHasChain(bool on);
bool HasCableLift() const;
void SetHasCableLift(bool on);
bool IsInverted() const;
void SetInverted(bool inverted);
bool IsBrakeClosed() const;
void SetBrakeClosed(bool isClosed);
bool IsIndestructible() const;
void SetIsIndestructible(bool isIndestructible);
uint8_t GetBrakeBoosterSpeed() const;
void SetBrakeBoosterSpeed(uint8_t speed);
2019-08-31 13:14:19 +02:00
bool HasGreenLight() const;
void SetHasGreenLight(bool on);
uint8_t GetSeatRotation() const;
void SetSeatRotation(uint8_t newSeatRotation);
2018-09-18 13:49:58 +02:00
uint16_t GetMazeEntry() const;
void SetMazeEntry(uint16_t newMazeEntry);
void MazeEntryAdd(uint16_t addVal);
void MazeEntrySubtract(uint16_t subVal);
2018-09-18 13:49:58 +02:00
bool IsTakingPhoto() const;
void SetPhotoTimeout();
void SetPhotoTimeout(uint8_t newValue);
2018-09-18 13:49:58 +02:00
void DecrementPhotoTimeout();
2019-08-18 18:18:44 +02:00
uint8_t GetPhotoTimeout() const;
2018-09-23 11:55:37 +02:00
bool IsHighlighted() const;
void SetHighlight(bool on);
2019-08-31 13:14:19 +02:00
// Used by ghost train, RCT1 feature, will be reintroduced at some point.
// (See https://github.com/OpenRCT2/OpenRCT2/issues/7059)
uint8_t GetDoorAState() const;
uint8_t GetDoorBState() const;
2019-08-31 13:14:19 +02:00
void SetDoorAState(uint8_t newState);
void SetDoorBState(uint8_t newState);
bool IsStation() const;
bool IsBlockStart() const;
};
2019-08-18 14:03:36 +02:00
assert_struct_size(TrackElement, 16);
struct SmallSceneryElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::SmallScenery;
private:
2021-01-29 16:56:33 +01:00
ObjectEntryIndex entryIndex; // 5
uint8_t age; // 7
uint8_t Colour[3]; // 8
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2023-01-21 16:39:35 +01:00
uint8_t Pad0B[5];
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic pop
public:
2020-03-20 19:28:39 +01:00
ObjectEntryIndex GetEntryIndex() const;
void SetEntryIndex(ObjectEntryIndex newIndex);
const SmallSceneryEntry* GetEntry() const;
uint8_t GetAge() const;
void SetAge(uint8_t newAge);
void IncreaseAge(const CoordsXY& sceneryPos);
uint8_t GetSceneryQuadrant() const;
void SetSceneryQuadrant(uint8_t newQuadrant);
colour_t GetPrimaryColour() const;
void SetPrimaryColour(colour_t colour);
colour_t GetSecondaryColour() const;
void SetSecondaryColour(colour_t colour);
colour_t GetTertiaryColour() const;
void SetTertiaryColour(colour_t colour);
bool NeedsSupports() const;
void SetNeedsSupports();
void UpdateAge(const CoordsXY& sceneryPos);
};
2019-08-18 14:03:36 +02:00
assert_struct_size(SmallSceneryElement, 16);
struct LargeSceneryElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::LargeScenery;
2018-09-14 12:12:22 +02:00
private:
ObjectEntryIndex EntryIndex;
2020-02-08 17:42:36 +01:00
::BannerIndex BannerIndex;
uint8_t SequenceIndex;
uint8_t Colour[3];
2020-03-04 21:47:34 +01:00
uint8_t Flags2;
2020-02-15 11:18:27 +01:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2021-01-29 16:56:33 +01:00
uint8_t pad[2];
2020-02-15 11:18:27 +01:00
#pragma clang diagnostic pop
2018-09-14 12:12:22 +02:00
public:
ObjectEntryIndex GetEntryIndex() const;
void SetEntryIndex(ObjectEntryIndex newIndex);
const LargeSceneryEntry* GetEntry() const;
const LargeSceneryObject* GetObject() const;
2018-09-14 12:12:22 +02:00
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newIndex);
2018-09-14 12:12:22 +02:00
colour_t GetPrimaryColour() const;
void SetPrimaryColour(colour_t colour);
colour_t GetSecondaryColour() const;
void SetSecondaryColour(colour_t colour);
colour_t GetTertiaryColour() const;
void SetTertiaryColour(colour_t colour);
2018-09-14 12:12:22 +02:00
2019-07-25 18:51:22 +02:00
Banner* GetBanner() const;
::BannerIndex GetBannerIndex() const;
void SetBannerIndex(::BannerIndex newIndex);
bool IsAccounted() const;
void SetIsAccounted(bool isAccounted);
};
2019-08-18 14:03:36 +02:00
assert_struct_size(LargeSceneryElement, 16);
struct WallElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Wall;
2018-09-17 16:12:11 +02:00
private:
2021-01-29 16:56:33 +01:00
ObjectEntryIndex entryIndex; // 05
colour_t colour_1; // 07
colour_t colour_2; // 08
colour_t colour_3; // 09
BannerIndex banner_index; // 0A
uint8_t animation; // 0C 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2023-01-21 16:39:35 +01:00
uint8_t Pad0D[3];
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic pop
2018-09-13 19:42:33 +02:00
public:
2020-02-08 11:55:57 +01:00
uint16_t GetEntryIndex() const;
void SetEntryIndex(uint16_t newIndex);
const WallSceneryEntry* GetEntry() const;
uint8_t GetSlope() const;
void SetSlope(uint8_t newslope);
colour_t GetPrimaryColour() const;
void SetPrimaryColour(colour_t newColour);
colour_t GetSecondaryColour() const;
void SetSecondaryColour(colour_t newColour);
colour_t GetTertiaryColour() const;
void SetTertiaryColour(colour_t newColour);
uint8_t GetAnimationFrame() const;
void SetAnimationFrame(uint8_t frameNum);
2019-07-25 18:51:22 +02:00
Banner* GetBanner() const;
BannerIndex GetBannerIndex() const;
void SetBannerIndex(BannerIndex newIndex);
bool IsAcrossTrack() const;
void SetAcrossTrack(bool acrossTrack);
bool AnimationIsBackwards() const;
void SetAnimationIsBackwards(bool isBackwards);
};
2019-08-18 14:03:36 +02:00
assert_struct_size(WallElement, 16);
struct EntranceElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Entrance;
2018-09-26 12:02:41 +02:00
private:
2021-01-29 16:56:33 +01:00
uint8_t entranceType; // 5
uint8_t SequenceIndex; // 6. Only uses the lower nibble.
StationIndex stationIndex; // 7
ObjectEntryIndex PathType; // 8
2022-01-19 17:36:26 +01:00
RideId rideIndex; // A
uint8_t flags2; // C
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2023-01-21 16:39:35 +01:00
uint8_t Pad0D[3];
2019-08-18 19:53:01 +02:00
#pragma clang diagnostic pop
2018-09-23 11:55:37 +02:00
public:
2018-09-26 12:13:44 +02:00
uint8_t GetEntranceType() const;
void SetEntranceType(uint8_t newType);
2022-01-19 14:17:11 +01:00
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
2018-09-26 12:30:27 +02:00
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
2018-09-26 13:02:51 +02:00
bool HasLegacyPathEntry() const;
ObjectEntryIndex GetLegacyPathEntryIndex() const;
const FootpathObject* GetLegacyPathEntry() const;
void SetLegacyPathEntryIndex(ObjectEntryIndex newPathType);
ObjectEntryIndex GetSurfaceEntryIndex() const;
const FootpathSurfaceObject* GetSurfaceEntry() const;
void SetSurfaceEntryIndex(ObjectEntryIndex newIndex);
const PathSurfaceDescriptor* GetPathSurfaceDescriptor() const;
int32_t GetDirections() const;
};
2019-08-18 14:03:36 +02:00
assert_struct_size(EntranceElement, 16);
struct BannerElement : TileElementBase
{
2021-12-11 00:39:39 +01:00
static constexpr TileElementType ElementType = TileElementType::Banner;
2018-09-26 14:07:04 +02:00
private:
2021-01-29 16:56:33 +01:00
BannerIndex index; // 5
uint8_t position; // 7
uint8_t AllowedEdges; // 8
2018-09-26 14:07:04 +02:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
2023-01-21 16:39:35 +01:00
uint8_t Pad09[7];
2018-09-26 14:07:04 +02:00
#pragma clang diagnostic pop
public:
2019-07-25 18:51:22 +02:00
Banner* GetBanner() const;
const BannerSceneryEntry* GetEntry() const;
2019-07-25 18:51:22 +02:00
2018-09-26 14:07:04 +02:00
BannerIndex GetIndex() const;
void SetIndex(BannerIndex newIndex);
2018-09-26 14:52:16 +02:00
uint8_t GetPosition() const;
void SetPosition(uint8_t newPosition);
uint8_t GetAllowedEdges() const;
void SetAllowedEdges(uint8_t newEdges);
void ResetAllowedEdges();
};
2019-08-18 14:03:36 +02:00
assert_struct_size(BannerElement, 16);
2018-05-01 17:47:00 +02:00
#pragma pack(pop)
class QuarterTile
{
private:
uint8_t _val{ 0 };
public:
constexpr QuarterTile(uint8_t tileQuarter, uint8_t zQuarter)
: _val(tileQuarter | (zQuarter << 4))
{
}
QuarterTile(uint8_t tileAndZQuarter)
: _val(tileAndZQuarter)
{
}
// Rotate both of the values amount. Returns new RValue QuarterTile
const QuarterTile Rotate(uint8_t amount) const;
uint8_t GetBaseQuarterOccupied() const
{
return _val & 0xF;
}
uint8_t GetZQuarterOccupied() const
{
return (_val >> 4) & 0xF;
}
};
2018-06-22 23:17:03 +02:00
enum
{
2018-05-01 17:47:00 +02:00
TILE_ELEMENT_QUADRANT_SW,
TILE_ELEMENT_QUADRANT_NW,
TILE_ELEMENT_QUADRANT_NE,
TILE_ELEMENT_QUADRANT_SE
};
2018-06-22 23:17:03 +02:00
enum
{
SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER = (1 << 6),
2018-05-01 17:47:00 +02:00
};
2018-06-22 23:17:03 +02:00
enum
{
2018-05-01 17:47:00 +02:00
TILE_ELEMENT_DIRECTION_WEST,
TILE_ELEMENT_DIRECTION_NORTH,
TILE_ELEMENT_DIRECTION_EAST,
TILE_ELEMENT_DIRECTION_SOUTH
};
2018-06-22 23:17:03 +02:00
enum
{
2018-05-01 17:47:00 +02:00
TILE_ELEMENT_FLAG_GHOST = (1 << 4),
TILE_ELEMENT_FLAG_INVISIBLE = (1 << 5),
2018-05-01 17:47:00 +02:00
TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7)
};
2018-06-22 23:17:03 +02:00
enum
{
2018-05-01 17:47:00 +02:00
ENTRANCE_TYPE_RIDE_ENTRANCE,
ENTRANCE_TYPE_RIDE_EXIT,
ENTRANCE_TYPE_PARK_ENTRANCE
};
2018-06-22 23:17:03 +02:00
enum
{
2018-05-01 17:47:00 +02:00
ELEMENT_IS_ABOVE_GROUND = 1 << 0,
ELEMENT_IS_UNDERGROUND = 1 << 1,
ELEMENT_IS_UNDERWATER = 1 << 2,
};
enum
{
MAP_ELEM_TRACK_SEQUENCE_GREEN_LIGHT = (1 << 7),
};
2018-06-22 23:17:03 +02:00
#define TILE_ELEMENT_QUADRANT_MASK 0b11000000
#define TILE_ELEMENT_TYPE_MASK 0b00111100
2018-05-02 13:30:15 +02:00
#define TILE_ELEMENT_DIRECTION_MASK 0b00000011
#define TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK 0b00001111
2018-05-01 17:47:00 +02:00
2018-06-22 23:17:03 +02:00
#define TILE_ELEMENT_COLOUR_MASK 0b00011111
2018-05-01 17:47:00 +02:00
enum
{
LANDSCAPE_DOOR_CLOSED = 0,
LANDSCAPE_DOOR_HALF_OPEN = 2,
LANDSCAPE_DOOR_OPEN = 3,
};
bool TileElementIsUnderground(TileElement* tileElement);