1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 16:24:35 +01:00

Move tile elements into OpenRCT2 namespace (#24991)

This commit is contained in:
Aaron van Geffen
2025-08-17 16:50:12 +02:00
committed by GitHub
parent f1d7366e0b
commit ae5cee3879
62 changed files with 2371 additions and 2281 deletions

View File

@@ -10,7 +10,10 @@
#pragma once
#include <openrct2/world/Location.hpp>
struct TileElement;
namespace OpenRCT2
{
struct TileElement;
}
namespace OpenRCT2::Ui
{

View File

@@ -21,7 +21,6 @@ struct OpenRCT2String;
struct Peep;
struct Ride;
struct RideSelection;
struct TileElement;
struct TrackDesign;
struct Vehicle;
@@ -34,7 +33,8 @@ using ScenarioSelectCallback = void (*)(const utf8* path);
namespace OpenRCT2
{
struct ObjectEntryDescriptor;
}
struct TileElement;
} // namespace OpenRCT2
namespace OpenRCT2::Ui::Windows
{

View File

@@ -36,5 +36,5 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
PathElement* GetValidPathElement() const;
OpenRCT2::PathElement* GetValidPathElement() const;
};

View File

@@ -29,5 +29,5 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
BannerElement* GetBannerElementAt() const;
OpenRCT2::BannerElement* GetBannerElementAt() const;
};

View File

@@ -39,5 +39,5 @@ public:
private:
OpenRCT2::GameActions::Result ElementInsertQuery(OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementInsertExecute(OpenRCT2::GameActions::Result res) const;
bool IsSameAsEntranceElement(const EntranceElement& entranceElement) const;
bool IsSameAsEntranceElement(const OpenRCT2::EntranceElement& entranceElement) const;
};

View File

@@ -36,13 +36,15 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
OpenRCT2::GameActions::Result ElementUpdateQuery(PathElement* pathElement, OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementUpdateExecute(PathElement* pathElement, OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementUpdateQuery(
OpenRCT2::PathElement* pathElement, OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementUpdateExecute(
OpenRCT2::PathElement* pathElement, OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementInsertQuery(OpenRCT2::GameActions::Result res) const;
OpenRCT2::GameActions::Result ElementInsertExecute(OpenRCT2::GameActions::Result res) const;
void AutomaticallySetPeepSpawn() const;
void RemoveIntersectingWalls(PathElement* pathElement) const;
PathElement* MapGetFootpathElementSlope(const CoordsXYZ& footpathPos, int32_t slope) const;
bool IsSameAsPathElement(const PathElement* pathElement) const;
bool IsSameAsEntranceElement(const EntranceElement& entranceElement) const;
void RemoveIntersectingWalls(OpenRCT2::PathElement* pathElement) const;
OpenRCT2::PathElement* MapGetFootpathElementSlope(const CoordsXYZ& footpathPos, int32_t slope) const;
bool IsSameAsPathElement(const OpenRCT2::PathElement* pathElement) const;
bool IsSameAsEntranceElement(const OpenRCT2::EntranceElement& entranceElement) const;
};

View File

@@ -30,7 +30,7 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
TileElement* GetFootpathElement() const;
money64 GetRefundPrice(TileElement* footpathElement) const;
OpenRCT2::GameActions::Result RemoveBannersAtElement(const CoordsXY& loc, TileElement* tileElement) const;
OpenRCT2::TileElement* GetFootpathElement() const;
money64 GetRefundPrice(OpenRCT2::TileElement* footpathElement) const;
OpenRCT2::GameActions::Result RemoveBannersAtElement(const CoordsXY& loc, OpenRCT2::TileElement* tileElement) const;
};

View File

@@ -32,19 +32,19 @@ public:
private:
StringId CheckParameters() const;
TileElement* CheckTreeObstructions() const;
OpenRCT2::TileElement* CheckTreeObstructions() const;
money64 GetSmallSceneryRemovalCost() const;
void SmallSceneryRemoval() const;
StringId CheckRideSupports() const;
TileElement* CheckFloatingStructures(TileElement* surfaceElement, uint8_t zCorner) const;
money64 GetSurfaceHeightChangeCost(SurfaceElement* surfaceElement) const;
void SetSurfaceHeight(TileElement* surfaceElement) const;
OpenRCT2::TileElement* CheckFloatingStructures(OpenRCT2::TileElement* surfaceElement, uint8_t zCorner) const;
money64 GetSurfaceHeightChangeCost(OpenRCT2::SurfaceElement* surfaceElement) const;
void SetSurfaceHeight(OpenRCT2::TileElement* surfaceElement) const;
/**
*
* rct2: 0x00663CB9
*/
static int32_t MapSetLandHeightClearFunc(
TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags,
OpenRCT2::TileElement** tile_element, [[maybe_unused]] const CoordsXY& coords, [[maybe_unused]] uint8_t flags,
[[maybe_unused]] money64* price);
};

View File

@@ -38,7 +38,7 @@ public:
private:
OpenRCT2::GameActions::Result SmoothLandTile(
int32_t direction, bool isExecuting, const CoordsXY& loc, SurfaceElement* surfaceElement) const;
int32_t direction, bool isExecuting, const CoordsXY& loc, OpenRCT2::SurfaceElement* surfaceElement) const;
money64 SmoothLandRowByEdge(
bool isExecuting, const CoordsXY& loc, int32_t expectedLandHeight1, int32_t expectedLandHeight2, int32_t stepX,
int32_t stepY, int32_t direction1, int32_t direction2, int32_t checkDirection1, int32_t checkDirection2) const;

View File

@@ -21,9 +21,8 @@ struct LargeSceneryPlaceActionResult
namespace OpenRCT2
{
struct LargeSceneryTile;
}
struct LargeSceneryElement;
struct LargeSceneryElement;
} // namespace OpenRCT2
class LargeSceneryPlaceAction final : public GameActionBase<GameCommand::PlaceLargeScenery>
{
@@ -52,5 +51,5 @@ public:
private:
bool CheckMapCapacity(std::span<const OpenRCT2::LargeSceneryTile> tiles, size_t numTiles) const;
int16_t GetMaxSurfaceHeight(std::span<const OpenRCT2::LargeSceneryTile> tiles) const;
void SetNewLargeSceneryElement(LargeSceneryElement& sceneryElement, uint8_t tileNum) const;
void SetNewLargeSceneryElement(OpenRCT2::LargeSceneryElement& sceneryElement, uint8_t tileNum) const;
};

View File

@@ -30,5 +30,5 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
TileElement* FindLargeSceneryElement(const CoordsXYZ& pos, int32_t sequenceIndex) const;
OpenRCT2::TileElement* FindLargeSceneryElement(const CoordsXYZ& pos, int32_t sequenceIndex) const;
};

View File

@@ -31,5 +31,5 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
TileElement* FindSceneryElement() const;
OpenRCT2::TileElement* FindSceneryElement() const;
};

View File

@@ -49,13 +49,13 @@ private:
TileModifyType _setting{};
uint32_t _value1{};
uint32_t _value2{};
TileElement _pasteElement{};
OpenRCT2::TileElement _pasteElement{};
Banner _pasteBanner{};
public:
TileModifyAction() = default;
TileModifyAction(
CoordsXY loc, TileModifyType setting, uint32_t value1 = 0, uint32_t value2 = 0, TileElement pasteElement = {},
CoordsXY loc, TileModifyType setting, uint32_t value1 = 0, uint32_t value2 = 0, OpenRCT2::TileElement pasteElement = {},
Banner _pasteBanner = {});
void AcceptParameters(GameActionParameterVisitor& visitor) override;

View File

@@ -26,5 +26,5 @@ public:
OpenRCT2::GameActions::Result Execute() const override;
private:
TileElement* GetFirstWallElementAt(const CoordsXYZD& location, bool isGhost) const;
OpenRCT2::TileElement* GetFirstWallElementAt(const CoordsXYZD& location, bool isGhost) const;
};

View File

@@ -447,9 +447,9 @@ struct DataSerializerTraitsT<MapRange>
};
template<>
struct DataSerializerTraitsT<TileElement>
struct DataSerializerTraitsT<OpenRCT2::TileElement>
{
static void encode(OpenRCT2::IStream* stream, const TileElement& tileElement)
static void encode(OpenRCT2::IStream* stream, const OpenRCT2::TileElement& tileElement)
{
stream->WriteValue(tileElement.Type);
stream->WriteValue(tileElement.Flags);
@@ -465,7 +465,7 @@ struct DataSerializerTraitsT<TileElement>
stream->WriteValue(v);
}
}
static void decode(OpenRCT2::IStream* stream, TileElement& tileElement)
static void decode(OpenRCT2::IStream* stream, OpenRCT2::TileElement& tileElement)
{
tileElement.Type = stream->ReadValue<uint8_t>();
tileElement.Flags = stream->ReadValue<uint8_t>();
@@ -481,7 +481,7 @@ struct DataSerializerTraitsT<TileElement>
v = stream->ReadValue<uint8_t>();
}
}
static void log(OpenRCT2::IStream* stream, const TileElement& tileElement)
static void log(OpenRCT2::IStream* stream, const OpenRCT2::TileElement& tileElement)
{
char msg[128] = {};
snprintf(

View File

@@ -19,6 +19,8 @@
#include "../world/tile_element/TrackElement.h"
#include "EntityRegistry.h"
using namespace OpenRCT2;
template<>
bool EntityBase::Is<Balloon>() const
{

View File

@@ -48,7 +48,7 @@ struct JumpingFountain : EntityBase
int16_t TargetY;
uint16_t Iteration;
void Update();
static void StartAnimation(JumpingFountainType newType, const CoordsXY& newLoc, const TileElement* tileElement);
static void StartAnimation(JumpingFountainType newType, const CoordsXY& newLoc, const OpenRCT2::TileElement* tileElement);
void Serialise(DataSerialiser& stream);
void Paint(PaintSession& session, int32_t imageDirection) const;

View File

@@ -29,9 +29,13 @@ constexpr uint8_t kPeepMaxEnergyTarget = 255; // Oddly, this differs from max en
constexpr auto kPeepClearanceHeight = 4 * kCoordsZStep;
class Formatter;
struct TileElement;
struct PaintSession;
namespace OpenRCT2
{
struct TileElement;
}
namespace OpenRCT2::GameActions
{
class Result;
@@ -402,7 +406,7 @@ public: // Peep
bool ShouldWaitForLevelCrossing() const;
bool IsOnLevelCrossing() const;
bool IsOnPathBlockedByVehicle() const;
std::pair<uint8_t, TileElement*> PerformNextAction();
std::pair<uint8_t, OpenRCT2::TileElement*> PerformNextAction();
[[nodiscard]] int32_t GetZOnSlope(int32_t tile_x, int32_t tile_y);
void SwitchNextAnimationType();
[[nodiscard]] PeepAnimationType GetAnimationType();

View File

@@ -69,7 +69,7 @@ public:
void SetHireDate(int32_t hireDate);
int32_t GetHireDate() const;
bool CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) const;
bool CanIgnoreWideFlag(const CoordsXYZ& staffPos, OpenRCT2::TileElement* path) const;
static void ResetStats();
void Serialise(DataSerialiser& stream);
@@ -118,10 +118,10 @@ private:
Direction HandymanDirectionToNearestLitter() const;
uint8_t HandymanDirectionToUncutGrass(uint8_t valid_directions) const;
Direction DirectionSurface(Direction initialDirection) const;
Direction DirectionPath(uint8_t validDirections, PathElement* pathElement) const;
Direction DirectionPath(uint8_t validDirections, OpenRCT2::PathElement* pathElement) const;
Direction MechanicDirectionSurface() const;
Direction MechanicDirectionPathRand(uint8_t pathDirections) const;
Direction MechanicDirectionPath(uint8_t validDirections, PathElement* pathElement);
Direction MechanicDirectionPath(uint8_t validDirections, OpenRCT2::PathElement* pathElement);
bool UpdatePatrollingFindWatering();
bool UpdatePatrollingFindBin();
bool UpdatePatrollingFindSweeping();

View File

@@ -20,7 +20,6 @@
struct PaintSession;
struct PaintStruct;
struct RenderTarget;
struct TileElement;
struct EntityBase;
struct Guest;
struct Staff;
@@ -28,6 +27,7 @@ struct PaintEntry;
namespace OpenRCT2
{
struct TileElement;
struct WindowBase;
struct Viewport

View File

@@ -23,11 +23,15 @@
#include <thread>
struct EntityBase;
struct TileElement;
struct SurfaceElement;
enum class RailingEntrySupportType : uint8_t;
enum class ViewportInteractionItem : uint8_t;
namespace OpenRCT2
{
struct TileElement;
struct SurfaceElement;
} // namespace OpenRCT2
struct AttachedPaintStruct
{
AttachedPaintStruct* NextEntry;
@@ -54,7 +58,7 @@ struct PaintStruct
AttachedPaintStruct* Attached;
PaintStruct* Children;
PaintStruct* NextQuadrantEntry;
TileElement* Element;
OpenRCT2::TileElement* Element;
EntityBase* Entity;
ImageId image_id;
ScreenCoordsXY ScreenPos;
@@ -132,12 +136,12 @@ struct PaintSessionCore
PaintStringStruct* PSStringHead;
PaintStringStruct* LastPSString;
AttachedPaintStruct* LastAttachedPS;
const SurfaceElement* Surface;
const OpenRCT2::SurfaceElement* Surface;
EntityBase* CurrentlyDrawnEntity;
TileElement* CurrentlyDrawnTileElement;
const TileElement* PathElementOnSameHeight;
const TileElement* TrackElementOnSameHeight;
const TileElement* SelectedElement;
OpenRCT2::TileElement* CurrentlyDrawnTileElement;
const OpenRCT2::TileElement* PathElementOnSameHeight;
const OpenRCT2::TileElement* TrackElementOnSameHeight;
const OpenRCT2::TileElement* SelectedElement;
PaintStruct* WoodenSupportsPrependTo;
CoordsXY SpritePosition;
CoordsXY MapPosition;

View File

@@ -15,5 +15,5 @@
#include <cstdint>
void Sub6A3F61PathAddition(
PaintSession& session, const PathElement& pathElement, uint16_t height, ImageId sceneryImageTemplate);
void PaintLampLightEffects(PaintSession& session, const PathElement& pathEl, uint16_t height);
PaintSession& session, const OpenRCT2::PathElement& pathElement, uint16_t height, ImageId sceneryImageTemplate);
void PaintLampLightEffects(PaintSession& session, const OpenRCT2::PathElement& pathEl, uint16_t height);

View File

@@ -40,13 +40,15 @@ uint16_t PaintUtilRotateSegments(uint16_t segments, uint8_t rotation);
void TileElementPaintSetup(PaintSession& session, const CoordsXY& mapCoords, bool isTrackPiecePreview = false);
void PaintEntrance(PaintSession& session, uint8_t direction, int32_t height, const EntranceElement& entranceElement);
void PaintBanner(PaintSession& session, uint8_t direction, int32_t height, const BannerElement& bannerElement);
void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, const SurfaceElement& tileElement);
void PaintPath(PaintSession& session, uint16_t height, const PathElement& tileElement);
void PaintSmallScenery(PaintSession& session, uint8_t direction, int32_t height, const SmallSceneryElement& sceneryElement);
void PaintWall(PaintSession& session, uint8_t direction, int32_t height, const WallElement& tileElement);
void PaintLargeScenery(PaintSession& session, uint8_t direction, uint16_t height, const LargeSceneryElement& tileElement);
void PaintTrack(PaintSession& session, uint8_t direction, int32_t height, const TrackElement& tileElement);
void PaintEntrance(PaintSession& session, uint8_t direction, int32_t height, const OpenRCT2::EntranceElement& entranceElement);
void PaintBanner(PaintSession& session, uint8_t direction, int32_t height, const OpenRCT2::BannerElement& bannerElement);
void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, const OpenRCT2::SurfaceElement& tileElement);
void PaintPath(PaintSession& session, uint16_t height, const OpenRCT2::PathElement& tileElement);
void PaintSmallScenery(
PaintSession& session, uint8_t direction, int32_t height, const OpenRCT2::SmallSceneryElement& sceneryElement);
void PaintWall(PaintSession& session, uint8_t direction, int32_t height, const OpenRCT2::WallElement& tileElement);
void PaintLargeScenery(
PaintSession& session, uint8_t direction, uint16_t height, const OpenRCT2::LargeSceneryElement& tileElement);
void PaintTrack(PaintSession& session, uint8_t direction, int32_t height, const OpenRCT2::TrackElement& tileElement);
bool PaintShouldShowHeightMarkers(const PaintSession& session, const uint32_t viewportFlag);

View File

@@ -14,32 +14,36 @@
struct PaintSession;
struct Ride;
struct SupportType;
struct TrackElement;
namespace OpenRCT2
{
struct TrackElement;
}
void TwisterRCTrackBooster(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackDiagBrakes(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackDiagBlockBrakes(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackFlatTo60DegUpLongBase(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrack60DegUpToFlatLongBase(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackLeftLargeHalfLoopUp(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackRightLargeHalfLoopUp(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackLeftLargeHalfLoopDown(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TwisterRCTrackRightLargeHalfLoopDown(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);

View File

@@ -16,7 +16,11 @@
struct Peep;
struct Guest;
struct TileElement;
namespace OpenRCT2
{
struct TileElement;
}
namespace OpenRCT2::PathFinding
{

View File

@@ -561,7 +561,7 @@ enum class RCT12TileElementType : uint8_t
EightCarsCorrupt15 = 15,
};
constexpr TileElementType ToOpenRCT2TileElementType(RCT12TileElementType rct12type)
constexpr OpenRCT2::TileElementType ToOpenRCT2TileElementType(RCT12TileElementType rct12type)
{
switch (rct12type)
{
@@ -573,7 +573,7 @@ constexpr TileElementType ToOpenRCT2TileElementType(RCT12TileElementType rct12ty
case RCT12TileElementType::Wall:
case RCT12TileElementType::LargeScenery:
case RCT12TileElementType::Banner:
return static_cast<TileElementType>(rct12type);
return static_cast<OpenRCT2::TileElementType>(rct12type);
default:
throw std::runtime_error(

View File

@@ -44,6 +44,8 @@
#include <iostream>
using namespace OpenRCT2;
static bool _dryRun = false;
// Generic keys
@@ -100,7 +102,7 @@ static u8string ToOwnershipJsonKey(int ownershipType)
case OWNERSHIP_AVAILABLE:
return "available";
}
OpenRCT2::Guard::Assert(0, "Unrecognized ownership type flag");
Guard::Assert(0, "Unrecognized ownership type flag");
return {};
}
@@ -108,25 +110,24 @@ static void readCoordinate(std::vector<TileCoordsXY>& out, const json_t& coordin
{
if (coordinatesArray.size() != 2)
{
OpenRCT2::Guard::Assert(0, "Fix coordinates sub array should have 2 elements");
Guard::Assert(0, "Fix coordinates sub array should have 2 elements");
return;
}
out.emplace_back(
OpenRCT2::Json::GetNumber<int32_t>(coordinatesArray[0]), OpenRCT2::Json::GetNumber<int32_t>(coordinatesArray[1]));
out.emplace_back(Json::GetNumber<int32_t>(coordinatesArray[0]), Json::GetNumber<int32_t>(coordinatesArray[1]));
}
static void readCoordinate(std::vector<TileCoordsXYZ>& out, const json_t& coordinatesArray)
{
if (coordinatesArray.size() != 3)
{
OpenRCT2::Guard::Assert(0, "Fix coordinates sub array should have 3 elements");
Guard::Assert(0, "Fix coordinates sub array should have 3 elements");
return;
}
out.emplace_back(
OpenRCT2::Json::GetNumber<int32_t>(coordinatesArray[0]), OpenRCT2::Json::GetNumber<int32_t>(coordinatesArray[1]),
OpenRCT2::Json::GetNumber<int32_t>(coordinatesArray[2]));
Json::GetNumber<int32_t>(coordinatesArray[0]), Json::GetNumber<int32_t>(coordinatesArray[1]),
Json::GetNumber<int32_t>(coordinatesArray[2]));
}
template<typename TTileCoords = TileCoordsXY>
@@ -134,19 +135,19 @@ static std::vector<TTileCoords> getCoordinates(const json_t& parameters)
{
if (!parameters.contains(_coordinatesKey))
{
OpenRCT2::Guard::Assert(0, "Cannot have fix without coordinates array");
Guard::Assert(0, "Cannot have fix without coordinates array");
return {};
}
else if (!parameters[_coordinatesKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Fix coordinates should be an array");
Guard::Assert(0, "Fix coordinates should be an array");
return {};
}
auto coords = OpenRCT2::Json::AsArray(parameters[_coordinatesKey]);
auto coords = Json::AsArray(parameters[_coordinatesKey]);
if (coords.empty())
{
OpenRCT2::Guard::Assert(0, "Fix coordinates array should not be empty");
Guard::Assert(0, "Fix coordinates array should not be empty");
return {};
}
@@ -156,11 +157,11 @@ static std::vector<TTileCoords> getCoordinates(const json_t& parameters)
{
if (!coords[i].is_array())
{
OpenRCT2::Guard::Assert(0, "Fix coordinates should contain only arrays");
Guard::Assert(0, "Fix coordinates should contain only arrays");
return {};
}
auto coordinatesArray = OpenRCT2::Json::AsArray(coords[i]);
auto coordinatesArray = Json::AsArray(coords[i]);
readCoordinate(parsedCoordinates, coordinatesArray);
}
return parsedCoordinates;
@@ -174,15 +175,15 @@ static Direction GetDirection(const json_t& parameters)
}
else if (!parameters[_directionKey].is_number())
{
OpenRCT2::Guard::Assert(0, "Fix direction must be a number");
Guard::Assert(0, "Fix direction must be a number");
return kInvalidDirection;
}
Direction direction = OpenRCT2::Json::GetNumber<Direction>(parameters[_directionKey]);
Direction direction = Json::GetNumber<Direction>(parameters[_directionKey]);
if (direction > 3)
{
OpenRCT2::Guard::Assert(0, "Direction must be between 0 and 3");
Guard::Assert(0, "Direction must be between 0 and 3");
return kInvalidDirection;
}
@@ -197,12 +198,12 @@ static bool IsQueue(const json_t& parameters)
}
else if (!parameters[_isQueue].is_boolean())
{
OpenRCT2::Guard::Assert(0, "queue must be a boolean");
Guard::Assert(0, "queue must be a boolean");
return false;
}
else
{
return OpenRCT2::Json::GetBoolean(parameters[_isQueue]);
return Json::GetBoolean(parameters[_isQueue]);
}
}
@@ -247,14 +248,14 @@ static void ApplyWaterFixes(const json_t& scenarioPatch)
if (!scenarioPatch[_waterFixKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Water fix should be an array");
Guard::Assert(0, "Water fix should be an array");
return;
}
auto waterFixes = OpenRCT2::Json::AsArray(scenarioPatch[_waterFixKey]);
auto waterFixes = Json::AsArray(scenarioPatch[_waterFixKey]);
if (waterFixes.empty())
{
OpenRCT2::Guard::Assert(0, "Water fix array should not be empty");
Guard::Assert(0, "Water fix array should not be empty");
return;
}
@@ -262,7 +263,7 @@ static void ApplyWaterFixes(const json_t& scenarioPatch)
{
if (!waterFixes[i].contains(_heightKey))
{
OpenRCT2::Guard::Assert(0, "Water fix sub-array should set a height");
Guard::Assert(0, "Water fix sub-array should set a height");
return;
}
if (_dryRun)
@@ -280,16 +281,16 @@ static void ApplyWaterFixes(const json_t& scenarioPatch)
}
}
static OpenRCT2::TrackElemType toTrackType(const u8string_view trackTypeString)
static TrackElemType toTrackType(const u8string_view trackTypeString)
{
if (trackTypeString == "flat")
return OpenRCT2::TrackElemType::Flat;
return TrackElemType::Flat;
else if (trackTypeString == "flat_covered")
return OpenRCT2::TrackElemType::FlatCovered;
return TrackElemType::FlatCovered;
else
{
OpenRCT2::Guard::Assert(0, "Unsupported track type conversion");
return OpenRCT2::TrackElemType::None;
Guard::Assert(0, "Unsupported track type conversion");
return TrackElemType::None;
}
}
@@ -297,20 +298,20 @@ static void ApplyTrackTypeFixes(const json_t& trackTilesFixes)
{
if (!trackTilesFixes.contains(_operationsKey))
{
OpenRCT2::Guard::Assert(0, "Cannot apply track tile fixes when operations array is unset");
Guard::Assert(0, "Cannot apply track tile fixes when operations array is unset");
return;
}
if (!trackTilesFixes[_operationsKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Track tile fixes should have an operations array");
Guard::Assert(0, "Track tile fixes should have an operations array");
return;
}
auto fixOperations = OpenRCT2::Json::AsArray(trackTilesFixes[_operationsKey]);
auto fixOperations = Json::AsArray(trackTilesFixes[_operationsKey]);
if (fixOperations.empty())
{
OpenRCT2::Guard::Assert(0, "Operations fix array should not be empty");
Guard::Assert(0, "Operations fix array should not be empty");
return;
}
@@ -318,18 +319,18 @@ static void ApplyTrackTypeFixes(const json_t& trackTilesFixes)
{
if (!fixOperations[i].contains(_fromKey))
{
OpenRCT2::Guard::Assert(0, "Operation sub-array should contain a from key");
Guard::Assert(0, "Operation sub-array should contain a from key");
return;
}
if (!fixOperations[i].contains(_toKey))
{
OpenRCT2::Guard::Assert(0, "Operation sub-array should contain a to key");
Guard::Assert(0, "Operation sub-array should contain a to key");
return;
}
auto fromTrackType = toTrackType(OpenRCT2::Json::GetString(fixOperations[i][_fromKey]));
auto destinationTrackType = toTrackType(OpenRCT2::Json::GetString(fixOperations[i][_toKey]));
auto fromTrackType = toTrackType(Json::GetString(fixOperations[i][_fromKey]));
auto destinationTrackType = toTrackType(Json::GetString(fixOperations[i][_toKey]));
auto coordinatesVector = getCoordinates(fixOperations[i]);
if (_dryRun)
@@ -364,7 +365,7 @@ static TileElementType toTileElementType(const u8string_view tileTypeString)
return TileElementType::Track;
else
{
OpenRCT2::Guard::Assert(0, "Unsupported tile type conversion");
Guard::Assert(0, "Unsupported tile type conversion");
return TileElementType::Track;
}
}
@@ -379,11 +380,11 @@ static void ApplyTileFixes(const json_t& scenarioPatch)
auto tilesFixes = scenarioPatch[_tilesKey];
if (!tilesFixes.contains(_typeKey))
{
OpenRCT2::Guard::Assert(0, "Cannot apply tile fixes without defined type");
Guard::Assert(0, "Cannot apply tile fixes without defined type");
}
else
{
auto tileType = toTileElementType(OpenRCT2::Json::GetString(tilesFixes[_typeKey]));
auto tileType = toTileElementType(Json::GetString(tilesFixes[_typeKey]));
if (tileType == TileElementType::Track)
{
ApplyTrackTypeFixes(tilesFixes);
@@ -400,14 +401,14 @@ static void ApplySurfaceFixes(const json_t& scenarioPatch)
if (!scenarioPatch[_surfacesKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Surface fix should be an array");
Guard::Assert(0, "Surface fix should be an array");
return;
}
auto surfaceFixes = OpenRCT2::Json::AsArray(scenarioPatch[_surfacesKey]);
auto surfaceFixes = Json::AsArray(scenarioPatch[_surfacesKey]);
if (surfaceFixes.empty())
{
OpenRCT2::Guard::Assert(0, "Surface fix array should not be empty");
Guard::Assert(0, "Surface fix array should not be empty");
return;
}
@@ -415,7 +416,7 @@ static void ApplySurfaceFixes(const json_t& scenarioPatch)
{
if (!surfaceFixes[i].contains(_destinationSurface))
{
OpenRCT2::Guard::Assert(0, "Surface fix sub-array should set a destination surface");
Guard::Assert(0, "Surface fix sub-array should set a destination surface");
return;
}
if (_dryRun)
@@ -423,12 +424,12 @@ static void ApplySurfaceFixes(const json_t& scenarioPatch)
continue;
}
auto destinationSurface = OpenRCT2::Json::GetString(surfaceFixes[i][_destinationSurface]);
auto& objectManager = OpenRCT2::GetContext()->GetObjectManager();
auto surfaceObj = objectManager.GetLoadedObject(OpenRCT2::ObjectEntryDescriptor::Parse(destinationSurface));
auto destinationSurface = Json::GetString(surfaceFixes[i][_destinationSurface]);
auto& objectManager = GetContext()->GetObjectManager();
auto surfaceObj = objectManager.GetLoadedObject(ObjectEntryDescriptor::Parse(destinationSurface));
if (surfaceObj == nullptr)
{
OpenRCT2::Guard::Assert(0, "Surface object not found");
Guard::Assert(0, "Surface object not found");
return;
}
@@ -451,14 +452,14 @@ static void RemoveTileElements(const json_t& scenarioPatch)
if (!scenarioPatch[_elementsToDelete].is_array())
{
OpenRCT2::Guard::Assert(0, "Elements to delete should be an array");
Guard::Assert(0, "Elements to delete should be an array");
return;
}
auto elementsToDelete = OpenRCT2::Json::AsArray(scenarioPatch[_elementsToDelete]);
auto elementsToDelete = Json::AsArray(scenarioPatch[_elementsToDelete]);
if (elementsToDelete.empty())
{
OpenRCT2::Guard::Assert(0, "Elements to delete should not be empty");
Guard::Assert(0, "Elements to delete should not be empty");
return;
}
@@ -466,7 +467,7 @@ static void RemoveTileElements(const json_t& scenarioPatch)
{
if (!elementsToDelete[i].contains(_element_index))
{
OpenRCT2::Guard::Assert(0, "Elements to delete sub-array should set an element_index");
Guard::Assert(0, "Elements to delete sub-array should set an element_index");
return;
}
auto elementIndex = elementsToDelete[i][_element_index];
@@ -481,7 +482,7 @@ static void RemoveTileElements(const json_t& scenarioPatch)
auto tileElement = MapGetNthElementAt(tile.ToCoordsXY(), elementIndex);
if (tileElement == nullptr)
{
OpenRCT2::Guard::Assert(0, "Invalid Nth element at tile");
Guard::Assert(0, "Invalid Nth element at tile");
return;
}
else
@@ -497,7 +498,7 @@ static void SwapRideEntranceAndExit(RideId rideId)
auto ride = GetRide(rideId);
if (ride == nullptr)
{
OpenRCT2::Guard::Assert(0, "Invalid Ride Id for SwapRideEntranceAndExit");
Guard::Assert(0, "Invalid Ride Id for SwapRideEntranceAndExit");
return;
}
@@ -544,14 +545,14 @@ static void ApplyRideFixes(const json_t& scenarioPatch)
if (!scenarioPatch[_ridesKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Ride fixes should be an array of arrays");
Guard::Assert(0, "Ride fixes should be an array of arrays");
return;
}
auto rideFixes = OpenRCT2::Json::AsArray(scenarioPatch[_ridesKey]);
auto rideFixes = Json::AsArray(scenarioPatch[_ridesKey]);
if (rideFixes.empty())
{
OpenRCT2::Guard::Assert(0, "Ride fixes should not be an empty array");
Guard::Assert(0, "Ride fixes should not be an empty array");
return;
}
@@ -559,18 +560,18 @@ static void ApplyRideFixes(const json_t& scenarioPatch)
{
if (!rideFixes[i].contains(_rideIdKey))
{
OpenRCT2::Guard::Assert(0, "Ride fixes should contain a ride id");
Guard::Assert(0, "Ride fixes should contain a ride id");
return;
}
if (!rideFixes[i].contains(_operationKey))
{
OpenRCT2::Guard::Assert(0, "Ride fixes should contain a ride operation");
Guard::Assert(0, "Ride fixes should contain a ride operation");
return;
}
RideId rideId = RideId::FromUnderlying(OpenRCT2::Json::GetNumber<uint16_t>(rideFixes[i][_rideIdKey]));
auto operation = OpenRCT2::Json::GetString(rideFixes[i][_operationKey]);
RideId rideId = RideId::FromUnderlying(Json::GetNumber<uint16_t>(rideFixes[i][_rideIdKey]));
auto operation = Json::GetString(rideFixes[i][_operationKey]);
if (_dryRun)
{
@@ -583,7 +584,7 @@ static void ApplyRideFixes(const json_t& scenarioPatch)
}
else
{
OpenRCT2::Guard::Assert(0, "Unsupported ride fix operation");
Guard::Assert(0, "Unsupported ride fix operation");
}
}
}
@@ -597,14 +598,14 @@ static void ApplyPathFixes(const json_t& scenarioPatch)
if (!scenarioPatch[_pathsKey].is_array())
{
OpenRCT2::Guard::Assert(0, "Path fixes should be an array of arrays");
Guard::Assert(0, "Path fixes should be an array of arrays");
return;
}
auto pathFixes = OpenRCT2::Json::AsArray(scenarioPatch[_pathsKey]);
auto pathFixes = Json::AsArray(scenarioPatch[_pathsKey]);
if (pathFixes.empty())
{
OpenRCT2::Guard::Assert(0, "Path fixes should not be an empty array");
Guard::Assert(0, "Path fixes should not be an empty array");
return;
}
@@ -614,43 +615,43 @@ static void ApplyPathFixes(const json_t& scenarioPatch)
if (!pathFix.contains(_railingsKey))
{
OpenRCT2::Guard::Assert(0, "Path fixes should have railings");
Guard::Assert(0, "Path fixes should have railings");
return;
}
if (!pathFix.contains(_surfaceKey))
{
OpenRCT2::Guard::Assert(0, "Path fixes should have a surface");
Guard::Assert(0, "Path fixes should have a surface");
return;
}
auto railings = OpenRCT2::Json::GetString(pathFix[_railingsKey]);
auto surface = OpenRCT2::Json::GetString(pathFix[_surfaceKey]);
auto railings = Json::GetString(pathFix[_railingsKey]);
auto surface = Json::GetString(pathFix[_surfaceKey]);
if (_dryRun)
{
continue;
}
auto& objectManager = OpenRCT2::GetContext()->GetObjectManager();
auto& objectManager = GetContext()->GetObjectManager();
auto railingsObjIndex = objectManager.GetLoadedObjectEntryIndex(railings);
auto surfaceObjIndex = objectManager.GetLoadedObjectEntryIndex(surface);
if (railingsObjIndex == OpenRCT2::kObjectEntryIndexNull)
if (railingsObjIndex == kObjectEntryIndexNull)
{
OpenRCT2::Guard::Assert(0, "Railings object not found");
Guard::Assert(0, "Railings object not found");
return;
}
if (surfaceObjIndex == OpenRCT2::kObjectEntryIndexNull)
if (surfaceObjIndex == kObjectEntryIndexNull)
{
OpenRCT2::Guard::Assert(0, "Surface object not found");
Guard::Assert(0, "Surface object not found");
return;
}
auto coordinates = getCoordinates<TileCoordsXYZ>(pathFix);
Direction direction = GetDirection(pathFix);
PathConstructFlags constructionFlags = IsQueue(pathFix) ? OpenRCT2::PathConstructFlag::IsQueue : 0;
PathConstructFlags constructionFlags = IsQueue(pathFix) ? PathConstructFlag::IsQueue : 0;
for (auto coordinate : coordinates)
{
@@ -658,9 +659,9 @@ static void ApplyPathFixes(const json_t& scenarioPatch)
auto footpathPlaceAction = FootpathPlaceAction(
coordinate.ToCoordsXYZ(), slope, surfaceObjIndex, railingsObjIndex, direction, constructionFlags);
auto result = footpathPlaceAction.Execute();
if (result.Error != OpenRCT2::GameActions::Status::Ok)
if (result.Error != GameActions::Status::Ok)
{
OpenRCT2::Guard::Assert(0, "Could not patch path");
Guard::Assert(0, "Could not patch path");
}
}
}
@@ -668,12 +669,12 @@ static void ApplyPathFixes(const json_t& scenarioPatch)
static u8string getScenarioSHA256(u8string_view scenarioPath)
{
auto scenarioData = OpenRCT2::File::ReadAllBytes(scenarioPath);
auto scenarioData = File::ReadAllBytes(scenarioPath);
#ifdef DISABLE_NETWORK
auto scenarioStringHash = picosha2::hash256_hex_string(scenarioData);
#else
auto scenarioHash = OpenRCT2::Crypt::SHA256(scenarioData.data(), scenarioData.size());
auto scenarioStringHash = OpenRCT2::String::StringFromHex(scenarioHash);
auto scenarioHash = Crypt::SHA256(scenarioData.data(), scenarioData.size());
auto scenarioStringHash = String::StringFromHex(scenarioHash);
#endif
LOG_VERBOSE("Fetching patch\n Scenario: '%s'\n SHA '%s'", scenarioPath.data(), scenarioStringHash.c_str());
return scenarioStringHash;
@@ -681,10 +682,10 @@ static u8string getScenarioSHA256(u8string_view scenarioPath)
static u8string GetPatchFileName(u8string_view scenarioHash)
{
auto& env = OpenRCT2::GetContext()->GetPlatformEnvironment();
auto scenarioPatches = env.GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DirId::scenarioPatches);
auto scenarioPatchFile = OpenRCT2::Path::WithExtension(scenarioHash.substr(0, 7), ".parkpatch");
return OpenRCT2::Path::Combine(scenarioPatches, scenarioPatchFile);
auto& env = GetContext()->GetPlatformEnvironment();
auto scenarioPatches = env.GetDirectoryPath(DirBase::openrct2, DirId::scenarioPatches);
auto scenarioPatchFile = Path::WithExtension(scenarioHash.substr(0, 7), ".parkpatch");
return Path::Combine(scenarioPatches, scenarioPatchFile);
}
static bool ValidateSHA256(const json_t& scenarioPatch, u8string_view scenarioHash)
@@ -696,18 +697,18 @@ static bool ValidateSHA256(const json_t& scenarioPatch, u8string_view scenarioHa
if (!scenarioPatch.contains(_scenarioNameKey))
{
OpenRCT2::Guard::Assert(0, "All .parkpatch files should contain the name of the original scenario");
Guard::Assert(0, "All .parkpatch files should contain the name of the original scenario");
return false;
}
if (!scenarioPatch.contains(_fullSHAKey))
{
OpenRCT2::Guard::Assert(0, "All .parkpatch files should contain the sha256 of the original scenario");
Guard::Assert(0, "All .parkpatch files should contain the sha256 of the original scenario");
return false;
}
auto scenarioName = OpenRCT2::Json::GetString(scenarioPatch[_scenarioNameKey]);
auto scenarioSHA = OpenRCT2::Json::GetString(scenarioPatch[_fullSHAKey]);
auto scenarioName = Json::GetString(scenarioPatch[_scenarioNameKey]);
auto scenarioSHA = Json::GetString(scenarioPatch[_fullSHAKey]);
LOG_VERBOSE(
"\n Scenario '%s'\n SHA '%s'\n SHA Valid: %d", scenarioName.c_str(), scenarioSHA.c_str(),
(scenarioHash == scenarioSHA));
@@ -715,12 +716,12 @@ static bool ValidateSHA256(const json_t& scenarioPatch, u8string_view scenarioHa
return scenarioSHA == scenarioHash;
}
void OpenRCT2::RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA)
void RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA)
{
auto scenarioPatch = OpenRCT2::Json::ReadFromFile(scenarioPatchFile);
auto scenarioPatch = Json::ReadFromFile(scenarioPatchFile);
if (!ValidateSHA256(scenarioPatch, scenarioSHA))
{
OpenRCT2::Guard::Assert(0, "Invalid full SHA256. Check for shortened SHA collision");
Guard::Assert(0, "Invalid full SHA256. Check for shortened SHA collision");
return;
}
ApplyLandOwnershipFixes(scenarioPatch);
@@ -732,7 +733,7 @@ void OpenRCT2::RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8stri
ApplyPathFixes(scenarioPatch);
}
void OpenRCT2::RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath)
void RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath)
{
if (scenarioPath.empty())
{
@@ -741,13 +742,13 @@ void OpenRCT2::RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath)
auto scenarioSHA = getScenarioSHA256(scenarioPath);
auto patchPath = GetPatchFileName(scenarioSHA);
if (OpenRCT2::File::Exists(patchPath))
if (File::Exists(patchPath))
{
ApplyScenarioPatch(patchPath, scenarioSHA);
}
}
void OpenRCT2::RCT12::SetDryRun(bool enable)
void RCT12::SetDryRun(bool enable)
{
_dryRun = enable;
}

View File

@@ -41,13 +41,14 @@ struct Staff;
struct Vehicle;
struct RideObjectEntry;
struct ResultWithMessage;
struct TileElement;
struct TrackElement;
namespace OpenRCT2
{
class StationObject;
}
struct TileElement;
struct TrackElement;
} // namespace OpenRCT2
constexpr uint8_t kRideAdjacencyCheckDistance = 5;
@@ -331,7 +332,7 @@ private:
void update();
void updateQueueLength(StationIndex stationIndex);
ResultWithMessage createVehicles(const CoordsXYE& element, bool isApplying);
void moveTrainsToBlockBrakes(const CoordsXYZ& firstBlockPosition, TrackElement& firstBlock);
void moveTrainsToBlockBrakes(const CoordsXYZ& firstBlockPosition, OpenRCT2::TrackElement& firstBlock);
money64 calculateIncomePerHour() const;
void chainQueues() const;
void constructMissingEntranceOrExit() const;
@@ -403,7 +404,7 @@ public:
uint64_t getAvailableModes() const;
const RideTypeDescriptor& getRideTypeDescriptor() const;
TrackElement* getOriginElement(StationIndex stationIndex) const;
OpenRCT2::TrackElement* getOriginElement(StationIndex stationIndex) const;
std::pair<RideMeasurement*, OpenRCT2String> getMeasurement();
@@ -450,11 +451,11 @@ struct TrackBeginEnd
int32_t begin_y;
int32_t begin_z;
int32_t begin_direction;
TileElement* begin_element;
OpenRCT2::TileElement* begin_element;
int32_t end_x;
int32_t end_y;
int32_t end_direction;
TileElement* end_element;
OpenRCT2::TileElement* end_element;
};
#ifdef PLATFORM_32BIT
static_assert(sizeof(TrackBeginEnd) == 36);
@@ -872,10 +873,10 @@ void RideMeasurementsUpdate();
void RideBreakdownAddNewsItem(const Ride& ride);
Staff* RideFindClosestMechanic(const Ride& ride, int32_t forInspection);
int32_t RideInitialiseConstructionWindow(Ride& ride);
void RideSetMapTooltip(const TileElement& tileElement);
void RideSetMapTooltip(const OpenRCT2::TileElement& tileElement);
void RidePrepareBreakdown(Ride& ride, int32_t breakdownReason);
TileElement* RideGetStationStartTrackElement(const Ride& ride, StationIndex stationIndex);
TileElement* RideGetStationExitElement(const CoordsXYZ& elementPos);
OpenRCT2::TileElement* RideGetStationStartTrackElement(const Ride& ride, StationIndex stationIndex);
OpenRCT2::TileElement* RideGetStationExitElement(const CoordsXYZ& elementPos);
money64 RideGetRefundPrice(const Ride& ride);
int32_t RideGetRandomColourPresetIndex(ride_type_t rideType);
money64 RideGetCommonPrice(const Ride& forRide);
@@ -911,7 +912,7 @@ money64 RideEntranceExitPlaceGhost(
ResultWithMessage RideAreAllPossibleEntrancesAndExitsBuilt(const Ride& ride);
void RideFixBreakdown(Ride& ride, int32_t reliabilityIncreaseFactor);
void BlockBrakeSetLinkedBrakesClosed(const CoordsXYZ& vehicleTrackLocation, TrackElement& tileElement, bool isOpen);
void BlockBrakeSetLinkedBrakesClosed(const CoordsXYZ& vehicleTrackLocation, OpenRCT2::TrackElement& tileElement, bool isOpen);
uint8_t RideEntryGetVehicleAtPosition(int32_t rideEntryIndex, int32_t numCarsPerTrain, int32_t position);
void RideUpdateVehicleColours(const Ride& ride);
@@ -929,7 +930,7 @@ Vehicle* RideGetBrokenVehicle(const Ride& ride);
money64 RideGetPrice(const Ride& ride);
TileElement* GetStationPlatform(const CoordsXYRangedZ& coords);
OpenRCT2::TileElement* GetStationPlatform(const CoordsXYRangedZ& coords);
bool RideHasAdjacentStation(const Ride& ride);
bool RideHasStationShelter(const Ride& ride);
bool RideHasRatings(const Ride& ride);
@@ -943,7 +944,7 @@ OpenRCT2::ObjectEntryIndex RideGetEntryIndex(ride_type_t rideType, OpenRCT2::Obj
void DetermineRideEntranceAndExitLocations();
void RideClearLeftoverEntrances(const Ride& ride);
void SetBrakeClosedMultiTile(TrackElement& trackElement, const CoordsXY& trackLocation, bool isClosed);
void SetBrakeClosedMultiTile(OpenRCT2::TrackElement& trackElement, const CoordsXY& trackLocation, bool isClosed);
std::vector<RideId> GetTracklessRides();

View File

@@ -20,7 +20,11 @@
#include <cstdint>
#include <optional>
struct TileElement;
namespace OpenRCT2
{
struct TileElement;
}
struct CoordsXYE;
struct RideTypeDescriptor;
struct TrackDrawerDescriptor;
@@ -139,5 +143,5 @@ OpenRCT2::TrackElemType GetTrackTypeFromCurve(
TrackCurve curve, bool startsDiagonal, TrackPitch startSlope, TrackPitch endSlope, TrackRoll startBank, TrackRoll endBank);
std::optional<CoordsXYZ> GetTrackElementOriginAndApplyChanges(
const CoordsXYZD& location, OpenRCT2::TrackElemType type, uint16_t extra_params, TileElement** output_element,
const CoordsXYZD& location, OpenRCT2::TrackElemType type, uint16_t extra_params, OpenRCT2::TileElement** output_element,
TrackElementSetFlags flags);

View File

@@ -26,10 +26,11 @@ constexpr uint8_t kMaximumTrackSpeed = 30;
namespace OpenRCT2
{
enum class TrackElemType : uint16_t;
}
struct TileElement;
} // namespace OpenRCT2
struct ResultWithMessage;
struct TileElement;
enum class TrackRoll : uint8_t
{
@@ -652,7 +653,7 @@ struct TrackCircuitIterator
CoordsXYE current;
int32_t currentZ;
int32_t currentDirection;
TileElement* first;
OpenRCT2::TileElement* first;
bool firstIteration;
bool looped;
};
@@ -712,7 +713,7 @@ struct TypeOrCurve
PitchAndRoll TrackPitchAndRollStart(OpenRCT2::TrackElemType trackType);
PitchAndRoll TrackPitchAndRollEnd(OpenRCT2::TrackElemType trackType);
int32_t TrackIsConnectedByShape(TileElement* a, TileElement* b);
int32_t TrackIsConnectedByShape(OpenRCT2::TileElement* a, OpenRCT2::TileElement* b);
void TrackCircuitIteratorBegin(TrackCircuitIterator* it, CoordsXYE first);
bool TrackCircuitIteratorPrevious(TrackCircuitIterator* it);
@@ -722,7 +723,7 @@ bool TrackCircuitIteratorsMatch(const TrackCircuitIterator* firstIt, const Track
void TrackGetBack(const CoordsXYE& input, CoordsXYE* output);
void TrackGetFront(const CoordsXYE& input, CoordsXYE* output);
TrackElement* TrackGetPreviousBlock(CoordsXYZ& location, TileElement* tileElement);
OpenRCT2::TrackElement* TrackGetPreviousBlock(CoordsXYZ& location, OpenRCT2::TileElement* tileElement);
bool TrackElementIsCovered(OpenRCT2::TrackElemType trackElementType);
OpenRCT2::TrackElemType UncoverTrackElement(OpenRCT2::TrackElemType trackElementType);
@@ -731,9 +732,9 @@ bool TrackTypeIsBrakes(OpenRCT2::TrackElemType trackType);
bool TrackTypeIsBlockBrakes(OpenRCT2::TrackElemType trackType);
bool TrackTypeIsBooster(OpenRCT2::TrackElemType trackType);
TrackRoll TrackGetActualBank(TileElement* tileElement, TrackRoll bank);
TrackRoll TrackGetActualBank(OpenRCT2::TileElement* tileElement, TrackRoll bank);
TrackRoll TrackGetActualBank2(ride_type_t rideType, bool isInverted, TrackRoll bank);
TrackRoll TrackGetActualBank3(bool useInvertedSprites, TileElement* tileElement);
TrackRoll TrackGetActualBank3(bool useInvertedSprites, OpenRCT2::TileElement* tileElement);
ResultWithMessage TrackAddStationElement(CoordsXYZD loc, RideId rideIndex, int32_t flags, bool fromTrackDesign);
ResultWithMessage TrackRemoveStationElement(const CoordsXYZD& loc, RideId rideIndex, int32_t flags);

View File

@@ -254,12 +254,12 @@ void TrackDesignDrawPreview(TrackDesign& td, uint8_t* pixels);
///////////////////////////////////////////////////////////////////////////////
void TrackDesignSaveInit();
void TrackDesignSaveResetScenery();
bool TrackDesignSaveContainsTileElement(const TileElement* tileElement);
bool TrackDesignSaveContainsTileElement(const OpenRCT2::TileElement* tileElement);
void TrackDesignSaveSelectNearbyScenery(RideId rideIndex);
void TrackDesignSaveSelectTileElement(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement, bool collect);
ViewportInteractionItem interactionType, const CoordsXY& loc, OpenRCT2::TileElement* tileElement, bool collect);
bool TrackDesignAreEntranceAndExitPlaced();
extern std::vector<TrackDesignSceneryElement> _trackSavedTileElementsDesc;
extern std::vector<const TileElement*> _trackSavedTileElements;
extern std::vector<const OpenRCT2::TileElement*> _trackSavedTileElements;

View File

@@ -405,17 +405,17 @@ constexpr bool kDiagSpriteMap[kNumOrthogonalDirections][4] = {
extern const uint8_t mapLeftEighthTurnToOrthogonal[5];
ImageId GetStationColourScheme(PaintSession& session, const TrackElement& trackElement);
ImageId GetShopSupportColourScheme(PaintSession& session, const TrackElement& trackElement);
ImageId GetStationColourScheme(PaintSession& session, const OpenRCT2::TrackElement& trackElement);
ImageId GetShopSupportColourScheme(PaintSession& session, const OpenRCT2::TrackElement& trackElement);
bool TrackPaintUtilHasFence(
enum edge_t edge, const CoordsXY& position, const TrackElement& trackElement, const Ride& ride, uint8_t rotation);
enum edge_t edge, const CoordsXY& position, const OpenRCT2::TrackElement& trackElement, const Ride& ride, uint8_t rotation);
void TrackPaintUtilPaintFloor(
PaintSession& session, uint8_t edges, ImageId colourFlags, uint16_t height, const uint32_t floorSprites[4],
const OpenRCT2::StationObject* stationStyle);
void TrackPaintUtilPaintFences(
PaintSession& session, uint8_t edges, const CoordsXY& position, const TrackElement& trackElement, const Ride& ride,
const ImageId colourFlags, uint16_t height, const uint32_t fenceSprites[4], uint8_t rotation);
PaintSession& session, uint8_t edges, const CoordsXY& position, const OpenRCT2::TrackElement& trackElement,
const Ride& ride, const ImageId colourFlags, uint16_t height, const uint32_t fenceSprites[4], uint8_t rotation);
enum class StationBaseType
{
@@ -434,20 +434,20 @@ bool TrackPaintUtilDrawStationCovers2(
uint8_t stationVariant, ImageId colour);
bool TrackPaintUtilDrawNarrowStationPlatform(
PaintSession& session, const Ride& ride, Direction direction, int32_t height, int32_t zOffset,
const TrackElement& trackElement, const StationBaseType baseType, const int32_t baseOffsetZ);
const OpenRCT2::TrackElement& trackElement, const StationBaseType baseType, const int32_t baseOffsetZ);
bool TrackPaintUtilDrawStation(
PaintSession& session, const Ride& ride, Direction direction, uint16_t height, const TrackElement& trackElement,
PaintSession& session, const Ride& ride, Direction direction, uint16_t height, const OpenRCT2::TrackElement& trackElement,
const StationBaseType baseType, const int32_t baseOffsetZ);
bool TrackPaintUtilDrawStation2(
PaintSession& session, const Ride& ride, Direction direction, uint16_t height, const TrackElement& trackElement,
PaintSession& session, const Ride& ride, Direction direction, uint16_t height, const OpenRCT2::TrackElement& trackElement,
const StationBaseType baseType, const int32_t baseOffsetZ, int32_t fenceOffsetA, int32_t fenceOffsetB);
bool TrackPaintUtilDrawStationInverted(
PaintSession& session, const Ride& ride, Direction direction, int32_t height, const TrackElement& trackElement,
PaintSession& session, const Ride& ride, Direction direction, int32_t height, const OpenRCT2::TrackElement& trackElement,
uint8_t stationVariant);
bool TrackPaintUtilShouldPaintSupports(const CoordsXY& position);
void TrackPaintUtilDrawPier(
PaintSession& session, const Ride& ride, const OpenRCT2::StationObject* stationObject, const CoordsXY& position,
Direction direction, int32_t height, const TrackElement& trackElement, uint8_t rotation);
Direction direction, int32_t height, const OpenRCT2::TrackElement& trackElement, uint8_t rotation);
inline void TrackPaintUtilDrawStationTunnel(PaintSession& session, Direction direction, int32_t height)
{
PaintUtilPushTunnelRotated(session, direction, height, TunnelGroup::Square, TunnelSubType::Flat);
@@ -508,14 +508,14 @@ void TrackPaintUtilOnridePhotoPlatformPaint(
PaintSession& session, Direction direction, int32_t height, MetalSupportType supportType);
void TrackPaintUtilOnridePhotoSmallPaint(
PaintSession& session, Direction direction, int32_t height, const TrackElement& trackElement);
PaintSession& session, Direction direction, int32_t height, const OpenRCT2::TrackElement& trackElement);
void TrackPaintUtilOnridePhotoPaint(
PaintSession& session, Direction direction, int32_t height, const TrackElement& trackElement);
PaintSession& session, Direction direction, int32_t height, const OpenRCT2::TrackElement& trackElement);
void TrackPaintUtilOnridePhotoPaint2(
PaintSession& session, Direction direction, int32_t height, int32_t trackHeightOffset, int32_t supportsAboveHeightOffset,
const TrackElement& trackElement);
const OpenRCT2::TrackElement& trackElement);
void TrackPaintUtilOnridePhotoPaint2(
PaintSession& session, Direction direction, const TrackElement& trackElement, int32_t height,
PaintSession& session, Direction direction, const OpenRCT2::TrackElement& trackElement, int32_t height,
int32_t supportsAboveHeightOffset = kGeneralSupportHeightOnRidePhoto, int32_t trackHeightOffset = 3);
void TrackPaintUtilRightHelixUpSmallQuarterTilesPaint(
PaintSession& session, const int8_t thickness[2], int16_t height, Direction direction, uint8_t trackSequence,
@@ -560,11 +560,11 @@ void DrawSBendRightSupports(
using TrackPaintFunction = void (&)(
PaintSession& session, const Ride& ride, uint8_t trackSequence, Direction direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
void TrackPaintFunctionDummy(
PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height,
const TrackElement& trackElement, SupportType supportType);
const OpenRCT2::TrackElement& trackElement, SupportType supportType);
TrackPaintFunction GetTrackPaintFunctionStandUpRC(OpenRCT2::TrackElemType trackType);
TrackPaintFunction GetTrackPaintFunctionSuspendedSwingingRC(OpenRCT2::TrackElemType trackType);

View File

@@ -380,7 +380,7 @@ private:
void UpdateLandscapeDoors(const int32_t previousTrackHeight) const;
int32_t CalculateRiderBraking() const;
uint8_t ChooseBrakeSpeed() const;
void PopulateBrakeSpeed(const CoordsXYZ& vehicleTrackLocation, TrackElement& brake);
void PopulateBrakeSpeed(const CoordsXYZ& vehicleTrackLocation, OpenRCT2::TrackElement& brake);
void Loc6DCE02(const Ride& curRide);
void Loc6DCDE4(const Ride& curRide);

View File

@@ -18,13 +18,13 @@
#include <string>
class Formatter;
struct TileElement;
struct WallElement;
namespace OpenRCT2
{
struct GameState_t;
}
struct TileElement;
struct WallElement;
} // namespace OpenRCT2
constexpr OpenRCT2::ObjectEntryIndex kBannerNull = OpenRCT2::kObjectEntryIndexNull;
constexpr size_t kMaxBanners = 8192;
@@ -63,8 +63,8 @@ struct Banner
};
void BannerInit(OpenRCT2::GameState_t& gameState);
TileElement* BannerGetTileElement(BannerIndex bannerIndex);
WallElement* BannerGetScrollingWallTileElement(BannerIndex bannerIndex);
OpenRCT2::TileElement* BannerGetTileElement(BannerIndex bannerIndex);
OpenRCT2::WallElement* BannerGetScrollingWallTileElement(BannerIndex bannerIndex);
RideId BannerGetClosestRideIndex(const CoordsXYZ& mapPos);
void BannerApplyFixes();
void UnlinkAllRideBanners();

View File

@@ -14,12 +14,16 @@
#include <cstdint>
struct TileElement;
namespace OpenRCT2
{
struct TileElement;
}
struct CoordsXY;
struct CoordsXYRangedZ;
class QuarterTile;
using CLEAR_FUNC = int32_t (*)(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
using CLEAR_FUNC = int32_t (*)(OpenRCT2::TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
enum
{
@@ -38,8 +42,9 @@ enum class CreateCrossingMode
pathOverTrack,
};
int32_t MapPlaceNonSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
int32_t MapPlaceSceneryClearFunc(TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
int32_t MapPlaceNonSceneryClearFunc(
OpenRCT2::TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
int32_t MapPlaceSceneryClearFunc(OpenRCT2::TileElement** tile_element, const CoordsXY& coords, uint8_t flags, money64* price);
struct ConstructClearResult
{
@@ -52,4 +57,4 @@ struct ConstructClearResult
[[nodiscard]] OpenRCT2::GameActions::Result MapCanConstructAt(const CoordsXYRangedZ& pos, QuarterTile bl);
void MapGetObstructionErrorText(TileElement* tileElement, OpenRCT2::GameActions::Result& res);
void MapGetObstructionErrorText(OpenRCT2::TileElement* tileElement, OpenRCT2::GameActions::Result& res);

View File

@@ -17,10 +17,10 @@ namespace OpenRCT2
class FootpathObject;
class FootpathSurfaceObject;
class FootpathRailingsObject;
} // namespace OpenRCT2
struct PathElement;
struct TileElement;
struct PathElement;
struct TileElement;
} // namespace OpenRCT2
constexpr auto kFootpathMaxHeight = 248 * kCoordsZStep;
constexpr auto kFootpathMinHeight = 2 * kCoordsZStep;
@@ -134,19 +134,20 @@ extern const std::array<CoordsXY, kNumOrthogonalDirections> DirectionOffsets;
extern const std::array<CoordsXY, kNumOrthogonalDirections> BinUseOffsets;
extern const std::array<CoordsXY, kNumOrthogonalDirections * 2> BenchUseOffsets;
PathElement* MapGetFootpathElement(const CoordsXYZ& coords);
OpenRCT2::PathElement* MapGetFootpathElement(const CoordsXYZ& coords);
void FootpathInterruptPeeps(const CoordsXYZ& footpathPos);
void FootpathRemoveLitter(const CoordsXYZ& footpathPos);
void FootpathConnectEdges(const CoordsXY& footpathPos, TileElement* tileElement, int32_t flags);
void FootpathConnectEdges(const CoordsXY& footpathPos, OpenRCT2::TileElement* tileElement, int32_t flags);
void FootpathUpdateQueueChains();
bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction);
void FootpathChainRideQueue(
RideId rideIndex, StationIndex entranceIndex, const CoordsXY& footpathPos, TileElement* tileElement, int32_t direction);
RideId rideIndex, StationIndex entranceIndex, const CoordsXY& footpathPos, OpenRCT2::TileElement* tileElement,
int32_t direction);
void FootpathUpdatePathWideFlags(const CoordsXY& footpathPos);
bool FootpathIsBlockedByVehicle(const TileCoordsXYZ& position);
int32_t FootpathIsConnectedToMapEdge(const CoordsXYZ& footpathPos, int32_t direction, int32_t flags);
void FootpathRemoveEdgesAt(const CoordsXY& footpathPos, TileElement* tileElement);
void FootpathRemoveEdgesAt(const CoordsXY& footpathPos, OpenRCT2::TileElement* tileElement);
bool FootpathSelectDefault();
const OpenRCT2::FootpathObject* GetLegacyFootpathEntry(OpenRCT2::ObjectEntryIndex entryIndex);
@@ -155,4 +156,4 @@ const OpenRCT2::FootpathRailingsObject* GetPathRailingsEntry(OpenRCT2::ObjectEnt
void FootpathQueueChainReset();
void FootpathQueueChainPush(RideId rideIndex);
bool FootpathIsZAndDirectionValid(const PathElement& tileElement, int32_t currentZ, int32_t currentDirection);
bool FootpathIsZAndDirectionValid(const OpenRCT2::PathElement& tileElement, int32_t currentZ, int32_t currentDirection);

View File

@@ -47,37 +47,38 @@ constexpr uint32_t kMaxTileElementsWithSpaceRoom = 0x1000000;
constexpr uint32_t kMaxTileElements = kMaxTileElementsWithSpaceRoom - 512;
using PeepSpawn = CoordsXYZD;
struct BannerElement;
struct EntranceElement;
struct LargeSceneryElement;
struct PathElement;
struct SmallSceneryElement;
struct SurfaceElement;
struct TileElement;
struct TrackElement;
struct WallElement;
enum class TileElementType : uint8_t;
namespace OpenRCT2
{
struct BannerElement;
struct EntranceElement;
struct LargeSceneryElement;
struct PathElement;
struct SmallSceneryElement;
struct SurfaceElement;
struct TileElement;
struct TrackElement;
struct WallElement;
enum class TileElementType : uint8_t;
enum class TrackElemType : uint16_t;
}
} // namespace OpenRCT2
struct CoordsXYE : public CoordsXY
{
CoordsXYE() = default;
constexpr CoordsXYE(int32_t _x, int32_t _y, TileElement* _e)
constexpr CoordsXYE(int32_t _x, int32_t _y, OpenRCT2::TileElement* _e)
: CoordsXY(_x, _y)
, element(_e)
{
}
constexpr CoordsXYE(const CoordsXY& c, TileElement* _e)
constexpr CoordsXYE(const CoordsXY& c, OpenRCT2::TileElement* _e)
: CoordsXY(c)
, element(_e)
{
}
TileElement* element = nullptr;
OpenRCT2::TileElement* element = nullptr;
};
enum
@@ -134,32 +135,33 @@ namespace OpenRCT2
}
void ReorganiseTileElements();
const std::vector<TileElement>& GetTileElements();
void SetTileElements(OpenRCT2::GameState_t& gameState, std::vector<TileElement>&& tileElements);
const std::vector<OpenRCT2::TileElement>& GetTileElements();
void SetTileElements(OpenRCT2::GameState_t& gameState, std::vector<OpenRCT2::TileElement>&& tileElements);
void StashMap();
void UnstashMap();
std::vector<TileElement> GetReorganisedTileElementsWithoutGhosts();
std::vector<OpenRCT2::TileElement> GetReorganisedTileElementsWithoutGhosts();
void MapInit(const TileCoordsXY& size);
void MapCountRemainingLandRights();
void MapStripGhostFlagFromElements();
TileElement* MapGetFirstElementAt(const CoordsXY& tilePos);
TileElement* MapGetFirstElementAt(const TileCoordsXY& tilePos);
TileElement* MapGetNthElementAt(const CoordsXY& coords, int32_t n);
TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc, TileElementType type);
void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements);
OpenRCT2::TileElement* MapGetFirstElementAt(const CoordsXY& tilePos);
OpenRCT2::TileElement* MapGetFirstElementAt(const TileCoordsXY& tilePos);
OpenRCT2::TileElement* MapGetNthElementAt(const CoordsXY& coords, int32_t n);
OpenRCT2::TileElement* MapGetFirstTileElementWithBaseHeightBetween(
const TileCoordsXYRangedZ& loc, OpenRCT2::TileElementType type);
void MapSetTileElement(const TileCoordsXY& tilePos, OpenRCT2::TileElement* elements);
int32_t MapHeightFromSlope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped);
BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t direction);
SurfaceElement* MapGetSurfaceElementAt(const TileCoordsXY& coords);
SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords);
PathElement* MapGetPathElementAt(const TileCoordsXYZ& loc);
WallElement* MapGetWallElementAt(const CoordsXYZD& wallCoords);
WallElement* MapGetWallElementAt(const CoordsXYRangedZ& coords);
SmallSceneryElement* MapGetSmallSceneryElementAt(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant);
EntranceElement* MapGetParkEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost);
EntranceElement* MapGetRideEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost);
EntranceElement* MapGetRideExitElementAt(const CoordsXYZ& exitCoords, bool ghost);
OpenRCT2::BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t direction);
OpenRCT2::SurfaceElement* MapGetSurfaceElementAt(const TileCoordsXY& coords);
OpenRCT2::SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords);
OpenRCT2::PathElement* MapGetPathElementAt(const TileCoordsXYZ& loc);
OpenRCT2::WallElement* MapGetWallElementAt(const CoordsXYZD& wallCoords);
OpenRCT2::WallElement* MapGetWallElementAt(const CoordsXYRangedZ& coords);
OpenRCT2::SmallSceneryElement* MapGetSmallSceneryElementAt(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant);
OpenRCT2::EntranceElement* MapGetParkEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost);
OpenRCT2::EntranceElement* MapGetRideEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost);
OpenRCT2::EntranceElement* MapGetRideExitElementAt(const CoordsXYZ& exitCoords, bool ghost);
uint8_t MapGetHighestLandHeight(const MapRange& range);
uint8_t MapGetLowestLandHeight(const MapRange& range);
bool MapCoordIsConnected(const TileCoordsXYZ& loc, uint8_t faceDirection);
@@ -178,10 +180,10 @@ bool MapCheckCapacityAndReorganise(const CoordsXY& loc, size_t numElements = 1);
int16_t TileElementHeight(const CoordsXY& loc);
int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope);
int16_t TileElementWaterHeight(const CoordsXY& loc);
void TileElementRemove(TileElement* tileElement);
TileElement* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type);
void TileElementRemove(OpenRCT2::TileElement* tileElement);
OpenRCT2::TileElement* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants, OpenRCT2::TileElementType type);
template<typename T = TileElement>
template<typename T = OpenRCT2::TileElement>
T* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc)
{
auto* element = MapGetFirstTileElementWithBaseHeightBetween(loc, T::kElementType);
@@ -199,7 +201,7 @@ struct TileElementIterator
{
int32_t x;
int32_t y;
TileElement* element;
OpenRCT2::TileElement* element;
};
#ifdef PLATFORM_32BIT
static_assert(sizeof(TileElementIterator) == 12);
@@ -212,7 +214,7 @@ void TileElementIteratorRestartForTile(TileElementIterator* it);
void MapUpdateTiles();
int32_t MapGetHighestZ(const CoordsXY& loc);
bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const TileElement* const elementToBeRemoved);
bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const OpenRCT2::TileElement* const elementToBeRemoved);
void MapRemoveOutOfRangeElements();
void MapExtendBoundarySurfaceX();
@@ -224,30 +226,33 @@ void MapInvalidateTile(const CoordsXYRangedZ& tilePos);
void MapInvalidateTileZoom1(const CoordsXYRangedZ& tilePos);
void MapInvalidateTileZoom0(const CoordsXYRangedZ& tilePos);
void MapInvalidateTileFull(const CoordsXY& tilePos);
void MapInvalidateElement(const CoordsXY& elementPos, TileElement* tileElement);
void MapInvalidateElement(const CoordsXY& elementPos, OpenRCT2::TileElement* tileElement);
void MapInvalidateRegion(const CoordsXY& mins, const CoordsXY& maxs);
int32_t MapGetTileSide(const CoordsXY& mapPos);
int32_t MapGetTileQuadrant(const CoordsXY& mapPos);
int32_t MapGetCornerHeight(int32_t z, int32_t slope, int32_t direction);
int32_t TileElementGetCornerHeight(const SurfaceElement* surfaceElement, int32_t direction);
int32_t TileElementGetCornerHeight(const OpenRCT2::SurfaceElement* surfaceElement, int32_t direction);
void MapClearAllElements();
void ClearElementAt(const CoordsXY& loc, TileElement** elementPtr);
void ClearElementAt(const CoordsXY& loc, OpenRCT2::TileElement** elementPtr);
LargeSceneryElement* MapGetLargeScenerySegment(const CoordsXYZD& sceneryPos, int32_t sequence);
OpenRCT2::LargeSceneryElement* MapGetLargeScenerySegment(const CoordsXYZD& sceneryPos, int32_t sequence);
std::optional<CoordsXYZ> MapLargeSceneryGetOrigin(
const CoordsXYZD& sceneryPos, int32_t sequence, LargeSceneryElement** outElement);
const CoordsXYZD& sceneryPos, int32_t sequence, OpenRCT2::LargeSceneryElement** outElement);
TrackElement* MapGetTrackElementAt(const CoordsXYZ& trackPos);
TileElement* MapGetTrackElementAtOfType(const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType);
TileElement* MapGetTrackElementAtOfTypeSeq(const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType, int32_t sequence);
TrackElement* MapGetTrackElementAtOfType(const CoordsXYZD& location, OpenRCT2::TrackElemType trackType);
TrackElement* MapGetTrackElementAtOfTypeSeq(const CoordsXYZD& location, OpenRCT2::TrackElemType trackType, int32_t sequence);
TileElement* MapGetTrackElementAtOfTypeFromRide(const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType, RideId rideIndex);
TileElement* MapGetTrackElementAtFromRide(const CoordsXYZ& trackPos, RideId rideIndex);
TileElement* MapGetTrackElementAtWithDirectionFromRide(const CoordsXYZD& trackPos, RideId rideIndex);
TileElement* MapGetTrackElementAtBeforeSurfaceFromRide(const CoordsXYZ& trackPos, RideId rideIndex);
OpenRCT2::TrackElement* MapGetTrackElementAt(const CoordsXYZ& trackPos);
OpenRCT2::TileElement* MapGetTrackElementAtOfType(const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType);
OpenRCT2::TileElement* MapGetTrackElementAtOfTypeSeq(
const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType, int32_t sequence);
OpenRCT2::TrackElement* MapGetTrackElementAtOfType(const CoordsXYZD& location, OpenRCT2::TrackElemType trackType);
OpenRCT2::TrackElement* MapGetTrackElementAtOfTypeSeq(
const CoordsXYZD& location, OpenRCT2::TrackElemType trackType, int32_t sequence);
OpenRCT2::TileElement* MapGetTrackElementAtOfTypeFromRide(
const CoordsXYZ& trackPos, OpenRCT2::TrackElemType trackType, RideId rideIndex);
OpenRCT2::TileElement* MapGetTrackElementAtFromRide(const CoordsXYZ& trackPos, RideId rideIndex);
OpenRCT2::TileElement* MapGetTrackElementAtWithDirectionFromRide(const CoordsXYZD& trackPos, RideId rideIndex);
OpenRCT2::TileElement* MapGetTrackElementAtBeforeSurfaceFromRide(const CoordsXYZ& trackPos, RideId rideIndex);
bool MapIsLocationAtEdge(const CoordsXY& loc);

View File

@@ -11,6 +11,8 @@
#include "tile_element/Slope.h"
using namespace OpenRCT2;
// 0x00981A1E
// Table of pre-calculated surface slopes (32) when raising the land tile for a given selection (5)
// 0x1F = new slope

View File

@@ -12,7 +12,11 @@
#include "Location.hpp"
struct Banner;
struct TileElement;
namespace OpenRCT2
{
struct TileElement;
}
namespace OpenRCT2::GameActions
{
@@ -21,14 +25,14 @@ namespace OpenRCT2::GameActions
namespace OpenRCT2::TileInspector
{
TileElement* GetSelectedElement();
OpenRCT2::TileElement* GetSelectedElement();
GameActions::Result InsertCorruptElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActions::Result RemoveElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting);
GameActions::Result SwapElementsAt(const CoordsXY& loc, int16_t first, int16_t second, bool isExecuting);
GameActions::Result RotateElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActions::Result ToggleInvisibilityOfElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting);
GameActions::Result PasteElementAt(const CoordsXY& loc, TileElement element, Banner banner, bool isExecuting);
GameActions::Result PasteElementAt(const CoordsXY& loc, OpenRCT2::TileElement element, Banner banner, bool isExecuting);
GameActions::Result SortElementsAt(const CoordsXY& loc, bool isExecuting);
GameActions::Result AnyBaseHeightOffset(const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting);
GameActions::Result SurfaceShowParkFences(const CoordsXY& loc, bool showFences, bool isExecuting);

View File

@@ -13,6 +13,8 @@
#include "tile_element/TileElement.h"
#include "tile_element/WallElement.h"
using namespace OpenRCT2;
/**
*
* rct2: 0x006E588E

View File

@@ -5,55 +5,56 @@
#include "../../object/ObjectManager.h"
#include "../Banner.h"
using namespace OpenRCT2;
Banner* BannerElement::GetBanner() const
namespace OpenRCT2
{
return ::GetBanner(GetIndex());
}
const BannerSceneryEntry* BannerElement::GetEntry() const
{
auto banner = GetBanner();
if (banner != nullptr)
Banner* BannerElement::GetBanner() const
{
return OpenRCT2::ObjectManager::GetObjectEntry<BannerSceneryEntry>(banner->type);
return ::GetBanner(GetIndex());
}
return nullptr;
}
BannerIndex BannerElement::GetIndex() const
{
return index;
}
const BannerSceneryEntry* BannerElement::GetEntry() const
{
auto banner = GetBanner();
if (banner != nullptr)
{
return OpenRCT2::ObjectManager::GetObjectEntry<BannerSceneryEntry>(banner->type);
}
return nullptr;
}
void BannerElement::SetIndex(BannerIndex newIndex)
{
index = newIndex;
}
BannerIndex BannerElement::GetIndex() const
{
return index;
}
uint8_t BannerElement::GetPosition() const
{
return position;
}
void BannerElement::SetIndex(BannerIndex newIndex)
{
index = newIndex;
}
void BannerElement::SetPosition(uint8_t newPosition)
{
position = newPosition;
}
uint8_t BannerElement::GetPosition() const
{
return position;
}
uint8_t BannerElement::GetAllowedEdges() const
{
return AllowedEdges & 0b00001111;
}
void BannerElement::SetPosition(uint8_t newPosition)
{
position = newPosition;
}
void BannerElement::SetAllowedEdges(uint8_t newEdges)
{
AllowedEdges &= ~0b00001111;
AllowedEdges |= (newEdges & 0b00001111);
}
uint8_t BannerElement::GetAllowedEdges() const
{
return AllowedEdges & 0b00001111;
}
void BannerElement::ResetAllowedEdges()
{
AllowedEdges |= 0b00001111;
}
void BannerElement::SetAllowedEdges(uint8_t newEdges)
{
AllowedEdges &= ~0b00001111;
AllowedEdges |= (newEdges & 0b00001111);
}
void BannerElement::ResetAllowedEdges()
{
AllowedEdges |= 0b00001111;
}
} // namespace OpenRCT2

View File

@@ -15,34 +15,34 @@
namespace OpenRCT2
{
struct BannerSceneryEntry;
}
#pragma pack(push, 1)
struct BannerElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Banner;
struct BannerElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Banner;
private:
BannerIndex index; // 5
uint8_t position; // 7
uint8_t AllowedEdges; // 8
private:
BannerIndex index; // 5
uint8_t position; // 7
uint8_t AllowedEdges; // 8
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t Pad09[7];
uint8_t Pad09[7];
#pragma clang diagnostic pop
public:
Banner* GetBanner() const;
const OpenRCT2::BannerSceneryEntry* GetEntry() const;
public:
Banner* GetBanner() const;
const BannerSceneryEntry* GetEntry() const;
BannerIndex GetIndex() const;
void SetIndex(BannerIndex newIndex);
BannerIndex GetIndex() const;
void SetIndex(BannerIndex newIndex);
uint8_t GetPosition() const;
void SetPosition(uint8_t newPosition);
uint8_t GetPosition() const;
void SetPosition(uint8_t newPosition);
uint8_t GetAllowedEdges() const;
void SetAllowedEdges(uint8_t newEdges);
void ResetAllowedEdges();
};
static_assert(sizeof(BannerElement) == kTileElementSize);
uint8_t GetAllowedEdges() const;
void SetAllowedEdges(uint8_t newEdges);
void ResetAllowedEdges();
};
static_assert(sizeof(BannerElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -16,130 +16,131 @@
#include "../../object/ObjectManager.h"
#include "../Entrance.h"
using namespace OpenRCT2;
// rct2: 0x0097B974
static constexpr uint16_t kEntranceDirections[] = {
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_ENTRANCE,
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_EXIT,
(4 | 1), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_PARK_ENTRANCE
};
uint8_t EntranceElement::GetEntranceType() const
namespace OpenRCT2
{
return entranceType;
}
// rct2: 0x0097B974
static constexpr uint16_t kEntranceDirections[] = {
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_ENTRANCE,
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_EXIT,
(4 | 1), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_PARK_ENTRANCE
};
void EntranceElement::SetEntranceType(uint8_t newType)
{
entranceType = newType;
}
RideId EntranceElement::GetRideIndex() const
{
return rideIndex;
}
void EntranceElement::SetRideIndex(RideId newRideIndex)
{
rideIndex = newRideIndex;
}
StationIndex EntranceElement::GetStationIndex() const
{
return stationIndex;
}
void EntranceElement::SetStationIndex(StationIndex newStationIndex)
{
stationIndex = newStationIndex;
}
uint8_t EntranceElement::GetSequenceIndex() const
{
return SequenceIndex & 0xF;
}
void EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
SequenceIndex &= ~0xF;
SequenceIndex |= (newSequenceIndex & 0xF);
}
bool EntranceElement::HasLegacyPathEntry() const
{
return (flags2 & ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY) != 0;
}
ObjectEntryIndex EntranceElement::GetLegacyPathEntryIndex() const
{
if (HasLegacyPathEntry())
return PathType;
return kObjectEntryIndexNull;
}
const FootpathObject* EntranceElement::GetLegacyPathEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathObject>(GetLegacyPathEntryIndex());
}
void EntranceElement::SetLegacyPathEntryIndex(ObjectEntryIndex newPathType)
{
PathType = newPathType;
flags2 |= ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
ObjectEntryIndex EntranceElement::GetSurfaceEntryIndex() const
{
if (HasLegacyPathEntry())
return kObjectEntryIndexNull;
return PathType;
}
const FootpathSurfaceObject* EntranceElement::GetSurfaceEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathSurfaceObject>(GetSurfaceEntryIndex());
}
void EntranceElement::SetSurfaceEntryIndex(ObjectEntryIndex newIndex)
{
PathType = newIndex;
flags2 &= ~ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
const PathSurfaceDescriptor* EntranceElement::GetPathSurfaceDescriptor() const
{
if (HasLegacyPathEntry())
uint8_t EntranceElement::GetEntranceType() const
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
return &legacyPathEntry->GetPathSurfaceDescriptor();
return entranceType;
}
const auto* surfaceEntry = GetSurfaceEntry();
if (surfaceEntry == nullptr)
return nullptr;
void EntranceElement::SetEntranceType(uint8_t newType)
{
entranceType = newType;
}
return &surfaceEntry->GetDescriptor();
}
RideId EntranceElement::GetRideIndex() const
{
return rideIndex;
}
int32_t EntranceElement::GetDirections() const
{
return kEntranceDirections[(GetEntranceType() * 8) + GetSequenceIndex()];
}
void EntranceElement::SetRideIndex(RideId newRideIndex)
{
rideIndex = newRideIndex;
}
ObjectEntryIndex EntranceElement::getEntryIndex() const
{
return entryIndex;
}
StationIndex EntranceElement::GetStationIndex() const
{
return stationIndex;
}
void EntranceElement::setEntryIndex(ObjectEntryIndex newIndex)
{
entryIndex = newIndex;
}
void EntranceElement::SetStationIndex(StationIndex newStationIndex)
{
stationIndex = newStationIndex;
}
uint8_t EntranceElement::GetSequenceIndex() const
{
return SequenceIndex & 0xF;
}
void EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
SequenceIndex &= ~0xF;
SequenceIndex |= (newSequenceIndex & 0xF);
}
bool EntranceElement::HasLegacyPathEntry() const
{
return (flags2 & ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY) != 0;
}
ObjectEntryIndex EntranceElement::GetLegacyPathEntryIndex() const
{
if (HasLegacyPathEntry())
return PathType;
return kObjectEntryIndexNull;
}
const FootpathObject* EntranceElement::GetLegacyPathEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathObject>(GetLegacyPathEntryIndex());
}
void EntranceElement::SetLegacyPathEntryIndex(ObjectEntryIndex newPathType)
{
PathType = newPathType;
flags2 |= ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
ObjectEntryIndex EntranceElement::GetSurfaceEntryIndex() const
{
if (HasLegacyPathEntry())
return kObjectEntryIndexNull;
return PathType;
}
const FootpathSurfaceObject* EntranceElement::GetSurfaceEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathSurfaceObject>(GetSurfaceEntryIndex());
}
void EntranceElement::SetSurfaceEntryIndex(ObjectEntryIndex newIndex)
{
PathType = newIndex;
flags2 &= ~ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
const PathSurfaceDescriptor* EntranceElement::GetPathSurfaceDescriptor() const
{
if (HasLegacyPathEntry())
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
return &legacyPathEntry->GetPathSurfaceDescriptor();
}
const auto* surfaceEntry = GetSurfaceEntry();
if (surfaceEntry == nullptr)
return nullptr;
return &surfaceEntry->GetDescriptor();
}
int32_t EntranceElement::GetDirections() const
{
return kEntranceDirections[(GetEntranceType() * 8) + GetSequenceIndex()];
}
ObjectEntryIndex EntranceElement::getEntryIndex() const
{
return entryIndex;
}
void EntranceElement::setEntryIndex(ObjectEntryIndex newIndex)
{
entryIndex = newIndex;
}
} // namespace OpenRCT2

View File

@@ -18,74 +18,77 @@
#include <cstdint>
enum
namespace OpenRCT2
{
ENTRANCE_TYPE_RIDE_ENTRANCE,
ENTRANCE_TYPE_RIDE_EXIT,
ENTRANCE_TYPE_PARK_ENTRANCE
};
enum
{
ENTRANCE_TYPE_RIDE_ENTRANCE,
ENTRANCE_TYPE_RIDE_EXIT,
ENTRANCE_TYPE_PARK_ENTRANCE
};
enum
{
ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY = (1 << 0),
};
enum
{
ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY = (1 << 0),
};
namespace OpenRCT2::EntranceSequence
{
constexpr uint8_t Centre = 0;
constexpr uint8_t Left = 1;
constexpr uint8_t Right = 2;
}; // namespace OpenRCT2::EntranceSequence
namespace EntranceSequence
{
constexpr uint8_t Centre = 0;
constexpr uint8_t Left = 1;
constexpr uint8_t Right = 2;
}; // namespace EntranceSequence
#pragma pack(push, 1)
struct EntranceElement;
struct EntranceElement;
struct EntranceElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Entrance;
struct EntranceElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Entrance;
private:
uint8_t entranceType; // 5
uint8_t SequenceIndex; // 6. Only uses the lower nibble.
StationIndex stationIndex; // 7
OpenRCT2::ObjectEntryIndex PathType; // 8
RideId rideIndex; // A
uint8_t flags2; // C
OpenRCT2::ObjectEntryIndex entryIndex; // D
private:
uint8_t entranceType; // 5
uint8_t SequenceIndex; // 6. Only uses the lower nibble.
StationIndex stationIndex; // 7
ObjectEntryIndex PathType; // 8
RideId rideIndex; // A
uint8_t flags2; // C
ObjectEntryIndex entryIndex; // D
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t Pad0F[1];
uint8_t Pad0F[1];
#pragma clang diagnostic pop
public:
uint8_t GetEntranceType() const;
void SetEntranceType(uint8_t newType);
public:
uint8_t GetEntranceType() const;
void SetEntranceType(uint8_t newType);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
bool HasLegacyPathEntry() const;
bool HasLegacyPathEntry() const;
OpenRCT2::ObjectEntryIndex GetLegacyPathEntryIndex() const;
const OpenRCT2::FootpathObject* GetLegacyPathEntry() const;
void SetLegacyPathEntryIndex(OpenRCT2::ObjectEntryIndex newPathType);
ObjectEntryIndex GetLegacyPathEntryIndex() const;
const FootpathObject* GetLegacyPathEntry() const;
void SetLegacyPathEntryIndex(ObjectEntryIndex newPathType);
OpenRCT2::ObjectEntryIndex GetSurfaceEntryIndex() const;
const OpenRCT2::FootpathSurfaceObject* GetSurfaceEntry() const;
void SetSurfaceEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
ObjectEntryIndex GetSurfaceEntryIndex() const;
const FootpathSurfaceObject* GetSurfaceEntry() const;
void SetSurfaceEntryIndex(ObjectEntryIndex newIndex);
const PathSurfaceDescriptor* GetPathSurfaceDescriptor() const;
const PathSurfaceDescriptor* GetPathSurfaceDescriptor() const;
int32_t GetDirections() const;
int32_t GetDirections() const;
OpenRCT2::ObjectEntryIndex getEntryIndex() const;
void setEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
};
static_assert(sizeof(EntranceElement) == kTileElementSize);
ObjectEntryIndex getEntryIndex() const;
void setEntryIndex(ObjectEntryIndex newIndex);
};
static_assert(sizeof(EntranceElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -16,94 +16,95 @@
#include <cassert>
using namespace OpenRCT2;
colour_t LargeSceneryElement::GetPrimaryColour() const
namespace OpenRCT2
{
return Colour[0];
}
colour_t LargeSceneryElement::GetSecondaryColour() const
{
return Colour[1];
}
colour_t LargeSceneryElement::GetTertiaryColour() const
{
return Colour[2];
}
void LargeSceneryElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[0] = newColour;
}
void LargeSceneryElement::SetSecondaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[1] = newColour;
}
void LargeSceneryElement::SetTertiaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[2] = newColour;
}
Banner* LargeSceneryElement::GetBanner() const
{
return ::GetBanner(GetBannerIndex());
}
BannerIndex LargeSceneryElement::GetBannerIndex() const
{
return BannerIndex;
}
void LargeSceneryElement::SetBannerIndex(::BannerIndex newIndex)
{
this->BannerIndex = newIndex;
}
bool LargeSceneryElement::IsAccounted() const
{
return (Flags2 & LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED) != 0;
}
void LargeSceneryElement::SetIsAccounted(bool isAccounted)
{
if (isAccounted)
colour_t LargeSceneryElement::GetPrimaryColour() const
{
Flags2 |= LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
return Colour[0];
}
else
colour_t LargeSceneryElement::GetSecondaryColour() const
{
Flags2 &= ~LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
return Colour[1];
}
}
ObjectEntryIndex LargeSceneryElement::GetEntryIndex() const
{
return EntryIndex;
}
colour_t LargeSceneryElement::GetTertiaryColour() const
{
return Colour[2];
}
const LargeSceneryEntry* LargeSceneryElement::GetEntry() const
{
return OpenRCT2::ObjectManager::GetObjectEntry<LargeSceneryEntry>(GetEntryIndex());
}
void LargeSceneryElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[0] = newColour;
}
uint8_t LargeSceneryElement::GetSequenceIndex() const
{
return SequenceIndex;
}
void LargeSceneryElement::SetSecondaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[1] = newColour;
}
void LargeSceneryElement::SetEntryIndex(ObjectEntryIndex newIndex)
{
EntryIndex = newIndex;
}
void LargeSceneryElement::SetTertiaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[2] = newColour;
}
void LargeSceneryElement::SetSequenceIndex(uint8_t sequence)
{
SequenceIndex = sequence;
}
Banner* LargeSceneryElement::GetBanner() const
{
return ::GetBanner(GetBannerIndex());
}
BannerIndex LargeSceneryElement::GetBannerIndex() const
{
return BannerIndex;
}
void LargeSceneryElement::SetBannerIndex(::BannerIndex newIndex)
{
this->BannerIndex = newIndex;
}
bool LargeSceneryElement::IsAccounted() const
{
return (Flags2 & LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED) != 0;
}
void LargeSceneryElement::SetIsAccounted(bool isAccounted)
{
if (isAccounted)
{
Flags2 |= LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
}
else
{
Flags2 &= ~LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
}
}
ObjectEntryIndex LargeSceneryElement::GetEntryIndex() const
{
return EntryIndex;
}
const LargeSceneryEntry* LargeSceneryElement::GetEntry() const
{
return OpenRCT2::ObjectManager::GetObjectEntry<LargeSceneryEntry>(GetEntryIndex());
}
uint8_t LargeSceneryElement::GetSequenceIndex() const
{
return SequenceIndex;
}
void LargeSceneryElement::SetEntryIndex(ObjectEntryIndex newIndex)
{
EntryIndex = newIndex;
}
void LargeSceneryElement::SetSequenceIndex(uint8_t sequence)
{
SequenceIndex = sequence;
}
} // namespace OpenRCT2

View File

@@ -16,49 +16,53 @@
struct Banner;
enum
namespace OpenRCT2
{
LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED = 1 << 0,
};
enum
{
LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED = 1 << 0,
};
#pragma pack(push, 1)
struct LargeSceneryElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::LargeScenery;
struct LargeSceneryElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::LargeScenery;
private:
OpenRCT2::ObjectEntryIndex EntryIndex;
::BannerIndex BannerIndex;
uint8_t SequenceIndex;
uint8_t Colour[3];
uint8_t Flags2;
private:
ObjectEntryIndex 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[2];
#pragma clang diagnostic pop
public:
OpenRCT2::ObjectEntryIndex GetEntryIndex() const;
void SetEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
const OpenRCT2::LargeSceneryEntry* GetEntry() const;
const OpenRCT2::LargeSceneryObject* GetObject() const;
public:
ObjectEntryIndex GetEntryIndex() const;
void SetEntryIndex(ObjectEntryIndex newIndex);
const LargeSceneryEntry* GetEntry() const;
const LargeSceneryObject* GetObject() const;
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newIndex);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newIndex);
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);
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);
Banner* GetBanner() const;
::BannerIndex GetBannerIndex() const;
void SetBannerIndex(::BannerIndex newIndex);
Banner* GetBanner() const;
::BannerIndex GetBannerIndex() const;
void SetBannerIndex(::BannerIndex newIndex);
bool IsAccounted() const;
void SetIsAccounted(bool isAccounted);
};
static_assert(sizeof(LargeSceneryElement) == kTileElementSize);
bool IsAccounted() const;
void SetIsAccounted(bool isAccounted);
};
static_assert(sizeof(LargeSceneryElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -19,290 +19,291 @@
#include "../../object/PathAdditionEntry.h"
#include "../Footpath.h"
using namespace OpenRCT2;
bool PathElement::IsSloped() const
namespace OpenRCT2
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED) != 0;
}
void PathElement::SetSloped(bool isSloped)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
if (isSloped)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
}
bool PathElement::HasJunctionRailings() const
{
return Flags2 & FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
}
void PathElement::SetJunctionRailings(bool hasJunctionRailings)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
if (hasJunctionRailings)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
}
Direction PathElement::GetSlopeDirection() const
{
return SlopeDirection;
}
void PathElement::SetSlopeDirection(Direction newSlope)
{
SlopeDirection = newSlope;
}
bool PathElement::IsQueue() const
{
return (Type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) != 0;
}
void PathElement::SetIsQueue(bool isQueue)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
if (isQueue)
Type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
}
bool PathElement::HasQueueBanner() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER) != 0;
}
void PathElement::SetHasQueueBanner(bool hasQueueBanner)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
if (hasQueueBanner)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
}
bool PathElement::IsBroken() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN) != 0;
}
void PathElement::SetIsBroken(bool isBroken)
{
if (isBroken)
bool PathElement::IsSloped() const
{
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED) != 0;
}
else
void PathElement::SetSloped(bool isSloped)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
if (isSloped)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_IS_SLOPED;
}
}
bool PathElement::IsBlockedByVehicle() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE) != 0;
}
void PathElement::SetIsBlockedByVehicle(bool isBlocked)
{
if (isBlocked)
bool PathElement::HasJunctionRailings() const
{
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
return Flags2 & FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
}
else
void PathElement::SetJunctionRailings(bool hasJunctionRailings)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
if (hasJunctionRailings)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS;
}
}
::StationIndex PathElement::GetStationIndex() const
{
return StationIndex;
}
Direction PathElement::GetSlopeDirection() const
{
return SlopeDirection;
}
void PathElement::SetStationIndex(::StationIndex newStationIndex)
{
StationIndex = newStationIndex;
}
void PathElement::SetSlopeDirection(Direction newSlope)
{
SlopeDirection = newSlope;
}
bool PathElement::IsWide() const
{
return (Type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE) != 0;
}
bool PathElement::IsQueue() const
{
return (Type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE) != 0;
}
void PathElement::SetWide(bool isWide)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
if (isWide)
Type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
}
void PathElement::SetIsQueue(bool isQueue)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
if (isQueue)
Type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
}
bool PathElement::HasAddition() const
{
return Additions != 0;
}
bool PathElement::HasQueueBanner() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER) != 0;
}
uint8_t PathElement::GetAddition() const
{
return Additions;
}
void PathElement::SetHasQueueBanner(bool hasQueueBanner)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
if (hasQueueBanner)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_HAS_QUEUE_BANNER;
}
ObjectEntryIndex PathElement::GetAdditionEntryIndex() const
{
// `Additions` is set to 0 when there is no addition, so the value 1 corresponds with path addition slot 0, etc.
return GetAddition() - 1;
}
bool PathElement::IsBroken() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN) != 0;
}
const PathAdditionEntry* PathElement::GetAdditionEntry() const
{
if (!HasAddition())
return nullptr;
return OpenRCT2::ObjectManager::GetObjectEntry<PathAdditionEntry>(GetAdditionEntryIndex());
}
void PathElement::SetIsBroken(bool isBroken)
{
if (isBroken)
{
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
}
else
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_BROKEN;
}
}
void PathElement::SetAddition(uint8_t newAddition)
{
Additions = newAddition;
}
bool PathElement::IsBlockedByVehicle() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE) != 0;
}
void PathElement::SetAdditionEntryIndex(ObjectEntryIndex entryIndex)
{
// `Additions` is set to 0 when there is no addition, so the value 1 corresponds with path addition slot 0, etc.
Additions = entryIndex + 1;
}
void PathElement::SetIsBlockedByVehicle(bool isBlocked)
{
if (isBlocked)
{
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
}
else
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_BLOCKED_BY_VEHICLE;
}
}
bool PathElement::AdditionIsGhost() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST) != 0;
}
::StationIndex PathElement::GetStationIndex() const
{
return StationIndex;
}
void PathElement::SetAdditionIsGhost(bool isGhost)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
if (isGhost)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
}
void PathElement::SetStationIndex(::StationIndex newStationIndex)
{
StationIndex = newStationIndex;
}
bool PathElement::IsWide() const
{
return (Type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE) != 0;
}
void PathElement::SetWide(bool isWide)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
if (isWide)
Type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
}
bool PathElement::HasAddition() const
{
return Additions != 0;
}
uint8_t PathElement::GetAddition() const
{
return Additions;
}
ObjectEntryIndex PathElement::GetAdditionEntryIndex() const
{
// `Additions` is set to 0 when there is no addition, so the value 1 corresponds with path addition slot 0, etc.
return GetAddition() - 1;
}
const PathAdditionEntry* PathElement::GetAdditionEntry() const
{
if (!HasAddition())
return nullptr;
return ObjectManager::GetObjectEntry<PathAdditionEntry>(GetAdditionEntryIndex());
}
void PathElement::SetAddition(uint8_t newAddition)
{
Additions = newAddition;
}
void PathElement::SetAdditionEntryIndex(ObjectEntryIndex entryIndex)
{
// `Additions` is set to 0 when there is no addition, so the value 1 corresponds with path addition slot 0, etc.
Additions = entryIndex + 1;
}
bool PathElement::AdditionIsGhost() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST) != 0;
}
void PathElement::SetAdditionIsGhost(bool isGhost)
{
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
if (isGhost)
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_ADDITION_IS_GHOST;
}
ObjectEntryIndex PathElement::GetLegacyPathEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return SurfaceIndex;
return kObjectEntryIndexNull;
}
const FootpathObject* PathElement::GetLegacyPathEntry() const
{
return GetLegacyFootpathEntry(GetLegacyPathEntryIndex());
}
void PathElement::SetLegacyPathEntryIndex(ObjectEntryIndex newIndex)
{
SurfaceIndex = newIndex;
RailingsIndex = kObjectEntryIndexNull;
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
bool PathElement::HasLegacyPathEntry() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY) != 0;
}
const PathSurfaceDescriptor* PathElement::GetSurfaceDescriptor() const
{
if (HasLegacyPathEntry())
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
if (IsQueue())
return &legacyPathEntry->GetQueueSurfaceDescriptor();
return &legacyPathEntry->GetPathSurfaceDescriptor();
}
const auto* surfaceEntry = GetSurfaceEntry();
if (surfaceEntry == nullptr)
return nullptr;
return &surfaceEntry->GetDescriptor();
}
const PathRailingsDescriptor* PathElement::GetRailingsDescriptor() const
{
if (HasLegacyPathEntry())
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
return &legacyPathEntry->GetPathRailingsDescriptor();
}
const auto* railingsEntry = GetRailingsEntry();
if (railingsEntry == nullptr)
return nullptr;
return &railingsEntry->GetDescriptor();
}
ObjectEntryIndex PathElement::GetSurfaceEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return kObjectEntryIndexNull;
ObjectEntryIndex PathElement::GetLegacyPathEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return SurfaceIndex;
return kObjectEntryIndexNull;
}
const FootpathObject* PathElement::GetLegacyPathEntry() const
{
return GetLegacyFootpathEntry(GetLegacyPathEntryIndex());
}
void PathElement::SetLegacyPathEntryIndex(ObjectEntryIndex newIndex)
{
SurfaceIndex = newIndex;
RailingsIndex = kObjectEntryIndexNull;
Flags2 |= FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
bool PathElement::HasLegacyPathEntry() const
{
return (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY) != 0;
}
const PathSurfaceDescriptor* PathElement::GetSurfaceDescriptor() const
{
if (HasLegacyPathEntry())
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
if (IsQueue())
return &legacyPathEntry->GetQueueSurfaceDescriptor();
return &legacyPathEntry->GetPathSurfaceDescriptor();
}
const auto* surfaceEntry = GetSurfaceEntry();
if (surfaceEntry == nullptr)
return nullptr;
return &surfaceEntry->GetDescriptor();
}
const PathRailingsDescriptor* PathElement::GetRailingsDescriptor() const
{
if (HasLegacyPathEntry())
const FootpathSurfaceObject* PathElement::GetSurfaceEntry() const
{
const auto* legacyPathEntry = GetLegacyPathEntry();
if (legacyPathEntry == nullptr)
return nullptr;
return &legacyPathEntry->GetPathRailingsDescriptor();
auto& objMgr = GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathSurfaceObject>(GetSurfaceEntryIndex());
}
const auto* railingsEntry = GetRailingsEntry();
if (railingsEntry == nullptr)
return nullptr;
void PathElement::SetSurfaceEntryIndex(ObjectEntryIndex newIndex)
{
SurfaceIndex = newIndex;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
return &railingsEntry->GetDescriptor();
}
ObjectEntryIndex PathElement::GetRailingsEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return kObjectEntryIndexNull;
ObjectEntryIndex PathElement::GetSurfaceEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return kObjectEntryIndexNull;
return RailingsIndex;
}
return SurfaceIndex;
}
const FootpathRailingsObject* PathElement::GetRailingsEntry() const
{
auto& objMgr = GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathRailingsObject>(GetRailingsEntryIndex());
}
const FootpathSurfaceObject* PathElement::GetSurfaceEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathSurfaceObject>(GetSurfaceEntryIndex());
}
void PathElement::SetRailingsEntryIndex(ObjectEntryIndex newEntryIndex)
{
RailingsIndex = newEntryIndex;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
void PathElement::SetSurfaceEntryIndex(ObjectEntryIndex newIndex)
{
SurfaceIndex = newIndex;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
uint8_t PathElement::GetQueueBannerDirection() const
{
return ((Type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
}
ObjectEntryIndex PathElement::GetRailingsEntryIndex() const
{
if (Flags2 & FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY)
return kObjectEntryIndexNull;
void PathElement::SetQueueBannerDirection(uint8_t direction)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
Type |= (direction << 6);
}
return RailingsIndex;
}
bool PathElement::ShouldDrawPathOverSupports() const
{
// TODO: make this an actual decision of the tile element.
return (GetRailingsDescriptor()->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS);
}
const FootpathRailingsObject* PathElement::GetRailingsEntry() const
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
return objMgr.GetLoadedObject<FootpathRailingsObject>(GetRailingsEntryIndex());
}
void PathElement::SetRailingsEntryIndex(ObjectEntryIndex newEntryIndex)
{
RailingsIndex = newEntryIndex;
Flags2 &= ~FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
}
uint8_t PathElement::GetQueueBannerDirection() const
{
return ((Type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
}
void PathElement::SetQueueBannerDirection(uint8_t direction)
{
Type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
Type |= (direction << 6);
}
bool PathElement::ShouldDrawPathOverSupports() const
{
// TODO: make this an actual decision of the tile element.
return (GetRailingsDescriptor()->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS);
}
void PathElement::SetShouldDrawPathOverSupports(bool on)
{
LOG_VERBOSE("Setting 'draw path over supports' to %d", static_cast<size_t>(on));
}
void PathElement::SetShouldDrawPathOverSupports(bool on)
{
LOG_VERBOSE("Setting 'draw path over supports' to %d", static_cast<size_t>(on));
}
} // namespace OpenRCT2

View File

@@ -12,6 +12,9 @@
#include "../../Identifiers.h"
#include "TileElementBase.h"
struct PathRailingsDescriptor;
struct PathSurfaceDescriptor;
namespace OpenRCT2
{
class FootpathObject;
@@ -20,138 +23,135 @@ namespace OpenRCT2
struct PathAdditionEntry;
using ObjectEntryIndex = uint16_t;
} // namespace OpenRCT2
struct PathRailingsDescriptor;
struct PathSurfaceDescriptor;
// Masks for values stored in TileElement.type
enum
{
FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE = (1 << 0),
FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE = (1 << 1),
FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK = (1 << 6) | (1 << 7),
};
// Masks for values stored in TileElement.type
enum
{
FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE = (1 << 0),
FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE = (1 << 1),
FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK = (1 << 6) | (1 << 7),
};
// Masks and flags for values stored in TileElement.properties.path.type
enum
{
FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK = (1 << 0) | (1 << 1),
FOOTPATH_PROPERTIES_FLAG_IS_SLOPED = (1 << 2),
FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER = (1 << 3),
FOOTPATH_PROPERTIES_TYPE_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
};
// Masks and flags for values stored in TileElement.properties.path.type
enum
{
FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK = (1 << 0) | (1 << 1),
FOOTPATH_PROPERTIES_FLAG_IS_SLOPED = (1 << 2),
FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER = (1 << 3),
FOOTPATH_PROPERTIES_TYPE_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
};
// Masks and flags for values stored in TileElement.properties.path.edges
enum
{
FOOTPATH_PROPERTIES_EDGES_EDGES_MASK = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
};
// Masks and flags for values stored in TileElement.properties.path.edges
enum
{
FOOTPATH_PROPERTIES_EDGES_EDGES_MASK = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
};
enum
{
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),
FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY = (1 << 5),
FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS = (1 << 6),
};
enum
{
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),
FOOTPATH_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY = (1 << 5),
FOOTPATH_ELEMENT_FLAGS2_HAS_JUNCTION_RAILINGS = (1 << 6),
};
#pragma pack(push, 1)
struct PathElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Path;
private:
OpenRCT2::ObjectEntryIndex SurfaceIndex; // 5
OpenRCT2::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
struct PathElement : TileElementBase
{
uint8_t AdditionStatus; // 13, only used for litter bins
RideId rideIndex; // 13
static constexpr TileElementType kElementType = TileElementType::Path;
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
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);
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);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
::StationIndex GetStationIndex() const;
void SetStationIndex(::StationIndex newStationIndex);
bool IsWide() const;
void SetWide(bool isWide);
bool IsQueue() const;
void SetIsQueue(bool isQueue);
bool HasQueueBanner() const;
void SetHasQueueBanner(bool hasQueueBanner);
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 PathAdditionEntry* GetAdditionEntry() const;
void SetAddition(uint8_t newAddition);
void SetAdditionEntryIndex(ObjectEntryIndex entryIndex);
bool AdditionIsGhost() const;
void SetAdditionIsGhost(bool isGhost);
uint8_t GetAdditionStatus() const;
void SetAdditionStatus(uint8_t newStatus);
bool ShouldDrawPathOverSupports() const;
void SetShouldDrawPathOverSupports(bool on);
bool IsLevelCrossing(const CoordsXY& coords) const;
};
::StationIndex StationIndex; // 15
public:
OpenRCT2::ObjectEntryIndex GetLegacyPathEntryIndex() const;
const OpenRCT2::FootpathObject* GetLegacyPathEntry() const;
void SetLegacyPathEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
bool HasLegacyPathEntry() const;
OpenRCT2::ObjectEntryIndex GetSurfaceEntryIndex() const;
const OpenRCT2::FootpathSurfaceObject* GetSurfaceEntry() const;
void SetSurfaceEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
OpenRCT2::ObjectEntryIndex GetRailingsEntryIndex() const;
const OpenRCT2::FootpathRailingsObject* GetRailingsEntry() const;
void SetRailingsEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
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);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
::StationIndex GetStationIndex() const;
void SetStationIndex(::StationIndex newStationIndex);
bool IsWide() const;
void SetWide(bool isWide);
bool IsQueue() const;
void SetIsQueue(bool isQueue);
bool HasQueueBanner() const;
void SetHasQueueBanner(bool hasQueueBanner);
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;
OpenRCT2::ObjectEntryIndex GetAdditionEntryIndex() const;
const OpenRCT2::PathAdditionEntry* GetAdditionEntry() const;
void SetAddition(uint8_t newAddition);
void SetAdditionEntryIndex(OpenRCT2::ObjectEntryIndex entryIndex);
bool AdditionIsGhost() const;
void SetAdditionIsGhost(bool isGhost);
uint8_t GetAdditionStatus() const;
void SetAdditionStatus(uint8_t newStatus);
bool ShouldDrawPathOverSupports() const;
void SetShouldDrawPathOverSupports(bool on);
bool IsLevelCrossing(const CoordsXY& coords) const;
};
static_assert(sizeof(PathElement) == kTileElementSize);
static_assert(sizeof(PathElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -11,29 +11,32 @@
#include <cstdint>
constexpr uint8_t kTileSlopeFlat = 0;
constexpr uint8_t kTileSlopeNCornerUp = 0b00000001;
constexpr uint8_t kTileSlopeECornerUp = 0b00000010;
constexpr uint8_t kTileSlopeSCornerUp = 0b00000100;
constexpr uint8_t kTileSlopeWCornerUp = 0b00001000;
constexpr uint8_t kTileSlopeRaisedCornersMask = 0b00001111;
constexpr uint8_t kTileSlopeDiagonalFlag = 0b00010000;
constexpr uint8_t kTileSlopeMask = (kTileSlopeDiagonalFlag | kTileSlopeRaisedCornersMask);
namespace OpenRCT2
{
constexpr uint8_t kTileSlopeFlat = 0;
constexpr uint8_t kTileSlopeNCornerUp = 0b00000001;
constexpr uint8_t kTileSlopeECornerUp = 0b00000010;
constexpr uint8_t kTileSlopeSCornerUp = 0b00000100;
constexpr uint8_t kTileSlopeWCornerUp = 0b00001000;
constexpr uint8_t kTileSlopeRaisedCornersMask = 0b00001111;
constexpr uint8_t kTileSlopeDiagonalFlag = 0b00010000;
constexpr uint8_t kTileSlopeMask = (kTileSlopeDiagonalFlag | kTileSlopeRaisedCornersMask);
constexpr uint8_t kTileSlopeWCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeSCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeSCornerUp;
constexpr uint8_t kTileSlopeECornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeECornerUp;
constexpr uint8_t kTileSlopeNCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeNCornerUp;
constexpr uint8_t kTileSlopeWCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeSCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeSCornerUp;
constexpr uint8_t kTileSlopeECornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeECornerUp;
constexpr uint8_t kTileSlopeNCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeNCornerUp;
constexpr uint8_t kTileSlopeNESideUp = kTileSlopeNCornerUp | kTileSlopeECornerUp;
constexpr uint8_t kTileSlopeSESideUp = kTileSlopeECornerUp | kTileSlopeSCornerUp;
constexpr uint8_t kTileSlopeNWSideUp = kTileSlopeNCornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeSWSideUp = kTileSlopeSCornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeNESideUp = kTileSlopeNCornerUp | kTileSlopeECornerUp;
constexpr uint8_t kTileSlopeSESideUp = kTileSlopeECornerUp | kTileSlopeSCornerUp;
constexpr uint8_t kTileSlopeNWSideUp = kTileSlopeNCornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeSWSideUp = kTileSlopeSCornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeWEValley = kTileSlopeECornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeNSValley = kTileSlopeNCornerUp | kTileSlopeSCornerUp;
constexpr uint8_t kTileSlopeWEValley = kTileSlopeECornerUp | kTileSlopeWCornerUp;
constexpr uint8_t kTileSlopeNSValley = kTileSlopeNCornerUp | kTileSlopeSCornerUp;
// Special value, used for support drawing
constexpr uint8_t kTileSlopeAboveTrackOrScenery = 0b00100000;
// Special value, used when raising/lowering land corners/tiles
constexpr uint8_t kTileSlopeRaiseOrLowerBaseHeight = 0b00100000;
// Special value, used for support drawing
constexpr uint8_t kTileSlopeAboveTrackOrScenery = 0b00100000;
// Special value, used when raising/lowering land corners/tiles
constexpr uint8_t kTileSlopeRaiseOrLowerBaseHeight = 0b00100000;
} // namespace OpenRCT2

View File

@@ -27,105 +27,106 @@
#include <cassert>
using namespace OpenRCT2;
uint8_t SmallSceneryElement::GetSceneryQuadrant() const
namespace OpenRCT2
{
return (this->Type & kTileElementQuadrantMask) >> 6;
}
void SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant)
{
Type &= ~kTileElementQuadrantMask;
Type |= (newQuadrant << 6);
}
uint16_t SmallSceneryElement::GetEntryIndex() const
{
return this->entryIndex;
}
void SmallSceneryElement::SetEntryIndex(uint16_t newIndex)
{
this->entryIndex = newIndex;
}
uint8_t SmallSceneryElement::GetAge() const
{
return this->age;
}
void SmallSceneryElement::SetAge(uint8_t newAge)
{
this->age = newAge;
}
void SmallSceneryElement::IncreaseAge(const CoordsXY& sceneryPos)
{
if (IsGhost())
return;
if (age < 255)
uint8_t SmallSceneryElement::GetSceneryQuadrant() const
{
uint8_t newAge = age++;
return (this->Type & kTileElementQuadrantMask) >> 6;
}
// Only invalidate tiles when scenery crosses the withering thresholds, and can be withered.
if (newAge == kSceneryWitherAgeThreshold1 || newAge == kSceneryWitherAgeThreshold2)
void SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant)
{
Type &= ~kTileElementQuadrantMask;
Type |= (newQuadrant << 6);
}
uint16_t SmallSceneryElement::GetEntryIndex() const
{
return this->entryIndex;
}
void SmallSceneryElement::SetEntryIndex(uint16_t newIndex)
{
this->entryIndex = newIndex;
}
uint8_t SmallSceneryElement::GetAge() const
{
return this->age;
}
void SmallSceneryElement::SetAge(uint8_t newAge)
{
this->age = newAge;
}
void SmallSceneryElement::IncreaseAge(const CoordsXY& sceneryPos)
{
if (IsGhost())
return;
if (age < 255)
{
auto* sceneryEntry = GetEntry();
uint8_t newAge = age++;
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_WITHER))
// Only invalidate tiles when scenery crosses the withering thresholds, and can be withered.
if (newAge == kSceneryWitherAgeThreshold1 || newAge == kSceneryWitherAgeThreshold2)
{
MapInvalidateTileZoom1({ sceneryPos, GetBaseZ(), GetClearanceZ() });
auto* sceneryEntry = GetEntry();
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_WITHER))
{
MapInvalidateTileZoom1({ sceneryPos, GetBaseZ(), GetClearanceZ() });
}
}
}
}
}
colour_t SmallSceneryElement::GetPrimaryColour() const
{
return Colour[0];
}
colour_t SmallSceneryElement::GetPrimaryColour() const
{
return Colour[0];
}
colour_t SmallSceneryElement::GetSecondaryColour() const
{
return Colour[1];
}
colour_t SmallSceneryElement::GetSecondaryColour() const
{
return Colour[1];
}
colour_t SmallSceneryElement::GetTertiaryColour() const
{
return Colour[2];
}
colour_t SmallSceneryElement::GetTertiaryColour() const
{
return Colour[2];
}
void SmallSceneryElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[0] = newColour;
}
void SmallSceneryElement::SetPrimaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[0] = newColour;
}
void SmallSceneryElement::SetSecondaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[1] = newColour;
}
void SmallSceneryElement::SetSecondaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[1] = newColour;
}
void SmallSceneryElement::SetTertiaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[2] = newColour;
}
void SmallSceneryElement::SetTertiaryColour(colour_t newColour)
{
assert(newColour < COLOUR_COUNT);
Colour[2] = newColour;
}
bool SmallSceneryElement::NeedsSupports() const
{
return static_cast<bool>(Flags2 & MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS);
}
bool SmallSceneryElement::NeedsSupports() const
{
return static_cast<bool>(Flags2 & MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS);
}
void SmallSceneryElement::SetNeedsSupports()
{
Flags2 |= MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS;
}
void SmallSceneryElement::SetNeedsSupports()
{
Flags2 |= MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS;
}
const SmallSceneryEntry* SmallSceneryElement::GetEntry() const
{
return OpenRCT2::ObjectManager::GetObjectEntry<SmallSceneryEntry>(entryIndex);
}
const SmallSceneryEntry* SmallSceneryElement::GetEntry() const
{
return ObjectManager::GetObjectEntry<SmallSceneryEntry>(entryIndex);
}
} // namespace OpenRCT2

View File

@@ -14,44 +14,47 @@
#include "../../object/SmallSceneryEntry.h"
#include "TileElementBase.h"
enum
namespace OpenRCT2
{
MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS = (1 << 0),
};
enum
{
MAP_ELEM_SMALL_SCENERY_FLAGS2_NEEDS_SUPPORTS = (1 << 0),
};
#pragma pack(push, 1)
struct SmallSceneryElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::SmallScenery;
struct SmallSceneryElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::SmallScenery;
private:
OpenRCT2::ObjectEntryIndex entryIndex; // 5
uint8_t age; // 7
uint8_t Colour[3]; // 8
uint8_t Flags2; // B
private:
ObjectEntryIndex entryIndex; // 5
uint8_t age; // 7
uint8_t Colour[3]; // 8
uint8_t Flags2; // B
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t Pad0B[4];
uint8_t Pad0B[4];
#pragma clang diagnostic pop
public:
OpenRCT2::ObjectEntryIndex GetEntryIndex() const;
void SetEntryIndex(OpenRCT2::ObjectEntryIndex newIndex);
const OpenRCT2::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);
};
static_assert(sizeof(SmallSceneryElement) == kTileElementSize);
public:
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);
};
static_assert(sizeof(SmallSceneryElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -18,220 +18,221 @@
#include "Slope.h"
#include "TileElement.h"
using namespace OpenRCT2;
ObjectEntryIndex SurfaceElement::GetSurfaceObjectIndex() const
namespace OpenRCT2
{
return SurfaceStyle;
}
TerrainSurfaceObject* SurfaceElement::GetSurfaceObject() const
{
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
return objManager.GetLoadedObject<TerrainSurfaceObject>(GetSurfaceObjectIndex());
}
ObjectEntryIndex SurfaceElement::GetEdgeObjectIndex() const
{
return EdgeObjectIndex;
}
TerrainEdgeObject* SurfaceElement::GetEdgeObject() const
{
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
return objManager.GetLoadedObject<TerrainEdgeObject>(GetEdgeObjectIndex());
}
void SurfaceElement::SetSurfaceObjectIndex(ObjectEntryIndex newStyle)
{
SurfaceStyle = static_cast<ObjectEntryIndex>(newStyle);
}
void SurfaceElement::SetEdgeObjectIndex(ObjectEntryIndex newIndex)
{
EdgeObjectIndex = static_cast<ObjectEntryIndex>(newIndex);
}
int32_t SurfaceElement::GetWaterHeight() const
{
return WaterHeight * kWaterHeightStep;
}
void SurfaceElement::SetWaterHeight(int32_t newWaterHeight)
{
WaterHeight = newWaterHeight / kWaterHeightStep;
}
bool SurfaceElement::CanGrassGrow() const
{
auto surfaceStyle = GetSurfaceObjectIndex();
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
const auto* surfaceObject = objMgr.GetLoadedObject<TerrainSurfaceObject>(surfaceStyle);
if (surfaceObject != nullptr)
ObjectEntryIndex SurfaceElement::GetSurfaceObjectIndex() const
{
if (surfaceObject->Flags & TerrainSurfaceFlags::canGrow)
return SurfaceStyle;
}
TerrainSurfaceObject* SurfaceElement::GetSurfaceObject() const
{
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
return objManager.GetLoadedObject<TerrainSurfaceObject>(GetSurfaceObjectIndex());
}
ObjectEntryIndex SurfaceElement::GetEdgeObjectIndex() const
{
return EdgeObjectIndex;
}
TerrainEdgeObject* SurfaceElement::GetEdgeObject() const
{
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
return objManager.GetLoadedObject<TerrainEdgeObject>(GetEdgeObjectIndex());
}
void SurfaceElement::SetSurfaceObjectIndex(ObjectEntryIndex newStyle)
{
SurfaceStyle = static_cast<ObjectEntryIndex>(newStyle);
}
void SurfaceElement::SetEdgeObjectIndex(ObjectEntryIndex newIndex)
{
EdgeObjectIndex = static_cast<ObjectEntryIndex>(newIndex);
}
int32_t SurfaceElement::GetWaterHeight() const
{
return WaterHeight * kWaterHeightStep;
}
void SurfaceElement::SetWaterHeight(int32_t newWaterHeight)
{
WaterHeight = newWaterHeight / kWaterHeightStep;
}
bool SurfaceElement::CanGrassGrow() const
{
auto surfaceStyle = GetSurfaceObjectIndex();
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
const auto* surfaceObject = objMgr.GetLoadedObject<TerrainSurfaceObject>(surfaceStyle);
if (surfaceObject != nullptr)
{
return true;
}
}
return false;
}
uint8_t SurfaceElement::GetGrassLength() const
{
return GrassLength;
}
void SurfaceElement::SetGrassLength(uint8_t newLength)
{
GrassLength = newLength;
}
void SurfaceElement::SetGrassLengthAndInvalidate(uint8_t length, const CoordsXY& coords)
{
uint8_t oldLength = GrassLength & 0x7;
uint8_t newLength = length & 0x7;
GrassLength = length;
if (newLength == oldLength)
{
return;
}
// If the new grass length won't result in an actual visual change
// then skip invalidating the tile, no point
if (((oldLength > 0 && oldLength < 4) && (newLength > 0 && newLength < 4))
|| ((oldLength > 3 && oldLength < 7) && (newLength > 3 && newLength < 7)))
{
return;
}
int32_t z = GetBaseZ();
MapInvalidateTile({ coords, z, z + 16 });
}
/**
*
* rct2: 0x006647A1
*/
void SurfaceElement::UpdateGrassLength(const CoordsXY& coords)
{
// Check if tile is grass
if (!CanGrassGrow())
return;
uint8_t grassLengthTmp = GrassLength & 7;
// Check if grass is underwater or outside park
if (GetWaterHeight() > GetBaseZ() || !MapIsLocationInPark(coords))
{
if (grassLengthTmp != GRASS_LENGTH_CLEAR_0)
SetGrassLengthAndInvalidate(GRASS_LENGTH_CLEAR_0, coords);
return;
}
// Grass can't grow any further than CLUMPS_2 but this code also cuts grass
// if there is an object placed on top of it.
int32_t baseZ = GetBaseZ();
int32_t clearZ = GetBaseZ() + kLandHeightStep;
if (Slope & kTileSlopeDiagonalFlag)
clearZ += kLandHeightStep;
// Check objects above grass
TileElement* tileElementAbove = reinterpret_cast<TileElement*>(this);
for (;;)
{
if (tileElementAbove->IsLastForTile())
{
// Grow grass
// Check interim grass lengths
uint8_t lengthNibble = (GetGrassLength() & 0xF0) >> 4;
if (lengthNibble < 0xF)
if (surfaceObject->Flags & TerrainSurfaceFlags::canGrow)
{
GrassLength += 0x10;
return true;
}
else
}
return false;
}
uint8_t SurfaceElement::GetGrassLength() const
{
return GrassLength;
}
void SurfaceElement::SetGrassLength(uint8_t newLength)
{
GrassLength = newLength;
}
void SurfaceElement::SetGrassLengthAndInvalidate(uint8_t length, const CoordsXY& coords)
{
uint8_t oldLength = GrassLength & 0x7;
uint8_t newLength = length & 0x7;
GrassLength = length;
if (newLength == oldLength)
{
return;
}
// If the new grass length won't result in an actual visual change
// then skip invalidating the tile, no point
if (((oldLength > 0 && oldLength < 4) && (newLength > 0 && newLength < 4))
|| ((oldLength > 3 && oldLength < 7) && (newLength > 3 && newLength < 7)))
{
return;
}
int32_t z = GetBaseZ();
MapInvalidateTile({ coords, z, z + 16 });
}
/**
*
* rct2: 0x006647A1
*/
void SurfaceElement::UpdateGrassLength(const CoordsXY& coords)
{
// Check if tile is grass
if (!CanGrassGrow())
return;
uint8_t grassLengthTmp = GrassLength & 7;
// Check if grass is underwater or outside park
if (GetWaterHeight() > GetBaseZ() || !MapIsLocationInPark(coords))
{
if (grassLengthTmp != GRASS_LENGTH_CLEAR_0)
SetGrassLengthAndInvalidate(GRASS_LENGTH_CLEAR_0, coords);
return;
}
// Grass can't grow any further than CLUMPS_2 but this code also cuts grass
// if there is an object placed on top of it.
int32_t baseZ = GetBaseZ();
int32_t clearZ = GetBaseZ() + kLandHeightStep;
if (Slope & kTileSlopeDiagonalFlag)
clearZ += kLandHeightStep;
// Check objects above grass
TileElement* tileElementAbove = reinterpret_cast<TileElement*>(this);
for (;;)
{
if (tileElementAbove->IsLastForTile())
{
// Zeros the length nibble
GrassLength += 0x10;
GrassLength ^= 8;
if (GrassLength & 8)
// Grow grass
// Check interim grass lengths
uint8_t lengthNibble = (GetGrassLength() & 0xF0) >> 4;
if (lengthNibble < 0xF)
{
// Random growth rate (length nibble)
GrassLength |= ScenarioRand() & 0x70;
GrassLength += 0x10;
}
else
{
// Increase length if not at max length
if (grassLengthTmp != GRASS_LENGTH_CLUMPS_2)
SetGrassLengthAndInvalidate(grassLengthTmp + 1, coords);
// Zeros the length nibble
GrassLength += 0x10;
GrassLength ^= 8;
if (GrassLength & 8)
{
// Random growth rate (length nibble)
GrassLength |= ScenarioRand() & 0x70;
}
else
{
// Increase length if not at max length
if (grassLengthTmp != GRASS_LENGTH_CLUMPS_2)
SetGrassLengthAndInvalidate(grassLengthTmp + 1, coords);
}
}
}
}
else
{
tileElementAbove++;
if (tileElementAbove->GetType() == TileElementType::Wall)
continue;
// Grass should not be affected by ghost elements.
if (tileElementAbove->IsGhost())
continue;
if (baseZ >= tileElementAbove->GetClearanceZ())
continue;
if (clearZ < tileElementAbove->GetBaseZ())
continue;
else
{
tileElementAbove++;
if (tileElementAbove->GetType() == TileElementType::Wall)
continue;
// Grass should not be affected by ghost elements.
if (tileElementAbove->IsGhost())
continue;
if (baseZ >= tileElementAbove->GetClearanceZ())
continue;
if (clearZ < tileElementAbove->GetBaseZ())
continue;
if (grassLengthTmp != GRASS_LENGTH_CLEAR_0)
SetGrassLengthAndInvalidate(GRASS_LENGTH_CLEAR_0, coords);
if (grassLengthTmp != GRASS_LENGTH_CLEAR_0)
SetGrassLengthAndInvalidate(GRASS_LENGTH_CLEAR_0, coords);
}
break;
}
break;
}
}
uint8_t SurfaceElement::GetOwnership() const
{
return (Ownership & kTileElementSurfaceOwnershipMask);
}
uint8_t SurfaceElement::GetOwnership() const
{
return (Ownership & kTileElementSurfaceOwnershipMask);
}
void SurfaceElement::SetOwnership(uint8_t newOwnership)
{
Ownership &= ~kTileElementSurfaceOwnershipMask;
Ownership |= (newOwnership & kTileElementSurfaceOwnershipMask);
}
void SurfaceElement::SetOwnership(uint8_t newOwnership)
{
Ownership &= ~kTileElementSurfaceOwnershipMask;
Ownership |= (newOwnership & kTileElementSurfaceOwnershipMask);
}
uint8_t SurfaceElement::GetParkFences() const
{
return (Ownership & kTileElementSurfaceParkFenceMask);
}
uint8_t SurfaceElement::GetParkFences() const
{
return (Ownership & kTileElementSurfaceParkFenceMask);
}
void SurfaceElement::SetParkFences(uint8_t newParkFences)
{
Ownership &= ~kTileElementSurfaceParkFenceMask;
Ownership |= (newParkFences & kTileElementSurfaceParkFenceMask);
}
void SurfaceElement::SetParkFences(uint8_t newParkFences)
{
Ownership &= ~kTileElementSurfaceParkFenceMask;
Ownership |= (newParkFences & kTileElementSurfaceParkFenceMask);
}
uint8_t SurfaceElement::GetSlope() const
{
return Slope;
}
uint8_t SurfaceElement::GetSlope() const
{
return Slope;
}
void SurfaceElement::SetSlope(uint8_t newSlope)
{
Slope = newSlope;
}
void SurfaceElement::SetSlope(uint8_t newSlope)
{
Slope = newSlope;
}
bool SurfaceElement::HasTrackThatNeedsWater() const
{
return (Type & SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER) != 0;
}
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;
}
void SurfaceElement::SetHasTrackThatNeedsWater(bool on)
{
Type &= ~SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
if (on)
Type |= SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER;
}
} // namespace OpenRCT2

View File

@@ -13,80 +13,83 @@
#include "../../object/TerrainSurfaceObject.h"
#include "TileElementBase.h"
enum
namespace OpenRCT2
{
SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER = (1 << 6),
};
enum
{
SURFACE_ELEMENT_HAS_TRACK_THAT_NEEDS_WATER = (1 << 6),
};
enum GrassLength : uint8_t
{
GRASS_LENGTH_MOWED,
GRASS_LENGTH_CLEAR_0,
GRASS_LENGTH_CLEAR_1,
GRASS_LENGTH_CLEAR_2,
GRASS_LENGTH_CLUMPS_0,
GRASS_LENGTH_CLUMPS_1,
GRASS_LENGTH_CLUMPS_2,
};
enum GrassLength : uint8_t
{
GRASS_LENGTH_MOWED,
GRASS_LENGTH_CLEAR_0,
GRASS_LENGTH_CLEAR_1,
GRASS_LENGTH_CLEAR_2,
GRASS_LENGTH_CLUMPS_0,
GRASS_LENGTH_CLUMPS_1,
GRASS_LENGTH_CLUMPS_2,
};
enum
{
OWNERSHIP_UNOWNED = 0,
OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED = (1 << 4),
OWNERSHIP_OWNED = (1 << 5),
OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE = (1 << 6),
OWNERSHIP_AVAILABLE = (1 << 7)
};
enum
{
OWNERSHIP_UNOWNED = 0,
OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED = (1 << 4),
OWNERSHIP_OWNED = (1 << 5),
OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE = (1 << 6),
OWNERSHIP_AVAILABLE = (1 << 7)
};
constexpr uint8_t kTileElementSurfaceOwnershipMask = 0xF0;
constexpr uint8_t kTileElementSurfaceParkFenceMask = 0x0F;
constexpr uint8_t kTileElementSurfaceOwnershipMask = 0xF0;
constexpr uint8_t kTileElementSurfaceParkFenceMask = 0x0F;
#pragma pack(push, 1)
struct SurfaceElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Surface;
struct SurfaceElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Surface;
private:
uint8_t Slope;
uint8_t WaterHeight;
uint8_t GrassLength;
uint8_t Ownership;
uint8_t SurfaceStyle;
uint8_t EdgeObjectIndex;
private:
uint8_t Slope;
uint8_t WaterHeight;
uint8_t GrassLength;
uint8_t Ownership;
uint8_t SurfaceStyle;
uint8_t EdgeObjectIndex;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t Pad0B[5];
uint8_t Pad0B[5];
#pragma clang diagnostic pop
public:
uint8_t GetSlope() const;
void SetSlope(uint8_t newSlope);
public:
uint8_t GetSlope() const;
void SetSlope(uint8_t newSlope);
OpenRCT2::ObjectEntryIndex GetSurfaceObjectIndex() const;
OpenRCT2::TerrainSurfaceObject* GetSurfaceObject() const;
void SetSurfaceObjectIndex(OpenRCT2::ObjectEntryIndex newStyle);
ObjectEntryIndex GetSurfaceObjectIndex() const;
TerrainSurfaceObject* GetSurfaceObject() const;
void SetSurfaceObjectIndex(ObjectEntryIndex newStyle);
OpenRCT2::ObjectEntryIndex GetEdgeObjectIndex() const;
OpenRCT2::TerrainEdgeObject* GetEdgeObject() const;
void SetEdgeObjectIndex(OpenRCT2::ObjectEntryIndex newStyle);
ObjectEntryIndex GetEdgeObjectIndex() const;
TerrainEdgeObject* GetEdgeObject() const;
void SetEdgeObjectIndex(ObjectEntryIndex newStyle);
bool CanGrassGrow() const;
uint8_t GetGrassLength() const;
void SetGrassLength(uint8_t newLength);
void SetGrassLengthAndInvalidate(uint8_t newLength, const CoordsXY& coords);
void UpdateGrassLength(const CoordsXY& coords);
bool CanGrassGrow() const;
uint8_t GetGrassLength() const;
void SetGrassLength(uint8_t newLength);
void SetGrassLengthAndInvalidate(uint8_t newLength, const CoordsXY& coords);
void UpdateGrassLength(const CoordsXY& coords);
uint8_t GetOwnership() const;
void SetOwnership(uint8_t newOwnership);
uint8_t GetOwnership() const;
void SetOwnership(uint8_t newOwnership);
int32_t GetWaterHeight() const;
void SetWaterHeight(int32_t newWaterHeight);
int32_t GetWaterHeight() const;
void SetWaterHeight(int32_t newWaterHeight);
uint8_t GetParkFences() const;
void SetParkFences(uint8_t newParkFences);
uint8_t GetParkFences() const;
void SetParkFences(uint8_t newParkFences);
bool HasTrackThatNeedsWater() const;
void SetHasTrackThatNeedsWater(bool on);
};
static_assert(sizeof(SurfaceElement) == kTileElementSize);
bool HasTrackThatNeedsWater() const;
void SetHasTrackThatNeedsWater(bool on);
};
static_assert(sizeof(SurfaceElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -21,100 +21,101 @@
#include "TrackElement.h"
#include "WallElement.h"
using namespace OpenRCT2;
BannerIndex TileElement::GetBannerIndex() const
namespace OpenRCT2
{
switch (GetType())
BannerIndex TileElement::GetBannerIndex() const
{
case TileElementType::LargeScenery:
switch (GetType())
{
auto* sceneryEntry = AsLargeScenery()->GetEntry();
if (sceneryEntry == nullptr || sceneryEntry->scrolling_mode == kScrollingModeNone)
return BannerIndex::GetNull();
case TileElementType::LargeScenery:
{
auto* sceneryEntry = AsLargeScenery()->GetEntry();
if (sceneryEntry == nullptr || sceneryEntry->scrolling_mode == kScrollingModeNone)
return BannerIndex::GetNull();
return AsLargeScenery()->GetBannerIndex();
return AsLargeScenery()->GetBannerIndex();
}
case TileElementType::Wall:
{
auto* wallEntry = AsWall()->GetEntry();
if (wallEntry == nullptr || wallEntry->scrolling_mode == kScrollingModeNone)
return BannerIndex::GetNull();
return AsWall()->GetBannerIndex();
}
case TileElementType::Banner:
return AsBanner()->GetIndex();
default:
return BannerIndex::GetNull();
}
case TileElementType::Wall:
}
void TileElement::SetBannerIndex(BannerIndex bannerIndex)
{
switch (GetType())
{
auto* wallEntry = AsWall()->GetEntry();
if (wallEntry == nullptr || wallEntry->scrolling_mode == kScrollingModeNone)
return BannerIndex::GetNull();
return AsWall()->GetBannerIndex();
case TileElementType::Wall:
AsWall()->SetBannerIndex(bannerIndex);
break;
case TileElementType::LargeScenery:
AsLargeScenery()->SetBannerIndex(bannerIndex);
break;
case TileElementType::Banner:
AsBanner()->SetIndex(bannerIndex);
break;
default:
LOG_ERROR("Tried to set banner index on unsuitable tile element!");
Guard::Assert(false);
}
case TileElementType::Banner:
return AsBanner()->GetIndex();
default:
return BannerIndex::GetNull();
}
}
void TileElement::SetBannerIndex(BannerIndex bannerIndex)
{
switch (GetType())
void TileElement::RemoveBannerEntry()
{
case TileElementType::Wall:
AsWall()->SetBannerIndex(bannerIndex);
break;
case TileElementType::LargeScenery:
AsLargeScenery()->SetBannerIndex(bannerIndex);
break;
case TileElementType::Banner:
AsBanner()->SetIndex(bannerIndex);
break;
default:
LOG_ERROR("Tried to set banner index on unsuitable tile element!");
Guard::Assert(false);
auto bannerIndex = GetBannerIndex();
auto banner = GetBanner(bannerIndex);
if (banner != nullptr)
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->CloseByNumber(WindowClass::Banner, bannerIndex.ToUnderlying());
DeleteBanner(banner->id);
}
}
}
void TileElement::RemoveBannerEntry()
{
auto bannerIndex = GetBannerIndex();
auto banner = GetBanner(bannerIndex);
if (banner != nullptr)
RideId TileElement::GetRideIndex() const
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->CloseByNumber(WindowClass::Banner, bannerIndex.ToUnderlying());
DeleteBanner(banner->id);
switch (GetType())
{
case TileElementType::Track:
return AsTrack()->GetRideIndex();
case TileElementType::Entrance:
return AsEntrance()->GetRideIndex();
case TileElementType::Path:
return AsPath()->GetRideIndex();
default:
return RideId::GetNull();
}
}
}
RideId TileElement::GetRideIndex() const
{
switch (GetType())
void TileElement::ClearAs(TileElementType newType)
{
case TileElementType::Track:
return AsTrack()->GetRideIndex();
case TileElementType::Entrance:
return AsEntrance()->GetRideIndex();
case TileElementType::Path:
return AsPath()->GetRideIndex();
default:
return RideId::GetNull();
Type = 0;
SetType(newType);
Flags = 0;
BaseHeight = kMinimumLandHeight;
ClearanceHeight = kMinimumLandHeight;
Owner = 0;
std::fill_n(Pad05, sizeof(Pad05), 0x00);
std::fill_n(Pad08, sizeof(Pad08), 0x00);
}
}
void TileElement::ClearAs(TileElementType newType)
{
Type = 0;
SetType(newType);
Flags = 0;
BaseHeight = kMinimumLandHeight;
ClearanceHeight = kMinimumLandHeight;
Owner = 0;
std::fill_n(Pad05, sizeof(Pad05), 0x00);
std::fill_n(Pad08, sizeof(Pad08), 0x00);
}
bool TileElementIsUnderground(TileElement* tileElement)
{
do
bool TileElementIsUnderground(TileElement* tileElement)
{
tileElement++;
if ((tileElement - 1)->IsLastForTile())
return false;
} while (tileElement->GetType() != TileElementType::Surface);
return true;
}
do
{
tileElement++;
if ((tileElement - 1)->IsLastForTile())
return false;
} while (tileElement->GetType() != TileElementType::Surface);
return true;
}
} // namespace OpenRCT2

View File

@@ -13,26 +13,29 @@
#include "../Banner.h"
#include "TileElementBase.h"
#pragma pack(push, 1)
/**
* Map element structure
* size: 0x10
*/
struct TileElement : public TileElementBase
namespace OpenRCT2
{
uint8_t Pad05[3];
uint8_t Pad08[8];
#pragma pack(push, 1)
/**
* Map element structure
* size: 0x10
*/
struct TileElement : public TileElementBase
{
uint8_t Pad05[3];
uint8_t Pad08[8];
void ClearAs(TileElementType newType);
void ClearAs(TileElementType newType);
RideId GetRideIndex() const;
RideId GetRideIndex() const;
void SetBannerIndex(BannerIndex newIndex);
void RemoveBannerEntry();
BannerIndex GetBannerIndex() const;
};
static_assert(sizeof(TileElement) == kTileElementSize);
void SetBannerIndex(BannerIndex newIndex);
void RemoveBannerEntry();
BannerIndex GetBannerIndex() const;
};
static_assert(sizeof(TileElement) == kTileElementSize);
bool TileElementIsUnderground(TileElement* tileElement);
bool TileElementIsUnderground(TileElement* tileElement);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -21,187 +21,190 @@
#include "TrackElement.h"
#include "WallElement.h"
TileElementType TileElementBase::GetType() const
namespace OpenRCT2
{
return static_cast<TileElementType>((this->Type & kTileElementTypeMask) >> 2);
}
void TileElementBase::SetType(TileElementType newType)
{
this->Type &= ~kTileElementTypeMask;
this->Type |= ((EnumValue(newType) << 2) & kTileElementTypeMask);
}
Direction TileElementBase::GetDirection() const
{
return this->Type & kTileElementDirectionMask;
}
void TileElementBase::SetDirection(Direction direction)
{
this->Type &= ~kTileElementDirectionMask;
this->Type |= (direction & kTileElementDirectionMask);
}
Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const
{
return ((this->Type & kTileElementDirectionMask) + offset) & kTileElementDirectionMask;
}
bool TileElementBase::IsLastForTile() const
{
return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
}
void TileElementBase::SetLastForTile(bool on)
{
if (on)
Flags |= TILE_ELEMENT_FLAG_LAST_TILE;
else
Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
}
bool TileElementBase::IsInvisible() const
{
return (this->Flags & TILE_ELEMENT_FLAG_INVISIBLE) != 0;
}
void TileElementBase::SetInvisible(bool on)
{
if (on)
Flags |= TILE_ELEMENT_FLAG_INVISIBLE;
else
Flags &= ~TILE_ELEMENT_FLAG_INVISIBLE;
}
bool TileElementBase::IsGhost() const
{
return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0;
}
void TileElementBase::SetGhost(bool isGhost)
{
if (isGhost)
TileElementType TileElementBase::GetType() const
{
this->Flags |= TILE_ELEMENT_FLAG_GHOST;
return static_cast<TileElementType>((this->Type & kTileElementTypeMask) >> 2);
}
else
void TileElementBase::SetType(TileElementType newType)
{
this->Flags &= ~TILE_ELEMENT_FLAG_GHOST;
this->Type &= ~kTileElementTypeMask;
this->Type |= ((EnumValue(newType) << 2) & kTileElementTypeMask);
}
}
void TileElementBase::Remove()
{
TileElementRemove(static_cast<TileElement*>(this));
}
Direction TileElementBase::GetDirection() const
{
return this->Type & kTileElementDirectionMask;
}
uint8_t TileElementBase::GetOccupiedQuadrants() const
{
return Flags & kTileElementOccupiedQuadrantsMask;
}
void TileElementBase::SetDirection(Direction direction)
{
this->Type &= ~kTileElementDirectionMask;
this->Type |= (direction & kTileElementDirectionMask);
}
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
{
Flags &= ~kTileElementOccupiedQuadrantsMask;
Flags |= (quadrants & kTileElementOccupiedQuadrantsMask);
}
Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const
{
return ((this->Type & kTileElementDirectionMask) + offset) & kTileElementDirectionMask;
}
int32_t TileElementBase::GetBaseZ() const
{
return BaseHeight * kCoordsZStep;
}
bool TileElementBase::IsLastForTile() const
{
return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
}
void TileElementBase::SetBaseZ(int32_t newZ)
{
BaseHeight = (newZ / kCoordsZStep);
}
void TileElementBase::SetLastForTile(bool on)
{
if (on)
Flags |= TILE_ELEMENT_FLAG_LAST_TILE;
else
Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
}
int32_t TileElementBase::GetClearanceZ() const
{
return ClearanceHeight * kCoordsZStep;
}
bool TileElementBase::IsInvisible() const
{
return (this->Flags & TILE_ELEMENT_FLAG_INVISIBLE) != 0;
}
void TileElementBase::SetClearanceZ(int32_t newZ)
{
ClearanceHeight = (newZ / kCoordsZStep);
}
void TileElementBase::SetInvisible(bool on)
{
if (on)
Flags |= TILE_ELEMENT_FLAG_INVISIBLE;
else
Flags &= ~TILE_ELEMENT_FLAG_INVISIBLE;
}
uint8_t TileElementBase::GetOwner() const
{
return Owner & kTileElementOwnerMask;
}
bool TileElementBase::IsGhost() const
{
return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0;
}
void TileElementBase::SetOwner(uint8_t newOwner)
{
Owner &= ~kTileElementOwnerMask;
Owner |= (newOwner & kTileElementOwnerMask);
}
void TileElementBase::SetGhost(bool isGhost)
{
if (isGhost)
{
this->Flags |= TILE_ELEMENT_FLAG_GHOST;
}
else
{
this->Flags &= ~TILE_ELEMENT_FLAG_GHOST;
}
}
const SurfaceElement* TileElementBase::AsSurface() const
{
return as<SurfaceElement>();
}
SurfaceElement* TileElementBase::AsSurface()
{
return as<SurfaceElement>();
}
const PathElement* TileElementBase::AsPath() const
{
return as<PathElement>();
}
PathElement* TileElementBase::AsPath()
{
return as<PathElement>();
}
const TrackElement* TileElementBase::AsTrack() const
{
return as<TrackElement>();
}
TrackElement* TileElementBase::AsTrack()
{
return as<TrackElement>();
}
const SmallSceneryElement* TileElementBase::AsSmallScenery() const
{
return as<SmallSceneryElement>();
}
SmallSceneryElement* TileElementBase::AsSmallScenery()
{
return as<SmallSceneryElement>();
}
const LargeSceneryElement* TileElementBase::AsLargeScenery() const
{
return as<LargeSceneryElement>();
}
LargeSceneryElement* TileElementBase::AsLargeScenery()
{
return as<LargeSceneryElement>();
}
const WallElement* TileElementBase::AsWall() const
{
return as<WallElement>();
}
WallElement* TileElementBase::AsWall()
{
return as<WallElement>();
}
void TileElementBase::Remove()
{
TileElementRemove(static_cast<TileElement*>(this));
}
const EntranceElement* TileElementBase::AsEntrance() const
{
return as<EntranceElement>();
}
uint8_t TileElementBase::GetOccupiedQuadrants() const
{
return Flags & kTileElementOccupiedQuadrantsMask;
}
EntranceElement* TileElementBase::AsEntrance()
{
return as<EntranceElement>();
}
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
{
Flags &= ~kTileElementOccupiedQuadrantsMask;
Flags |= (quadrants & kTileElementOccupiedQuadrantsMask);
}
const BannerElement* TileElementBase::AsBanner() const
{
return as<BannerElement>();
}
BannerElement* TileElementBase::AsBanner()
{
return as<BannerElement>();
}
int32_t TileElementBase::GetBaseZ() const
{
return BaseHeight * kCoordsZStep;
}
void TileElementBase::SetBaseZ(int32_t newZ)
{
BaseHeight = (newZ / kCoordsZStep);
}
int32_t TileElementBase::GetClearanceZ() const
{
return ClearanceHeight * kCoordsZStep;
}
void TileElementBase::SetClearanceZ(int32_t newZ)
{
ClearanceHeight = (newZ / kCoordsZStep);
}
uint8_t TileElementBase::GetOwner() const
{
return Owner & kTileElementOwnerMask;
}
void TileElementBase::SetOwner(uint8_t newOwner)
{
Owner &= ~kTileElementOwnerMask;
Owner |= (newOwner & kTileElementOwnerMask);
}
const SurfaceElement* TileElementBase::AsSurface() const
{
return as<SurfaceElement>();
}
SurfaceElement* TileElementBase::AsSurface()
{
return as<SurfaceElement>();
}
const PathElement* TileElementBase::AsPath() const
{
return as<PathElement>();
}
PathElement* TileElementBase::AsPath()
{
return as<PathElement>();
}
const TrackElement* TileElementBase::AsTrack() const
{
return as<TrackElement>();
}
TrackElement* TileElementBase::AsTrack()
{
return as<TrackElement>();
}
const SmallSceneryElement* TileElementBase::AsSmallScenery() const
{
return as<SmallSceneryElement>();
}
SmallSceneryElement* TileElementBase::AsSmallScenery()
{
return as<SmallSceneryElement>();
}
const LargeSceneryElement* TileElementBase::AsLargeScenery() const
{
return as<LargeSceneryElement>();
}
LargeSceneryElement* TileElementBase::AsLargeScenery()
{
return as<LargeSceneryElement>();
}
const WallElement* TileElementBase::AsWall() const
{
return as<WallElement>();
}
WallElement* TileElementBase::AsWall()
{
return as<WallElement>();
}
const EntranceElement* TileElementBase::AsEntrance() const
{
return as<EntranceElement>();
}
EntranceElement* TileElementBase::AsEntrance()
{
return as<EntranceElement>();
}
const BannerElement* TileElementBase::AsBanner() const
{
return as<BannerElement>();
}
BannerElement* TileElementBase::AsBanner()
{
return as<BannerElement>();
}
} // namespace OpenRCT2

View File

@@ -14,109 +14,112 @@
#include <cstdint>
constexpr uint8_t kTileElementSize = 16;
constexpr uint8_t kMaxTileElementHeight = 255;
constexpr uint8_t kTileElementOwnerMask = 0b00001111;
constexpr uint8_t kTileElementQuadrantMask = 0b11000000;
constexpr uint8_t kTileElementTypeMask = 0b00111100;
constexpr uint8_t kTileElementDirectionMask = 0b00000011;
constexpr uint8_t kTileElementOccupiedQuadrantsMask = 0b00001111;
enum
namespace OpenRCT2
{
TILE_ELEMENT_DIRECTION_WEST,
TILE_ELEMENT_DIRECTION_NORTH,
TILE_ELEMENT_DIRECTION_EAST,
TILE_ELEMENT_DIRECTION_SOUTH
};
constexpr uint8_t kTileElementSize = 16;
constexpr uint8_t kMaxTileElementHeight = 255;
constexpr uint8_t kTileElementOwnerMask = 0b00001111;
constexpr uint8_t kTileElementQuadrantMask = 0b11000000;
constexpr uint8_t kTileElementTypeMask = 0b00111100;
constexpr uint8_t kTileElementDirectionMask = 0b00000011;
constexpr uint8_t kTileElementOccupiedQuadrantsMask = 0b00001111;
enum
{
TILE_ELEMENT_FLAG_GHOST = (1 << 4),
TILE_ELEMENT_FLAG_INVISIBLE = (1 << 5),
TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7)
};
enum
{
TILE_ELEMENT_DIRECTION_WEST,
TILE_ELEMENT_DIRECTION_NORTH,
TILE_ELEMENT_DIRECTION_EAST,
TILE_ELEMENT_DIRECTION_SOUTH
};
struct TileElement;
struct SurfaceElement;
struct PathElement;
struct TrackElement;
struct SmallSceneryElement;
struct LargeSceneryElement;
struct WallElement;
struct EntranceElement;
struct BannerElement;
enum
{
TILE_ELEMENT_FLAG_GHOST = (1 << 4),
TILE_ELEMENT_FLAG_INVISIBLE = (1 << 5),
TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7)
};
struct TileElement;
struct SurfaceElement;
struct PathElement;
struct TrackElement;
struct SmallSceneryElement;
struct LargeSceneryElement;
struct WallElement;
struct EntranceElement;
struct BannerElement;
#pragma pack(push, 1)
struct TileElementBase
{
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
void Remove();
TileElementType GetType() const;
void SetType(TileElementType 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);
bool IsInvisible() const;
void SetInvisible(bool on);
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);
uint8_t GetOwner() const;
void SetOwner(uint8_t newOwner);
template<typename TType>
const TType* as() const
struct TileElementBase
{
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<const TileElement*>(this);
else
return GetType() == TType::kElementType ? reinterpret_cast<const TType*>(this) : nullptr;
}
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
template<typename TType>
TType* as()
{
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<TileElement*>(this);
else
return GetType() == TType::kElementType ? reinterpret_cast<TType*>(this) : nullptr;
}
void Remove();
const SurfaceElement* AsSurface() const;
SurfaceElement* AsSurface();
const PathElement* AsPath() const;
PathElement* AsPath();
const TrackElement* AsTrack() const;
TrackElement* AsTrack();
const SmallSceneryElement* AsSmallScenery() const;
SmallSceneryElement* AsSmallScenery();
const LargeSceneryElement* AsLargeScenery() const;
LargeSceneryElement* AsLargeScenery();
const WallElement* AsWall() const;
WallElement* AsWall();
const EntranceElement* AsEntrance() const;
EntranceElement* AsEntrance();
const BannerElement* AsBanner() const;
BannerElement* AsBanner();
};
TileElementType GetType() const;
void SetType(TileElementType 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);
bool IsInvisible() const;
void SetInvisible(bool on);
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);
uint8_t GetOwner() const;
void SetOwner(uint8_t newOwner);
template<typename TType>
const TType* as() const
{
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<const TileElement*>(this);
else
return GetType() == TType::kElementType ? reinterpret_cast<const TType*>(this) : nullptr;
}
template<typename TType>
TType* as()
{
if constexpr (std::is_same_v<TType, TileElement>)
return reinterpret_cast<TileElement*>(this);
else
return GetType() == TType::kElementType ? reinterpret_cast<TType*>(this) : nullptr;
}
const SurfaceElement* AsSurface() const;
SurfaceElement* AsSurface();
const PathElement* AsPath() const;
PathElement* AsPath();
const TrackElement* AsTrack() const;
TrackElement* AsTrack();
const SmallSceneryElement* AsSmallScenery() const;
SmallSceneryElement* AsSmallScenery();
const LargeSceneryElement* AsLargeScenery() const;
LargeSceneryElement* AsLargeScenery();
const WallElement* AsWall() const;
WallElement* AsWall();
const EntranceElement* AsEntrance() const;
EntranceElement* AsEntrance();
const BannerElement* AsBanner() const;
BannerElement* AsBanner();
};
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -11,14 +11,17 @@
#include <cstdint>
enum class TileElementType : uint8_t
namespace OpenRCT2
{
Surface = 0,
Path = 1,
Track = 2,
SmallScenery = 3,
Entrance = 4,
Wall = 5,
LargeScenery = 6,
Banner = 7,
};
enum class TileElementType : uint8_t
{
Surface = 0,
Path = 1,
Track = 2,
SmallScenery = 3,
Entrance = 4,
Wall = 5,
LargeScenery = 6,
Banner = 7,
};
}

View File

@@ -13,292 +13,293 @@
#include "../../ride/RideData.h"
#include "../../ride/Track.h"
using namespace OpenRCT2;
bool TrackElement::HasChain() const
namespace OpenRCT2
{
return Flags2 & TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
}
void TrackElement::SetHasChain(bool on)
{
if (on)
bool TrackElement::HasChain() const
{
Flags2 |= TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
return Flags2 & TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
}
else
void TrackElement::SetHasChain(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
if (on)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
}
else
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_CHAIN_LIFT;
}
}
}
/**
* Checks if a track element is recognised as the beginning of a block.
* A beginning of a block can be the end of a station, the end of a lift hill,
* or a block brake.
*/
bool TrackElement::IsBlockStart() const
{
switch (GetTrackType())
/**
* Checks if a track element is recognised as the beginning of a block.
* A beginning of a block can be the end of a station, the end of a lift hill,
* or a block brake.
*/
bool TrackElement::IsBlockStart() const
{
case TrackElemType::EndStation:
case TrackElemType::CableLiftHill:
case TrackElemType::BlockBrakes:
case TrackElemType::DiagBlockBrakes:
return true;
case TrackElemType::Up25ToFlat:
case TrackElemType::Up60ToFlat:
case TrackElemType::DiagUp25ToFlat:
case TrackElemType::DiagUp60ToFlat:
return HasChain();
default:
return false;
switch (GetTrackType())
{
case TrackElemType::EndStation:
case TrackElemType::CableLiftHill:
case TrackElemType::BlockBrakes:
case TrackElemType::DiagBlockBrakes:
return true;
case TrackElemType::Up25ToFlat:
case TrackElemType::Up60ToFlat:
case TrackElemType::DiagUp25ToFlat:
case TrackElemType::DiagUp60ToFlat:
return HasChain();
default:
return false;
}
}
}
bool TrackElement::IsStation() const
{
return TrackTypeIsStation(GetTrackType());
}
uint8_t TrackElement::GetSeatRotation() const
{
const auto* ride = GetRide(GetRideIndex());
if (ride != nullptr && ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasLandscapeDoors))
return DEFAULT_SEAT_ROTATION;
return URide.ColourScheme >> 4;
}
void TrackElement::SetSeatRotation(uint8_t newSeatRotation)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK;
URide.ColourScheme |= (newSeatRotation << 4);
}
bool TrackElement::IsTakingPhoto() const
{
return URide.OnridePhotoBits != 0;
}
void TrackElement::SetPhotoTimeout()
{
URide.OnridePhotoBits = 3;
}
void TrackElement::SetPhotoTimeout(uint8_t value)
{
URide.OnridePhotoBits = value;
}
uint8_t TrackElement::GetPhotoTimeout() const
{
return URide.OnridePhotoBits;
}
void TrackElement::DecrementPhotoTimeout()
{
URide.OnridePhotoBits = std::max(0, URide.OnridePhotoBits - 1);
}
uint16_t TrackElement::GetMazeEntry() const
{
return UMaze.MazeEntry;
}
void TrackElement::SetMazeEntry(uint16_t newMazeEntry)
{
UMaze.MazeEntry = newMazeEntry;
}
void TrackElement::MazeEntryAdd(uint16_t addVal)
{
UMaze.MazeEntry |= addVal;
}
void TrackElement::MazeEntrySubtract(uint16_t subVal)
{
UMaze.MazeEntry &= ~subVal;
}
OpenRCT2::TrackElemType TrackElement::GetTrackType() const
{
return TrackType;
}
void TrackElement::SetTrackType(OpenRCT2::TrackElemType newType)
{
TrackType = newType;
}
ride_type_t TrackElement::GetRideType() const
{
return RideType;
}
void TrackElement::SetRideType(const ride_type_t rideType)
{
RideType = rideType;
}
uint8_t TrackElement::GetSequenceIndex() const
{
return URide.Sequence;
}
void TrackElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
URide.Sequence = newSequenceIndex;
}
StationIndex TrackElement::GetStationIndex() const
{
return URide.stationIndex;
}
void TrackElement::SetStationIndex(StationIndex newStationIndex)
{
URide.stationIndex = newStationIndex;
}
uint8_t TrackElement::GetDoorAState() const
{
return (URide.ColourScheme & TRACK_ELEMENT_COLOUR_DOOR_A_MASK) >> 2;
}
uint8_t TrackElement::GetDoorBState() const
{
return (URide.ColourScheme & TRACK_ELEMENT_COLOUR_DOOR_B_MASK) >> 5;
}
void TrackElement::SetDoorAState(uint8_t newState)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_DOOR_A_MASK;
URide.ColourScheme |= ((newState << 2) & TRACK_ELEMENT_COLOUR_DOOR_A_MASK);
}
void TrackElement::SetDoorBState(uint8_t newState)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_DOOR_B_MASK;
URide.ColourScheme |= ((newState << 5) & TRACK_ELEMENT_COLOUR_DOOR_B_MASK);
}
RideId TrackElement::GetRideIndex() const
{
return RideIndex;
}
void TrackElement::SetRideIndex(RideId newRideIndex)
{
RideIndex = newRideIndex;
}
uint8_t TrackElement::GetColourScheme() const
{
return URide.ColourScheme & TRACK_ELEMENT_COLOUR_SCHEME_MASK;
}
void TrackElement::SetColourScheme(RideColourScheme newColourScheme)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_SCHEME_MASK;
URide.ColourScheme |= (EnumValue(newColourScheme) & TRACK_ELEMENT_COLOUR_SCHEME_MASK);
}
bool TrackElement::HasCableLift() const
{
return Flags2 & TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
}
void TrackElement::SetHasCableLift(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
if (on)
Flags2 |= TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
}
bool TrackElement::IsInverted() const
{
return Flags2 & TRACK_ELEMENT_FLAGS2_INVERTED;
}
void TrackElement::SetInverted(bool inverted)
{
if (inverted)
bool TrackElement::IsStation() const
{
Flags2 |= TRACK_ELEMENT_FLAGS2_INVERTED;
return TrackTypeIsStation(GetTrackType());
}
else
uint8_t TrackElement::GetSeatRotation() const
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_INVERTED;
const auto* ride = GetRide(GetRideIndex());
if (ride != nullptr && ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasLandscapeDoors))
return DEFAULT_SEAT_ROTATION;
return URide.ColourScheme >> 4;
}
}
bool TrackElement::IsBrakeClosed() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED) != 0;
}
void TrackElement::SetBrakeClosed(bool isClosed)
{
if (isClosed)
void TrackElement::SetSeatRotation(uint8_t newSeatRotation)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED;
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK;
URide.ColourScheme |= (newSeatRotation << 4);
}
else
bool TrackElement::IsTakingPhoto() const
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED;
return URide.OnridePhotoBits != 0;
}
}
bool TrackElement::IsIndestructible() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !getGameState().cheats.makeAllDestructible;
}
void TrackElement::SetIsIndestructible(bool isIndestructible)
{
if (isIndestructible)
void TrackElement::SetPhotoTimeout()
{
Flags2 |= TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
URide.OnridePhotoBits = 3;
}
else
void TrackElement::SetPhotoTimeout(uint8_t value)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
URide.OnridePhotoBits = value;
}
}
uint8_t TrackElement::GetBrakeBoosterSpeed() const
{
return URide.BrakeBoosterSpeed << 1;
}
void TrackElement::SetBrakeBoosterSpeed(uint8_t speed)
{
URide.BrakeBoosterSpeed = (speed >> 1);
}
bool TrackElement::HasGreenLight() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT) != 0;
}
void TrackElement::SetHasGreenLight(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT;
if (on)
uint8_t TrackElement::GetPhotoTimeout() const
{
Flags2 |= TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT;
return URide.OnridePhotoBits;
}
}
bool TrackElement::IsHighlighted() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_HIGHLIGHT);
}
void TrackElement::DecrementPhotoTimeout()
{
URide.OnridePhotoBits = std::max(0, URide.OnridePhotoBits - 1);
}
void TrackElement::SetHighlight(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_HIGHLIGHT;
if (on)
Flags2 |= TRACK_ELEMENT_FLAGS2_HIGHLIGHT;
}
uint16_t TrackElement::GetMazeEntry() const
{
return UMaze.MazeEntry;
}
void TrackElement::SetMazeEntry(uint16_t newMazeEntry)
{
UMaze.MazeEntry = newMazeEntry;
}
void TrackElement::MazeEntryAdd(uint16_t addVal)
{
UMaze.MazeEntry |= addVal;
}
void TrackElement::MazeEntrySubtract(uint16_t subVal)
{
UMaze.MazeEntry &= ~subVal;
}
TrackElemType TrackElement::GetTrackType() const
{
return TrackType;
}
void TrackElement::SetTrackType(TrackElemType newType)
{
TrackType = newType;
}
ride_type_t TrackElement::GetRideType() const
{
return RideType;
}
void TrackElement::SetRideType(const ride_type_t rideType)
{
RideType = rideType;
}
uint8_t TrackElement::GetSequenceIndex() const
{
return URide.Sequence;
}
void TrackElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
URide.Sequence = newSequenceIndex;
}
StationIndex TrackElement::GetStationIndex() const
{
return URide.stationIndex;
}
void TrackElement::SetStationIndex(StationIndex newStationIndex)
{
URide.stationIndex = newStationIndex;
}
uint8_t TrackElement::GetDoorAState() const
{
return (URide.ColourScheme & TRACK_ELEMENT_COLOUR_DOOR_A_MASK) >> 2;
}
uint8_t TrackElement::GetDoorBState() const
{
return (URide.ColourScheme & TRACK_ELEMENT_COLOUR_DOOR_B_MASK) >> 5;
}
void TrackElement::SetDoorAState(uint8_t newState)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_DOOR_A_MASK;
URide.ColourScheme |= ((newState << 2) & TRACK_ELEMENT_COLOUR_DOOR_A_MASK);
}
void TrackElement::SetDoorBState(uint8_t newState)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_DOOR_B_MASK;
URide.ColourScheme |= ((newState << 5) & TRACK_ELEMENT_COLOUR_DOOR_B_MASK);
}
RideId TrackElement::GetRideIndex() const
{
return RideIndex;
}
void TrackElement::SetRideIndex(RideId newRideIndex)
{
RideIndex = newRideIndex;
}
uint8_t TrackElement::GetColourScheme() const
{
return URide.ColourScheme & TRACK_ELEMENT_COLOUR_SCHEME_MASK;
}
void TrackElement::SetColourScheme(RideColourScheme newColourScheme)
{
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_SCHEME_MASK;
URide.ColourScheme |= (EnumValue(newColourScheme) & TRACK_ELEMENT_COLOUR_SCHEME_MASK);
}
bool TrackElement::HasCableLift() const
{
return Flags2 & TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
}
void TrackElement::SetHasCableLift(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
if (on)
Flags2 |= TRACK_ELEMENT_FLAGS2_CABLE_LIFT;
}
bool TrackElement::IsInverted() const
{
return Flags2 & TRACK_ELEMENT_FLAGS2_INVERTED;
}
void TrackElement::SetInverted(bool inverted)
{
if (inverted)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_INVERTED;
}
else
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_INVERTED;
}
}
bool TrackElement::IsBrakeClosed() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED) != 0;
}
void TrackElement::SetBrakeClosed(bool isClosed)
{
if (isClosed)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED;
}
else
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED;
}
}
bool TrackElement::IsIndestructible() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !getGameState().cheats.makeAllDestructible;
}
void TrackElement::SetIsIndestructible(bool isIndestructible)
{
if (isIndestructible)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
}
else
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
}
}
uint8_t TrackElement::GetBrakeBoosterSpeed() const
{
return URide.BrakeBoosterSpeed << 1;
}
void TrackElement::SetBrakeBoosterSpeed(uint8_t speed)
{
URide.BrakeBoosterSpeed = (speed >> 1);
}
bool TrackElement::HasGreenLight() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT) != 0;
}
void TrackElement::SetHasGreenLight(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT;
if (on)
{
Flags2 |= TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT;
}
}
bool TrackElement::IsHighlighted() const
{
return (Flags2 & TRACK_ELEMENT_FLAGS2_HIGHLIGHT);
}
void TrackElement::SetHighlight(bool on)
{
Flags2 &= ~TRACK_ELEMENT_FLAGS2_HIGHLIGHT;
if (on)
Flags2 |= TRACK_ELEMENT_FLAGS2_HIGHLIGHT;
}
} // namespace OpenRCT2

View File

@@ -18,138 +18,138 @@ enum class RideColourScheme : uint8_t;
namespace OpenRCT2
{
enum class TrackElemType : uint16_t;
}
enum
{
TRACK_ELEMENT_FLAGS2_CHAIN_LIFT = 1 << 0,
TRACK_ELEMENT_FLAGS2_INVERTED = 1 << 1,
// Used for giga coaster
TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2,
TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3,
TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4,
TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED = 1 << 5,
TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6,
};
enum
{
TRACK_ELEMENT_FLAGS2_CHAIN_LIFT = 1 << 0,
TRACK_ELEMENT_FLAGS2_INVERTED = 1 << 1,
// Used for giga coaster
TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2,
TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3,
TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4,
TRACK_ELEMENT_FLAGS2_BRAKE_CLOSED = 1 << 5,
TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6,
};
enum
{
TRACK_ELEMENT_COLOUR_SCHEME_MASK = 0b00000011,
// Not colour related, but shares the field.
TRACK_ELEMENT_COLOUR_DOOR_A_MASK = 0b00011100,
TRACK_ELEMENT_COLOUR_DOOR_B_MASK = 0b11100000,
TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK = 0b11110000,
};
enum
{
TRACK_ELEMENT_COLOUR_SCHEME_MASK = 0b00000011,
// Not colour related, but shares the field.
TRACK_ELEMENT_COLOUR_DOOR_A_MASK = 0b00011100,
TRACK_ELEMENT_COLOUR_DOOR_B_MASK = 0b11100000,
TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK = 0b11110000,
};
constexpr const int32_t kLandEdgeDoorFrameClosed = 0;
constexpr const int32_t kLandEdgeDoorFrameOpening = 1;
constexpr const int32_t kLandEdgeDoorFrameOpen = 3;
constexpr const int32_t kLandEdgeDoorFrameClosing = 4;
constexpr const int32_t kLandEdgeDoorFrameEnd = 6;
constexpr const int32_t kLandEdgeDoorFrameClosed = 0;
constexpr const int32_t kLandEdgeDoorFrameOpening = 1;
constexpr const int32_t kLandEdgeDoorFrameOpen = 3;
constexpr const int32_t kLandEdgeDoorFrameClosing = 4;
constexpr const int32_t kLandEdgeDoorFrameEnd = 6;
constexpr const int32_t kLandEdgeDoorFrameCount = 8;
constexpr const int32_t kLandEdgeDoorFrameCount = 8;
#pragma pack(push, 1)
struct TrackElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Track;
private:
OpenRCT2::TrackElemType TrackType;
union
struct TrackElement : TileElementBase
{
struct
static constexpr TileElementType kElementType = TileElementType::Track;
private:
TrackElemType TrackType;
union
{
uint8_t Sequence;
uint8_t ColourScheme;
union
struct
{
// - 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;
struct
{
uint16_t MazeEntry; // 6
} UMaze;
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;
struct
{
uint16_t MazeEntry; // 6
} UMaze;
};
uint8_t Flags2;
RideId RideIndex;
ride_type_t RideType;
public:
TrackElemType GetTrackType() const;
void SetTrackType(TrackElemType newEntryIndex);
ride_type_t GetRideType() const;
void SetRideType(const ride_type_t rideType);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
uint8_t GetColourScheme() const;
void SetColourScheme(RideColourScheme newColourScheme);
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
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);
bool HasGreenLight() const;
void SetHasGreenLight(bool on);
uint8_t GetSeatRotation() const;
void SetSeatRotation(uint8_t newSeatRotation);
uint16_t GetMazeEntry() const;
void SetMazeEntry(uint16_t newMazeEntry);
void MazeEntryAdd(uint16_t addVal);
void MazeEntrySubtract(uint16_t subVal);
bool IsTakingPhoto() const;
void SetPhotoTimeout();
void SetPhotoTimeout(uint8_t newValue);
void DecrementPhotoTimeout();
uint8_t GetPhotoTimeout() const;
bool IsHighlighted() const;
void SetHighlight(bool on);
// 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;
void SetDoorAState(uint8_t newState);
void SetDoorBState(uint8_t newState);
bool IsStation() const;
bool IsBlockStart() const;
};
uint8_t Flags2;
RideId RideIndex;
ride_type_t RideType;
public:
OpenRCT2::TrackElemType GetTrackType() const;
void SetTrackType(OpenRCT2::TrackElemType newEntryIndex);
ride_type_t GetRideType() const;
void SetRideType(const ride_type_t rideType);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
RideId GetRideIndex() const;
void SetRideIndex(RideId newRideIndex);
uint8_t GetColourScheme() const;
void SetColourScheme(RideColourScheme newColourScheme);
StationIndex GetStationIndex() const;
void SetStationIndex(StationIndex newStationIndex);
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);
bool HasGreenLight() const;
void SetHasGreenLight(bool on);
uint8_t GetSeatRotation() const;
void SetSeatRotation(uint8_t newSeatRotation);
uint16_t GetMazeEntry() const;
void SetMazeEntry(uint16_t newMazeEntry);
void MazeEntryAdd(uint16_t addVal);
void MazeEntrySubtract(uint16_t subVal);
bool IsTakingPhoto() const;
void SetPhotoTimeout();
void SetPhotoTimeout(uint8_t newValue);
void DecrementPhotoTimeout();
uint8_t GetPhotoTimeout() const;
bool IsHighlighted() const;
void SetHighlight(bool on);
// 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;
void SetDoorAState(uint8_t newState);
void SetDoorBState(uint8_t newState);
bool IsStation() const;
bool IsBlockStart() const;
};
static_assert(sizeof(TrackElement) == kTileElementSize);
static_assert(sizeof(TrackElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2

View File

@@ -13,123 +13,124 @@
#include "../../object/WallSceneryEntry.h"
#include "../Banner.h"
using namespace OpenRCT2;
uint8_t WallElement::GetSlope() const
namespace OpenRCT2
{
return (Type & kTileElementQuadrantMask) >> 6;
}
uint8_t WallElement::GetSlope() const
{
return (Type & kTileElementQuadrantMask) >> 6;
}
void WallElement::SetSlope(uint8_t newSlope)
{
Type &= ~kTileElementQuadrantMask;
Type |= (newSlope << 6);
}
void WallElement::SetSlope(uint8_t newSlope)
{
Type &= ~kTileElementQuadrantMask;
Type |= (newSlope << 6);
}
colour_t WallElement::GetPrimaryColour() const
{
return colour_1;
}
colour_t WallElement::GetPrimaryColour() const
{
return colour_1;
}
colour_t WallElement::GetSecondaryColour() const
{
return colour_2;
}
colour_t WallElement::GetSecondaryColour() const
{
return colour_2;
}
colour_t WallElement::GetTertiaryColour() const
{
return colour_3;
}
colour_t WallElement::GetTertiaryColour() const
{
return colour_3;
}
void WallElement::SetPrimaryColour(colour_t newColour)
{
colour_1 = newColour;
}
void WallElement::SetPrimaryColour(colour_t newColour)
{
colour_1 = newColour;
}
void WallElement::SetSecondaryColour(colour_t newColour)
{
colour_2 = newColour;
}
void WallElement::SetSecondaryColour(colour_t newColour)
{
colour_2 = newColour;
}
void WallElement::SetTertiaryColour(colour_t newColour)
{
colour_3 = newColour;
}
void WallElement::SetTertiaryColour(colour_t newColour)
{
colour_3 = newColour;
}
uint8_t WallElement::GetAnimationFrame() const
{
return (animation >> 3) & 0xF;
}
uint8_t WallElement::GetAnimationFrame() const
{
return (animation >> 3) & 0xF;
}
void WallElement::SetAnimationFrame(uint8_t frameNum)
{
animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
animation |= (frameNum & 0xF) << 3;
}
void WallElement::SetAnimationFrame(uint8_t frameNum)
{
animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
animation |= (frameNum & 0xF) << 3;
}
bool WallElement::IsAnimating() const
{
return (animation & WALL_ANIMATION_FLAG_IS_ANIMATING) != 0;
}
bool WallElement::IsAnimating() const
{
return (animation & WALL_ANIMATION_FLAG_IS_ANIMATING) != 0;
}
void WallElement::SetIsAnimating(const bool isAnimating)
{
if (isAnimating)
animation |= WALL_ANIMATION_FLAG_IS_ANIMATING;
else
animation &= ~WALL_ANIMATION_FLAG_IS_ANIMATING;
}
void WallElement::SetIsAnimating(const bool isAnimating)
{
if (isAnimating)
animation |= WALL_ANIMATION_FLAG_IS_ANIMATING;
else
animation &= ~WALL_ANIMATION_FLAG_IS_ANIMATING;
}
uint16_t WallElement::GetEntryIndex() const
{
return entryIndex;
}
uint16_t WallElement::GetEntryIndex() const
{
return entryIndex;
}
const WallSceneryEntry* WallElement::GetEntry() const
{
return OpenRCT2::ObjectManager::GetObjectEntry<WallSceneryEntry>(entryIndex);
}
const WallSceneryEntry* WallElement::GetEntry() const
{
return ObjectManager::GetObjectEntry<WallSceneryEntry>(entryIndex);
}
void WallElement::SetEntryIndex(uint16_t newIndex)
{
entryIndex = newIndex;
}
void WallElement::SetEntryIndex(uint16_t newIndex)
{
entryIndex = newIndex;
}
Banner* WallElement::GetBanner() const
{
return ::GetBanner(GetBannerIndex());
}
Banner* WallElement::GetBanner() const
{
return ::GetBanner(GetBannerIndex());
}
BannerIndex WallElement::GetBannerIndex() const
{
return banner_index;
}
BannerIndex WallElement::GetBannerIndex() const
{
return banner_index;
}
void WallElement::SetBannerIndex(BannerIndex newIndex)
{
banner_index = newIndex;
}
void WallElement::SetBannerIndex(BannerIndex newIndex)
{
banner_index = newIndex;
}
bool WallElement::IsAcrossTrack() const
{
return (animation & WALL_ANIMATION_FLAG_ACROSS_TRACK) != 0;
}
bool WallElement::IsAcrossTrack() const
{
return (animation & WALL_ANIMATION_FLAG_ACROSS_TRACK) != 0;
}
void WallElement::SetAcrossTrack(bool acrossTrack)
{
animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK;
if (acrossTrack)
animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
}
void WallElement::SetAcrossTrack(bool acrossTrack)
{
animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK;
if (acrossTrack)
animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
}
bool WallElement::AnimationIsBackwards() const
{
return (animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) != 0;
}
bool WallElement::AnimationIsBackwards() const
{
return (animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) != 0;
}
void WallElement::SetAnimationIsBackwards(bool isBackwards)
{
animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
if (isBackwards)
animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
}
void WallElement::SetAnimationIsBackwards(bool isBackwards)
{
animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
if (isBackwards)
animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
}
} // namespace OpenRCT2

View File

@@ -18,63 +18,66 @@
#include <cstdint>
enum
namespace OpenRCT2
{
WALL_ANIMATION_FLAG_IS_ANIMATING = (1 << 1),
WALL_ANIMATION_FLAG_ACROSS_TRACK = (1 << 2),
// 3 - 6 animation frame number
WALL_ANIMATION_FLAG_DIRECTION_BACKWARD = (1 << 7),
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_IS_ANIMATING | WALL_ANIMATION_FLAG_ACROSS_TRACK
| WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
};
enum
{
WALL_ANIMATION_FLAG_IS_ANIMATING = (1 << 1),
WALL_ANIMATION_FLAG_ACROSS_TRACK = (1 << 2),
// 3 - 6 animation frame number
WALL_ANIMATION_FLAG_DIRECTION_BACKWARD = (1 << 7),
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_IS_ANIMATING | WALL_ANIMATION_FLAG_ACROSS_TRACK
| WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
};
#pragma pack(push, 1)
struct WallElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Wall;
struct WallElement : TileElementBase
{
static constexpr TileElementType kElementType = TileElementType::Wall;
private:
OpenRCT2::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_fta0 d = direction, f = frame num, t = across track flag (not used), a = animating
private:
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_fta0 d = direction, f = frame num, t = across track flag (not used), a = animating
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t Pad0D[3];
uint8_t Pad0D[3];
#pragma clang diagnostic pop
public:
uint16_t GetEntryIndex() const;
void SetEntryIndex(uint16_t newIndex);
const OpenRCT2::WallSceneryEntry* GetEntry() const;
public:
uint16_t GetEntryIndex() const;
void SetEntryIndex(uint16_t newIndex);
const WallSceneryEntry* GetEntry() const;
uint8_t GetSlope() const;
void SetSlope(uint8_t newslope);
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);
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);
uint8_t GetAnimationFrame() const;
void SetAnimationFrame(uint8_t frameNum);
bool IsAnimating() const;
void SetIsAnimating(const bool isAnimating);
bool IsAnimating() const;
void SetIsAnimating(const bool isAnimating);
Banner* GetBanner() const;
BannerIndex GetBannerIndex() const;
void SetBannerIndex(BannerIndex newIndex);
Banner* GetBanner() const;
BannerIndex GetBannerIndex() const;
void SetBannerIndex(BannerIndex newIndex);
bool IsAcrossTrack() const;
void SetAcrossTrack(bool acrossTrack);
bool AnimationIsBackwards() const;
void SetAnimationIsBackwards(bool isBackwards);
};
static_assert(sizeof(WallElement) == kTileElementSize);
bool IsAcrossTrack() const;
void SetAcrossTrack(bool acrossTrack);
bool AnimationIsBackwards() const;
void SetAnimationIsBackwards(bool isBackwards);
};
static_assert(sizeof(WallElement) == kTileElementSize);
#pragma pack(pop)
} // namespace OpenRCT2