OpenRCT2/src/openrct2/ride/TrackData.h

118 lines
2.9 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2023 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#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"
constexpr const uint8_t MaxSequencesPerPiece = 16;
// 0x009968BB, 0x009968BC, 0x009968BD, 0x009968BF, 0x009968C1, 0x009968C3
struct TrackCurveChain
2017-10-16 12:04:35 +02:00
{
Separate booster track elem type (#13857) * add data to Track.cpp add data to TrackData.cpp add import helper functions fix Booster value import booster as 256 export booster as 100 add vehicle subposition data add SV4 import add TD4 import add TD6 import use track_type_t when importing TD6 add TD6 export change peep tracktype type to auto fix SV4 track element import fix import of booster speed add None enum to TrackElemType move _legacy RideConstruction functions to Ride.cpp change _currentPossibleRideConfigurations to use track_type_t fix booster track category add booster string tto expand _currentTrackCurve to 32 bits expand track_curve_chain to 32 bits update get_track_element et al. to handle 16 bit track types run clang-format remove unused #includes from _legacy.cpp Revert "remove unused #includes from _legacy.cpp" This reverts commit 4c4d4b06edb0c130314789d8fe371246be246c9f. Revert "update get_track_element et al. to handle 16 bit track types" This reverts commit 73920dafd4a6c9e7c9f0c7ee1098d493f8f5d262. Revert "move _legacy RideConstruction functions to Ride.cpp" This reverts commit 2d83a75c1477d387ad77a7a5085f37a28f72a589. update _legacy functions for 16-bit track types update ride_construction_reset_current_piece behavior with new enum fix declaration of _currentTrackCurve to match other track tcurve vars remove unused include from T4Importer.cpp move SCT to 256 part 1: RideConstruction.cpp move SCT to 256 part 2: TrackData.cpp move SCT to 256 part 3: Ride.h/Ride.cpp move SCT to 256 Part 4: revert changes to S4Importer.cpp, T4Importer.cpp fix stations appearing as curves fix too many initializers in TrackData.cpp move SCT to 256 part 5: S6/T6 importing and exporting move SCT to 256 part 6: simplify RCT12.cpp functions fix comments in S6Exporter.cpp, S6Importer.cpp fix clang-format on S6Importer.cpp add missing data to TrackData.cpp revert new functions for checking if track type is a booster revert unused include change trackType to auto and add comment to S6Exporter.cpp move track type aliasing from TrackDesign.cpp to T6Import.cpp, T6Export.cpp add comment about sv6 vehicle.track_type static cast to uint8_t in T6Exporter.cpp` set type to auto when setting value to _currentTrackCurve revert moving function in S6Importer.cpp fix value names in RideData.cpp revert cahnge to uint16_t return for GetTrackType() in RCT12.cpp fix GetTrackType return type for real add changelog entry bump network version cast alternate track type to track_type_t static_cast tuple input value in _legacy.cpp change _currentTrackCurve to uint32 use TrackElemType::Count to determine length of subposition array perform some changes remove padding from rct_trackdefinition fix alternative type check remove _boosterTrackSelected add missing condition for booster speed add comments for TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop add missing comments to RideData.cpp remove extra entry simplify some things fix formatting remove redundant checks todo: fix building the track piece use TrackElemType::None more remove git.txt * bump network version * make conditional more explicit w/ parentheses * move booster check to RCT12.cpp * implement getters and setters for vehicle track type and direction * fix formatting * rename RCT12TrackTypeIsBooster to RCT2TrackTypeIsBooster * add whitespace in RCT2.h * change the thing I thought I changed * move booster check function to RCT2.cpp * move function into if condition * fix scope issues with setters
2021-01-29 16:24:53 +01:00
int32_t next;
int32_t previous;
};
struct TrackDescriptor
2017-10-16 12:04:35 +02:00
{
2018-06-22 23:14:18 +02:00
bool starts_diagonal;
uint8_t slope_start;
uint8_t bank_start;
uint8_t track_curve;
uint8_t slope_end;
uint8_t bank_end;
uint8_t track_element;
};
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
};
extern const TrackDescriptor gTrackDescriptors[142];
struct DodgemsTrackSize
2017-10-16 12:04:35 +02:00
{
uint8_t left;
uint8_t top;
uint8_t right;
uint8_t bottom;
};
2016-08-07 14:19:56 +02: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
using TrackComputeFunction = int32_t (*)(const int16_t);
struct TrackElementDescriptor
{
2022-07-31 14:22:58 +02:00
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;
uint16_t Flags;
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;
TrackDefinition Definition;
2021-08-30 02:37:59 +02:00
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
{
2021-08-27 23:44:33 +02:00
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t type);
} // namespace TrackMetaData
} // namespace OpenRCT2