2015-02-07 19:38:48 +01:00
|
|
|
|
/*****************************************************************************
|
2023-01-01 11:58:01 +01:00
|
|
|
|
* Copyright (c) 2014-2023 OpenRCT2 developers
|
2016-05-04 19:24:41 +02:00
|
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-04 19:24:41 +02:00
|
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-04 19:24:41 +02:00
|
|
|
|
*****************************************************************************/
|
2015-06-27 23:53:52 +02:00
|
|
|
|
|
2016-11-13 14:08:41 +01:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2015-02-07 19:38:48 +01:00
|
|
|
|
#include "../common.h"
|
2017-10-17 13:51:47 +02:00
|
|
|
|
#include "Track.h"
|
2018-01-10 00:00:09 +01:00
|
|
|
|
#include "TrackPaint.h"
|
2015-02-07 19:38:48 +01:00
|
|
|
|
|
2020-11-11 01:24:02 +01:00
|
|
|
|
constexpr const uint8_t MaxSequencesPerPiece = 16;
|
|
|
|
|
|
2015-02-07 19:38:48 +01:00
|
|
|
|
// 0x009968BB, 0x009968BC, 0x009968BD, 0x009968BF, 0x009968C1, 0x009968C3
|
2015-06-27 23:53:52 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
struct TrackCurveChain
|
2017-10-16 12:04:35 +02:00
|
|
|
|
{
|
2021-01-29 16:24:53 +01:00
|
|
|
|
int32_t next;
|
|
|
|
|
int32_t previous;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2015-07-13 13:47:31 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
struct TrackDescriptor
|
2017-10-16 12:04:35 +02:00
|
|
|
|
{
|
2018-06-22 23:14:18 +02:00
|
|
|
|
bool starts_diagonal;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint8_t slope_start;
|
|
|
|
|
uint8_t bank_start;
|
|
|
|
|
uint8_t track_curve;
|
|
|
|
|
uint8_t slope_end;
|
|
|
|
|
uint8_t bank_end;
|
|
|
|
|
uint8_t track_element;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2016-02-20 17:53:20 +01:00
|
|
|
|
|
2021-08-30 02:37:59 +02:00
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
extern const TrackDescriptor gTrackDescriptors[142];
|
2016-05-15 11:30:03 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
struct DodgemsTrackSize
|
2017-10-16 12:04:35 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint8_t left;
|
|
|
|
|
uint8_t top;
|
|
|
|
|
uint8_t right;
|
|
|
|
|
uint8_t bottom;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2016-08-07 14:19:56 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
constexpr const DodgemsTrackSize GetDodgemsTrackSize(track_type_t type)
|
2021-02-08 21:28:41 +01:00
|
|
|
|
{
|
|
|
|
|
if (type == TrackElemType::FlatTrack2x2)
|
|
|
|
|
return { 4, 4, 59, 59 };
|
|
|
|
|
if (type == TrackElemType::FlatTrack4x4)
|
|
|
|
|
return { 4, 4, 123, 123 };
|
|
|
|
|
if (type == TrackElemType::FlatTrack2x4)
|
|
|
|
|
return { 4, 4, 59, 123 };
|
|
|
|
|
return { 0, 0, 0, 0 };
|
|
|
|
|
}
|
2016-08-12 21:22:25 +02:00
|
|
|
|
|
2022-05-04 04:27:16 +02:00
|
|
|
|
using TrackComputeFunction = int32_t (*)(const int16_t);
|
2021-08-22 15:06:58 +02:00
|
|
|
|
struct TrackElementDescriptor
|
|
|
|
|
{
|
2022-07-31 14:22:58 +02:00
|
|
|
|
StringId Description;
|
2023-01-21 20:57:17 +01:00
|
|
|
|
TrackCoordinates Coordinates;
|
2021-08-22 15:06:58 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
PreviewTrack* Block;
|
2021-08-22 15:06:58 +02:00
|
|
|
|
uint8_t PieceLength;
|
2023-01-21 20:57:17 +01:00
|
|
|
|
TrackCurveChain CurveChain;
|
2021-08-22 15:06:58 +02:00
|
|
|
|
track_type_t AlternativeType;
|
2022-04-14 21:36:39 +02:00
|
|
|
|
// Price Modifier should be used as in the following calculation:
|
|
|
|
|
// (RideTrackPrice * TED::PriceModifier) / 65536
|
|
|
|
|
uint32_t PriceModifier;
|
2021-08-29 16:08:54 +02:00
|
|
|
|
track_type_t MirrorElement;
|
2021-08-22 15:06:58 +02:00
|
|
|
|
uint32_t HeightMarkerPositions;
|
|
|
|
|
uint16_t Flags;
|
|
|
|
|
|
|
|
|
|
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
|
2021-08-29 16:08:54 +02:00
|
|
|
|
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;
|
2021-08-30 02:15:44 +02:00
|
|
|
|
|
2023-01-21 20:57:17 +01:00
|
|
|
|
TrackDefinition Definition;
|
2021-08-30 02:37:59 +02:00
|
|
|
|
uint8_t SpinFunction;
|
2022-05-04 04:27:16 +02:00
|
|
|
|
|
|
|
|
|
TrackComputeFunction VerticalFactor;
|
|
|
|
|
TrackComputeFunction LateralFactor;
|
2022-12-10 22:08:42 +01:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 doesn’t exist.
|
|
|
|
|
*/
|
2023-01-21 20:57:17 +01:00
|
|
|
|
const PreviewTrack* GetBlockForSequence(uint8_t sequenceIndex) const;
|
2021-08-22 15:06:58 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace OpenRCT2
|
|
|
|
|
{
|
|
|
|
|
namespace TrackMetaData
|
|
|
|
|
{
|
2021-08-27 23:44:33 +02:00
|
|
|
|
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t type);
|
2021-08-22 15:06:58 +02:00
|
|
|
|
} // namespace TrackMetaData
|
|
|
|
|
} // namespace OpenRCT2
|