1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +01:00

Move TrackData.{cpp,h} into OpenRCT2::TrackMetaData namespace

This commit is contained in:
Gymnasiast
2024-07-31 23:00:42 +02:00
parent 45d3105508
commit 4572331409
2 changed files with 8090 additions and 8096 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -11,105 +11,102 @@
#include "Track.h"
constexpr uint8_t MaxSequencesPerPiece = 16;
// 0x009968BB, 0x009968BC, 0x009968BD, 0x009968BF, 0x009968C1, 0x009968C3
struct TrackCurveChain
namespace OpenRCT2::TrackMetaData
{
int32_t next;
int32_t previous;
};
constexpr uint8_t MaxSequencesPerPiece = 16;
struct TrackDescriptor
{
bool starts_diagonal;
TrackPitch slope_start;
TrackRoll RollStart;
TrackCurve track_curve;
TrackPitch slope_end;
TrackRoll RollEnd;
track_type_t track_element;
};
// 0x009968BB, 0x009968BC, 0x009968BD, 0x009968BF, 0x009968C1, 0x009968C3
enum
{
NO_SPIN,
L8_SPIN,
R8_SPIN,
LR_SPIN,
RL_SPIN,
L7_SPIN,
R7_SPIN,
L5_SPIN,
R5_SPIN,
RC_SPIN, // Rotation Control Spin
SP_SPIN, // Special rapids Spin
L9_SPIN,
R9_SPIN
};
extern const TrackDescriptor gTrackDescriptors[186];
struct DodgemsTrackSize
{
uint8_t left;
uint8_t top;
uint8_t right;
uint8_t bottom;
};
constexpr DodgemsTrackSize GetDodgemsTrackSize(track_type_t type)
{
if (type == OpenRCT2::TrackElemType::FlatTrack2x2)
return { 4, 4, 59, 59 };
if (type == OpenRCT2::TrackElemType::FlatTrack4x4)
return { 4, 4, 123, 123 };
if (type == OpenRCT2::TrackElemType::FlatTrack2x4)
return { 4, 4, 59, 123 };
return { 0, 0, 0, 0 };
}
using TrackComputeFunction = int32_t (*)(const int16_t);
struct TrackElementDescriptor
{
StringId Description;
TrackCoordinates Coordinates;
PreviewTrack* Block;
uint8_t PieceLength;
TrackCurveChain CurveChain;
track_type_t AlternativeType;
// Price Modifier should be used as in the following calculation:
// (RideTrackPrice * TED::PriceModifier) / 65536
uint32_t PriceModifier;
track_type_t MirrorElement;
uint32_t HeightMarkerPositions;
uint32_t Flags;
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;
TrackDefinition Definition;
uint8_t SpinFunction;
TrackComputeFunction VerticalFactor;
TrackComputeFunction LateralFactor;
/**
* Retrieves the block for the given sequence. This method safely handles
* out-of-bounds sequence indices.
*
* @param sequenceIndex
* @return The track block, or nullptr if it doesnt exist.
*/
const PreviewTrack* GetBlockForSequence(uint8_t sequenceIndex) const;
};
namespace OpenRCT2
{
namespace TrackMetaData
struct TrackCurveChain
{
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t type);
} // namespace TrackMetaData
} // namespace OpenRCT2
int32_t next;
int32_t previous;
};
struct TrackDescriptor
{
bool starts_diagonal;
TrackPitch slope_start;
TrackRoll RollStart;
TrackCurve track_curve;
TrackPitch slope_end;
TrackRoll RollEnd;
track_type_t track_element;
};
enum
{
NO_SPIN,
L8_SPIN,
R8_SPIN,
LR_SPIN,
RL_SPIN,
L7_SPIN,
R7_SPIN,
L5_SPIN,
R5_SPIN,
RC_SPIN, // Rotation Control Spin
SP_SPIN, // Special rapids Spin
L9_SPIN,
R9_SPIN
};
extern const TrackDescriptor gTrackDescriptors[186];
struct DodgemsTrackSize
{
uint8_t left;
uint8_t top;
uint8_t right;
uint8_t bottom;
};
constexpr DodgemsTrackSize GetDodgemsTrackSize(track_type_t type)
{
if (type == OpenRCT2::TrackElemType::FlatTrack2x2)
return { 4, 4, 59, 59 };
if (type == OpenRCT2::TrackElemType::FlatTrack4x4)
return { 4, 4, 123, 123 };
if (type == OpenRCT2::TrackElemType::FlatTrack2x4)
return { 4, 4, 59, 123 };
return { 0, 0, 0, 0 };
}
using TrackComputeFunction = int32_t (*)(const int16_t);
struct TrackElementDescriptor
{
StringId Description;
TrackCoordinates Coordinates;
PreviewTrack* Block;
uint8_t PieceLength;
TrackCurveChain CurveChain;
track_type_t AlternativeType;
// Price Modifier should be used as in the following calculation:
// (RideTrackPrice * TED::PriceModifier) / 65536
uint32_t PriceModifier;
track_type_t MirrorElement;
uint32_t HeightMarkerPositions;
uint32_t Flags;
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;
TrackDefinition Definition;
uint8_t SpinFunction;
TrackComputeFunction VerticalFactor;
TrackComputeFunction LateralFactor;
/**
* Retrieves the block for the given sequence. This method safely handles
* out-of-bounds sequence indices.
*
* @param sequenceIndex
* @return The track block, or nullptr if it doesnt exist.
*/
const PreviewTrack* GetBlockForSequence(uint8_t sequenceIndex) const;
};
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t type);
} // namespace OpenRCT2::TrackMetaData