1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "../common.h"
13 #include "../object/Object.h"
14 #include "Ride.h"
15 
16 constexpr const uint32_t RideConstructionSpecialPieceSelected = 0x10000;
17 
18 constexpr const int32_t BLOCK_BRAKE_BASE_SPEED = 0x20364;
19 
20 using track_type_t = uint16_t;
21 using roll_type_t = uint8_t;
22 using pitch_type_t = uint8_t;
23 
24 struct rct_trackdefinition
25 {
26     track_type_t type;
27     pitch_type_t vangle_end;
28     pitch_type_t vangle_start;
29     roll_type_t bank_end;
30     roll_type_t bank_start;
31     int8_t preview_z_offset;
32 };
33 
34 struct PitchAndRoll
35 {
36     pitch_type_t Pitch;
37     roll_type_t Roll;
38 };
39 constexpr bool operator==(const PitchAndRoll& vb1, const PitchAndRoll& vb2)
40 {
41     return vb1.Pitch == vb2.Pitch && vb1.Roll == vb2.Roll;
42 }
43 constexpr bool operator!=(const PitchAndRoll& vb1, const PitchAndRoll& vb2)
44 {
45     return !(vb1 == vb2);
46 }
47 
48 /* size 0x0A */
49 struct rct_preview_track
50 {
51     uint8_t index; // 0x00
52     int16_t x;     // 0x01
53     int16_t y;     // 0x03
54     int16_t z;     // 0x05
55     uint8_t var_07;
56     QuarterTile var_08;
57     uint8_t flags;
58 };
59 
60 /* size 0x0A */
61 struct rct_track_coordinates
62 {
63     int8_t rotation_begin; // 0x00
64     int8_t rotation_end;   // 0x01
65     int16_t z_begin;       // 0x02
66     int16_t z_end;         // 0x04
67     int16_t x;             // 0x06
68     int16_t y;             // 0x08
69 };
70 
71 enum
72 {
73     RCT_PREVIEW_TRACK_FLAG_0 = (1 << 0),
74     RCT_PREVIEW_TRACK_FLAG_1 = (1 << 1),
75     RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL = (1 << 2),
76 };
77 
78 enum
79 {
80     TRACK_ELEMENT_FLAG_TERMINAL_STATION = 1 << 3,
81     TD6_TRACK_ELEMENT_FLAG_INVERTED = 1 << 6,
82 };
83 
84 enum
85 {
86     TRACK_ELEMENT_FLAGS2_CHAIN_LIFT = 1 << 0,
87     TRACK_ELEMENT_FLAGS2_INVERTED = 1 << 1,
88     // Used for giga coaster
89     TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2,
90     TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3,
91     TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4,
92     TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED = 1 << 5,
93     TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6,
94 };
95 
96 enum
97 {
98     TRACK_ELEMENT_COLOUR_SCHEME_MASK = 0b00000011,
99     // Not colour related, but shares the field.
100     TRACK_ELEMENT_COLOUR_DOOR_A_MASK = 0b00011100,
101     TRACK_ELEMENT_COLOUR_DOOR_B_MASK = 0b11100000,
102     TRACK_ELEMENT_COLOUR_SEAT_ROTATION_MASK = 0b11110000,
103 };
104 
105 #define MAX_STATION_PLATFORM_LENGTH 32
106 constexpr uint16_t const MAX_TRACK_HEIGHT = 254 * COORDS_Z_STEP;
107 constexpr uint8_t const DEFAULT_SEAT_ROTATION = 4;
108 
109 enum
110 {
111     TRACK_NONE = 0,
112 
113     TRACK_FLAT = 0,
114     TRACK_STRAIGHT,
115     TRACK_STATION_END,
116     TRACK_LIFT_HILL,
117     TRACK_LIFT_HILL_STEEP,
118     TRACK_LIFT_HILL_CURVE,
119     TRACK_FLAT_ROLL_BANKING,
120     TRACK_VERTICAL_LOOP,
121     TRACK_SLOPE,
122     TRACK_SLOPE_STEEP,
123     TRACK_SLOPE_LONG,
124     TRACK_SLOPE_CURVE,
125     TRACK_SLOPE_CURVE_STEEP,
126     TRACK_S_BEND,
127     TRACK_CURVE_VERY_SMALL,
128     TRACK_CURVE_SMALL,
129     TRACK_CURVE,
130     TRACK_TWIST,
131     TRACK_HALF_LOOP,
132     TRACK_CORKSCREW,
133     TRACK_TOWER_BASE,
134     TRACK_HELIX_SMALL,
135     TRACK_HELIX_LARGE,
136     TRACK_HELIX_LARGE_UNBANKED,
137     TRACK_BRAKES,
138     TRACK_25,
139     TRACK_ON_RIDE_PHOTO,
140     TRACK_WATER_SPLASH,
141     TRACK_SLOPE_VERTICAL,
142     TRACK_BARREL_ROLL,
143     TRACK_POWERED_LIFT,
144     TRACK_HALF_LOOP_LARGE,
145     TRACK_SLOPE_CURVE_BANKED,
146     TRACK_LOG_FLUME_REVERSER,
147     TRACK_HEARTLINE_ROLL,
148     TRACK_REVERSER,
149     TRACK_REVERSE_FREEFALL,
150     TRACK_SLOPE_TO_FLAT,
151     TRACK_BLOCK_BRAKES,
152     TRACK_SLOPE_ROLL_BANKING,
153     TRACK_SLOPE_STEEP_LONG,
154     TRACK_CURVE_VERTICAL,
155     TRACK_42,
156     TRACK_LIFT_HILL_CABLE,
157     TRACK_LIFT_HILL_CURVED,
158     TRACK_QUARTER_LOOP,
159     TRACK_SPINNING_TUNNEL,
160     TRACK_BOOSTER,
161     TRACK_INLINE_TWIST_UNINVERTED,
162     TRACK_INLINE_TWIST_INVERTED,
163     TRACK_QUARTER_LOOP_UNINVERTED,
164     TRACK_QUARTER_LOOP_INVERTED,
165     TRACK_RAPIDS,
166     TRACK_HALF_LOOP_UNINVERTED,
167     TRACK_HALF_LOOP_INVERTED,
168 
169     TRACK_WATERFALL,
170     TRACK_WHIRLPOOL,
171     TRACK_BRAKE_FOR_DROP,
172     TRACK_CORKSCREW_UNINVERTED,
173     TRACK_CORKSCREW_INVERTED,
174     TRACK_HEARTLINE_TRANSFER,
175     TRACK_MINI_GOLF_HOLE,
176     TRACK_ROTATION_CONTROL_TOGGLE,
177 
178     TRACK_GROUP_COUNT,
179 };
180 
181 enum
182 {
183     TRACK_CURVE_LEFT_VERY_SMALL = 5,
184     TRACK_CURVE_LEFT_SMALL = 3,
185     TRACK_CURVE_LEFT = 1,
186     TRACK_CURVE_LEFT_LARGE = 7,
187     TRACK_CURVE_NONE = 0,
188     TRACK_CURVE_RIGHT_LARGE = 8,
189     TRACK_CURVE_RIGHT = 2,
190     TRACK_CURVE_RIGHT_SMALL = 4,
191     TRACK_CURVE_RIGHT_VERY_SMALL = 6
192 };
193 
194 enum
195 {
196     TRACK_SLOPE_NONE = 0,
197     TRACK_SLOPE_UP_25 = 2,
198     TRACK_SLOPE_UP_60 = 4,
199     TRACK_SLOPE_DOWN_25 = 6,
200     TRACK_SLOPE_DOWN_60 = 8,
201     TRACK_SLOPE_UP_90 = 10,
202     TRACK_SLOPE_DOWN_90 = 18,
203 
204     TRACK_VANGLE_TOWER = 10,
205     TRACK_VANGLE_REVERSE_FREEFALL = 10
206 };
207 
208 enum
209 {
210     TRACK_BANK_NONE = 0,
211     TRACK_BANK_LEFT = 2,
212     TRACK_BANK_RIGHT = 4,
213     TRACK_BANK_UPSIDE_DOWN = 15,
214 };
215 
216 enum
217 {
218     TRACK_ELEM_FLAG_ONLY_UNDERWATER = (1 << 0),
219     TRACK_ELEM_FLAG_TURN_LEFT = (1 << 1),
220     TRACK_ELEM_FLAG_TURN_RIGHT = (1 << 2),
221     TRACK_ELEM_FLAG_TURN_BANKED = (1 << 3),
222     TRACK_ELEM_FLAG_TURN_SLOPED = (1 << 4),
223     TRACK_ELEM_FLAG_DOWN = (1 << 5),
224     TRACK_ELEM_FLAG_UP = (1 << 6),
225     TRACK_ELEM_FLAG_NORMAL_TO_INVERSION = (1 << 7),
226     TRACK_ELEM_FLAG_IS_GOLF_HOLE = (1 << 7),
227     TRACK_ELEM_FLAG_STARTS_AT_HALF_HEIGHT = (1 << 8),
228     TRACK_ELEM_FLAG_ONLY_ABOVE_GROUND = (1 << 9),
229     TRACK_ELEM_FLAG_IS_STEEP_UP = (1 << 10), // Used to allow steep backwards lifts on roller coasters that do not allow steep
230                                              // forward lift hills
231     TRACK_ELEM_FLAG_HELIX = (1 << 11),
232     TRACK_ELEM_FLAG_ALLOW_LIFT_HILL = (1 << 12),
233     TRACK_ELEM_FLAG_CURVE_ALLOWS_LIFT = (1 << 13),
234     TRACK_ELEM_FLAG_INVERSION_TO_NORMAL = (1 << 14),
235     TRACK_ELEM_FLAG_BANKED = (1 << 15), // Also set on Spinning Tunnel and Log Flume reverser, probably to save a flag.
236 };
237 
238 namespace TrackElemType
239 {
240     constexpr track_type_t Flat = 0;
241     constexpr track_type_t EndStation = 1;
242     constexpr track_type_t BeginStation = 2;
243     constexpr track_type_t MiddleStation = 3;
244     constexpr track_type_t Up25 = 4;
245     constexpr track_type_t Up60 = 5;
246     constexpr track_type_t FlatToUp25 = 6;
247     constexpr track_type_t Up25ToUp60 = 7;
248     constexpr track_type_t Up60ToUp25 = 8;
249     constexpr track_type_t Up25ToFlat = 9;
250     constexpr track_type_t Down25 = 10;
251     constexpr track_type_t Down60 = 11;
252     constexpr track_type_t FlatToDown25 = 12;
253     constexpr track_type_t Down25ToDown60 = 13;
254     constexpr track_type_t Down60ToDown25 = 14;
255     constexpr track_type_t Down25ToFlat = 15;
256     constexpr track_type_t LeftQuarterTurn5Tiles = 16;
257     constexpr track_type_t RightQuarterTurn5Tiles = 17;
258     constexpr track_type_t FlatToLeftBank = 18;
259     constexpr track_type_t FlatToRightBank = 19;
260     constexpr track_type_t LeftBankToFlat = 20;
261     constexpr track_type_t RightBankToFlat = 21;
262     constexpr track_type_t BankedLeftQuarterTurn5Tiles = 22;
263     constexpr track_type_t BankedRightQuarterTurn5Tiles = 23;
264     constexpr track_type_t LeftBankToUp25 = 24;
265     constexpr track_type_t RightBankToUp25 = 25;
266     constexpr track_type_t Up25ToLeftBank = 26;
267     constexpr track_type_t Up25ToRightBank = 27;
268     constexpr track_type_t LeftBankToDown25 = 28;
269     constexpr track_type_t RightBankToDown25 = 29;
270     constexpr track_type_t Down25ToLeftBank = 30;
271     constexpr track_type_t Down25ToRightBank = 31;
272     constexpr track_type_t LeftBank = 32;
273     constexpr track_type_t RightBank = 33;
274     constexpr track_type_t LeftQuarterTurn5TilesUp25 = 34;
275     constexpr track_type_t RightQuarterTurn5TilesUp25 = 35;
276     constexpr track_type_t LeftQuarterTurn5TilesDown25 = 36;
277     constexpr track_type_t RightQuarterTurn5TilesDown25 = 37;
278     constexpr track_type_t SBendLeft = 38;
279     constexpr track_type_t SBendRight = 39;
280     constexpr track_type_t LeftVerticalLoop = 40;
281     constexpr track_type_t RightVerticalLoop = 41;
282     constexpr track_type_t LeftQuarterTurn3Tiles = 42;
283     constexpr track_type_t RightQuarterTurn3Tiles = 43;
284     constexpr track_type_t LeftBankedQuarterTurn3Tiles = 44;
285     constexpr track_type_t RightBankedQuarterTurn3Tiles = 45;
286     constexpr track_type_t LeftQuarterTurn3TilesUp25 = 46;
287     constexpr track_type_t RightQuarterTurn3TilesUp25 = 47;
288     constexpr track_type_t LeftQuarterTurn3TilesDown25 = 48;
289     constexpr track_type_t RightQuarterTurn3TilesDown25 = 49;
290     constexpr track_type_t LeftQuarterTurn1Tile = 50;
291     constexpr track_type_t RightQuarterTurn1Tile = 51;
292     constexpr track_type_t LeftTwistDownToUp = 52;
293     constexpr track_type_t RightTwistDownToUp = 53;
294     constexpr track_type_t LeftTwistUpToDown = 54;
295     constexpr track_type_t RightTwistUpToDown = 55;
296     constexpr track_type_t HalfLoopUp = 56;
297     constexpr track_type_t HalfLoopDown = 57;
298     constexpr track_type_t LeftCorkscrewUp = 58;
299     constexpr track_type_t RightCorkscrewUp = 59;
300     constexpr track_type_t LeftCorkscrewDown = 60;
301     constexpr track_type_t RightCorkscrewDown = 61;
302     constexpr track_type_t FlatToUp60 = 62;
303     constexpr track_type_t Up60ToFlat = 63;
304     constexpr track_type_t FlatToDown60 = 64;
305     constexpr track_type_t Down60ToFlat = 65;
306     constexpr track_type_t TowerBase = 66;
307     constexpr track_type_t TowerSection = 67;
308     constexpr track_type_t FlatCovered = 68;
309     constexpr track_type_t Up25Covered = 69;
310     constexpr track_type_t Up60Covered = 70;
311     constexpr track_type_t FlatToUp25Covered = 71;
312     constexpr track_type_t Up25ToUp60Covered = 72;
313     constexpr track_type_t Up60ToUp25Covered = 73;
314     constexpr track_type_t Up25ToFlatCovered = 74;
315     constexpr track_type_t Down25Covered = 75;
316     constexpr track_type_t Down60Covered = 76;
317     constexpr track_type_t FlatToDown25Covered = 77;
318     constexpr track_type_t Down25ToDown60Covered = 78;
319     constexpr track_type_t Down60ToDown25Covered = 79;
320     constexpr track_type_t Down25ToFlatCovered = 80;
321     constexpr track_type_t LeftQuarterTurn5TilesCovered = 81;
322     constexpr track_type_t RightQuarterTurn5TilesCovered = 82;
323     constexpr track_type_t SBendLeftCovered = 83;
324     constexpr track_type_t SBendRightCovered = 84;
325     constexpr track_type_t LeftQuarterTurn3TilesCovered = 85;
326     constexpr track_type_t RightQuarterTurn3TilesCovered = 86;
327     constexpr track_type_t LeftHalfBankedHelixUpSmall = 87;
328     constexpr track_type_t RightHalfBankedHelixUpSmall = 88;
329     constexpr track_type_t LeftHalfBankedHelixDownSmall = 89;
330     constexpr track_type_t RightHalfBankedHelixDownSmall = 90;
331     constexpr track_type_t LeftHalfBankedHelixUpLarge = 91;
332     constexpr track_type_t RightHalfBankedHelixUpLarge = 92;
333     constexpr track_type_t LeftHalfBankedHelixDownLarge = 93;
334     constexpr track_type_t RightHalfBankedHelixDownLarge = 94;
335     constexpr track_type_t LeftQuarterTurn1TileUp60 = 95;
336     constexpr track_type_t RightQuarterTurn1TileUp60 = 96;
337     constexpr track_type_t LeftQuarterTurn1TileDown60 = 97;
338     constexpr track_type_t RightQuarterTurn1TileDown60 = 98;
339     constexpr track_type_t Brakes = 99;
340     constexpr track_type_t RotationControlToggleAlias = 100;
341     constexpr track_type_t Booster = 100;
342     constexpr track_type_t Maze = 101;
343     // Used by the multi-dimension coaster, as TD6 cannot handle index 255.
344     constexpr track_type_t InvertedUp90ToFlatQuarterLoopAlias = 101;
345     constexpr track_type_t LeftQuarterBankedHelixLargeUp = 102;
346     constexpr track_type_t RightQuarterBankedHelixLargeUp = 103;
347     constexpr track_type_t LeftQuarterBankedHelixLargeDown = 104;
348     constexpr track_type_t RightQuarterBankedHelixLargeDown = 105;
349     constexpr track_type_t LeftQuarterHelixLargeUp = 106;
350     constexpr track_type_t RightQuarterHelixLargeUp = 107;
351     constexpr track_type_t LeftQuarterHelixLargeDown = 108;
352     constexpr track_type_t RightQuarterHelixLargeDown = 109;
353     constexpr track_type_t Up25LeftBanked = 110;
354     constexpr track_type_t Up25RightBanked = 111;
355     constexpr track_type_t Waterfall = 112;
356     constexpr track_type_t Rapids = 113;
357     constexpr track_type_t OnRidePhoto = 114;
358     constexpr track_type_t Down25LeftBanked = 115;
359     constexpr track_type_t Down25RightBanked = 116;
360     constexpr track_type_t Watersplash = 117;
361     constexpr track_type_t FlatToUp60LongBase = 118;
362     constexpr track_type_t Up60ToFlatLongBase = 119;
363     constexpr track_type_t Whirlpool = 120;
364     constexpr track_type_t Down60ToFlatLongBase = 121;
365     constexpr track_type_t FlatToDown60LongBase = 122;
366     constexpr track_type_t CableLiftHill = 123;
367     constexpr track_type_t ReverseFreefallSlope = 124;
368     constexpr track_type_t ReverseFreefallVertical = 125;
369     constexpr track_type_t Up90 = 126;
370     constexpr track_type_t Down90 = 127;
371     constexpr track_type_t Up60ToUp90 = 128;
372     constexpr track_type_t Down90ToDown60 = 129;
373     constexpr track_type_t Up90ToUp60 = 130;
374     constexpr track_type_t Down60ToDown90 = 131;
375     constexpr track_type_t BrakeForDrop = 132;
376     constexpr track_type_t LeftEighthToDiag = 133;
377     constexpr track_type_t RightEighthToDiag = 134;
378     constexpr track_type_t LeftEighthToOrthogonal = 135;
379     constexpr track_type_t RightEighthToOrthogonal = 136;
380     constexpr track_type_t LeftEighthBankToDiag = 137;
381     constexpr track_type_t RightEighthBankToDiag = 138;
382     constexpr track_type_t LeftEighthBankToOrthogonal = 139;
383     constexpr track_type_t RightEighthBankToOrthogonal = 140;
384     constexpr track_type_t DiagFlat = 141;
385     constexpr track_type_t DiagUp25 = 142;
386     constexpr track_type_t DiagUp60 = 143;
387     constexpr track_type_t DiagFlatToUp25 = 144;
388     constexpr track_type_t DiagUp25ToUp60 = 145;
389     constexpr track_type_t DiagUp60ToUp25 = 146;
390     constexpr track_type_t DiagUp25ToFlat = 147;
391     constexpr track_type_t DiagDown25 = 148;
392     constexpr track_type_t DiagDown60 = 149;
393     constexpr track_type_t DiagFlatToDown25 = 150;
394     constexpr track_type_t DiagDown25ToDown60 = 151;
395     constexpr track_type_t DiagDown60ToDown25 = 152;
396     constexpr track_type_t DiagDown25ToFlat = 153;
397     constexpr track_type_t DiagFlatToUp60 = 154;
398     constexpr track_type_t DiagUp60ToFlat = 155;
399     constexpr track_type_t DiagFlatToDown60 = 156;
400     constexpr track_type_t DiagDown60ToFlat = 157;
401     constexpr track_type_t DiagFlatToLeftBank = 158;
402     constexpr track_type_t DiagFlatToRightBank = 159;
403     constexpr track_type_t DiagLeftBankToFlat = 160;
404     constexpr track_type_t DiagRightBankToFlat = 161;
405     constexpr track_type_t DiagLeftBankToUp25 = 162;
406     constexpr track_type_t DiagRightBankToUp25 = 163;
407     constexpr track_type_t DiagUp25ToLeftBank = 164;
408     constexpr track_type_t DiagUp25ToRightBank = 165;
409     constexpr track_type_t DiagLeftBankToDown25 = 166;
410     constexpr track_type_t DiagRightBankToDown25 = 167;
411     constexpr track_type_t DiagDown25ToLeftBank = 168;
412     constexpr track_type_t DiagDown25ToRightBank = 169;
413     constexpr track_type_t DiagLeftBank = 170;
414     constexpr track_type_t DiagRightBank = 171;
415     constexpr track_type_t LogFlumeReverser = 172;
416     constexpr track_type_t SpinningTunnel = 173;
417     constexpr track_type_t LeftBarrelRollUpToDown = 174;
418     constexpr track_type_t RightBarrelRollUpToDown = 175;
419     constexpr track_type_t LeftBarrelRollDownToUp = 176;
420     constexpr track_type_t RightBarrelRollDownToUp = 177;
421     constexpr track_type_t LeftBankToLeftQuarterTurn3TilesUp25 = 178;
422     constexpr track_type_t RightBankToRightQuarterTurn3TilesUp25 = 179;
423     constexpr track_type_t LeftQuarterTurn3TilesDown25ToLeftBank = 180;
424     constexpr track_type_t RightQuarterTurn3TilesDown25ToRightBank = 181;
425     constexpr track_type_t PoweredLift = 182;
426     constexpr track_type_t LeftLargeHalfLoopUp = 183;
427     constexpr track_type_t RightLargeHalfLoopUp = 184;
428     constexpr track_type_t RightLargeHalfLoopDown = 185;
429     constexpr track_type_t LeftLargeHalfLoopDown = 186;
430     constexpr track_type_t LeftFlyerTwistUp = 187;
431     constexpr track_type_t RightFlyerTwistUp = 188;
432     constexpr track_type_t LeftFlyerTwistDown = 189;
433     constexpr track_type_t RightFlyerTwistDown = 190;
434     constexpr track_type_t FlyerHalfLoopUp = 191;
435     constexpr track_type_t FlyerHalfLoopDown = 192;
436     constexpr track_type_t LeftFlyerCorkscrewUp = 193;
437     constexpr track_type_t RightFlyerCorkscrewUp = 194;
438     constexpr track_type_t LeftFlyerCorkscrewDown = 195;
439     constexpr track_type_t RightFlyerCorkscrewDown = 196;
440     constexpr track_type_t HeartLineTransferUp = 197;
441     constexpr track_type_t HeartLineTransferDown = 198;
442     constexpr track_type_t LeftHeartLineRoll = 199;
443     constexpr track_type_t RightHeartLineRoll = 200;
444     constexpr track_type_t MinigolfHoleA = 201;
445     constexpr track_type_t MinigolfHoleB = 202;
446     constexpr track_type_t MinigolfHoleC = 203;
447     constexpr track_type_t MinigolfHoleD = 204;
448     constexpr track_type_t MinigolfHoleE = 205;
449     constexpr track_type_t MultiDimInvertedFlatToDown90QuarterLoop = 206;
450     constexpr track_type_t Up90ToInvertedFlatQuarterLoop = 207;
451     constexpr track_type_t InvertedFlatToDown90QuarterLoop = 208;
452     constexpr track_type_t LeftCurvedLiftHill = 209;
453     constexpr track_type_t RightCurvedLiftHill = 210;
454     constexpr track_type_t LeftReverser = 211;
455     constexpr track_type_t RightReverser = 212;
456     constexpr track_type_t AirThrustTopCap = 213;
457     constexpr track_type_t AirThrustVerticalDown = 214;
458     constexpr track_type_t AirThrustVerticalDownToLevel = 215;
459     constexpr track_type_t BlockBrakes = 216;
460     constexpr track_type_t LeftBankedQuarterTurn3TileUp25 = 217;
461     constexpr track_type_t RightBankedQuarterTurn3TileUp25 = 218;
462     constexpr track_type_t LeftBankedQuarterTurn3TileDown25 = 219;
463     constexpr track_type_t RightBankedQuarterTurn3TileDown25 = 220;
464     constexpr track_type_t LeftBankedQuarterTurn5TileUp25 = 221;
465     constexpr track_type_t RightBankedQuarterTurn5TileUp25 = 222;
466     constexpr track_type_t LeftBankedQuarterTurn5TileDown25 = 223;
467     constexpr track_type_t RightBankedQuarterTurn5TileDown25 = 224;
468     constexpr track_type_t Up25ToLeftBankedUp25 = 225;
469     constexpr track_type_t Up25ToRightBankedUp25 = 226;
470     constexpr track_type_t LeftBankedUp25ToUp25 = 227;
471     constexpr track_type_t RightBankedUp25ToUp25 = 228;
472     constexpr track_type_t Down25ToLeftBankedDown25 = 229;
473     constexpr track_type_t Down25ToRightBankedDown25 = 230;
474     constexpr track_type_t LeftBankedDown25ToDown25 = 231;
475     constexpr track_type_t RightBankedDown25ToDown25 = 232;
476     constexpr track_type_t LeftBankedFlatToLeftBankedUp25 = 233;
477     constexpr track_type_t RightBankedFlatToRightBankedUp25 = 234;
478     constexpr track_type_t LeftBankedUp25ToLeftBankedFlat = 235;
479     constexpr track_type_t RightBankedUp25ToRightBankedFlat = 236;
480     constexpr track_type_t LeftBankedFlatToLeftBankedDown25 = 237;
481     constexpr track_type_t RightBankedFlatToRightBankedDown25 = 238;
482     constexpr track_type_t LeftBankedDown25ToLeftBankedFlat = 239;
483     constexpr track_type_t RightBankedDown25ToRightBankedFlat = 240;
484     constexpr track_type_t FlatToLeftBankedUp25 = 241;
485     constexpr track_type_t FlatToRightBankedUp25 = 242;
486     constexpr track_type_t LeftBankedUp25ToFlat = 243;
487     constexpr track_type_t RightBankedUp25ToFlat = 244;
488     constexpr track_type_t FlatToLeftBankedDown25 = 245;
489     constexpr track_type_t FlatToRightBankedDown25 = 246;
490     constexpr track_type_t LeftBankedDown25ToFlat = 247;
491     constexpr track_type_t RightBankedDown25ToFlat = 248;
492     constexpr track_type_t LeftQuarterTurn1TileUp90 = 249;
493     constexpr track_type_t RightQuarterTurn1TileUp90 = 250;
494     constexpr track_type_t LeftQuarterTurn1TileDown90 = 251;
495     constexpr track_type_t RightQuarterTurn1TileDown90 = 252;
496     constexpr track_type_t MultiDimUp90ToInvertedFlatQuarterLoop = 253;
497     constexpr track_type_t MultiDimFlatToDown90QuarterLoop = 254;
498     constexpr track_type_t MultiDimInvertedUp90ToFlatQuarterLoop = 255;
499     constexpr track_type_t RotationControlToggle = 256;
500 
501     constexpr track_type_t FlatTrack1x4A = 257;
502     constexpr track_type_t FlatTrack2x2 = 258;
503     constexpr track_type_t FlatTrack4x4 = 259;
504     constexpr track_type_t FlatTrack2x4 = 260;
505     constexpr track_type_t FlatTrack1x5 = 261;
506     constexpr track_type_t FlatTrack1x1A = 262;
507     constexpr track_type_t FlatTrack1x4B = 263;
508     constexpr track_type_t FlatTrack1x1B = 264;
509     constexpr track_type_t FlatTrack1x4C = 265;
510     constexpr track_type_t FlatTrack3x3 = 266;
511 
512     constexpr track_type_t Count = 267;
513     constexpr track_type_t None = 65535;
514 
515     constexpr track_type_t FlatTrack1x4A_Alias = 95;
516     constexpr track_type_t FlatTrack2x2_Alias = 110;
517     constexpr track_type_t FlatTrack4x4_Alias = 111;
518     constexpr track_type_t FlatTrack2x4_Alias = 115;
519     constexpr track_type_t FlatTrack1x5_Alias = 116;
520     constexpr track_type_t FlatTrack1x1A_Alias = 118;
521     constexpr track_type_t FlatTrack1x4B_Alias = 119;
522     constexpr track_type_t FlatTrack1x1B_Alias = 121;
523     constexpr track_type_t FlatTrack1x4C_Alias = 122;
524     constexpr track_type_t FlatTrack3x3_Alias = 123;
525 }; // namespace TrackElemType
526 
527 enum
528 {
529     TRACK_SEQUENCE_FLAG_DIRECTION_0 = (1 << 0),      // Ride Entrances and path connect to front
530     TRACK_SEQUENCE_FLAG_DIRECTION_1 = (1 << 1),      // connect to right
531     TRACK_SEQUENCE_FLAG_DIRECTION_2 = (1 << 2),      // connect to back
532     TRACK_SEQUENCE_FLAG_DIRECTION_3 = (1 << 3),      // connect to left
533     TRACK_SEQUENCE_FLAG_ORIGIN = (1 << 4),           // 0x10
534     TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH = (1 << 5), // 0x20
535     TRACK_SEQUENCE_FLAG_DISALLOW_DOORS = (1 << 6),   // 0x40
536 };
537 
538 enum
539 {
540     GC_SET_MAZE_TRACK_BUILD = 0,
541     GC_SET_MAZE_TRACK_MOVE = 1,
542     GC_SET_MAZE_TRACK_FILL = 2,
543 };
544 
545 struct track_circuit_iterator
546 {
547     CoordsXYE last;
548     CoordsXYE current;
549     int32_t currentZ;
550     int32_t currentDirection;
551     TileElement* first;
552     bool firstIteration;
553     bool looped;
554 };
555 
556 PitchAndRoll TrackPitchAndRollStart(track_type_t trackType);
557 PitchAndRoll TrackPitchAndRollEnd(track_type_t trackType);
558 
559 int32_t track_is_connected_by_shape(TileElement* a, TileElement* b);
560 
561 void track_circuit_iterator_begin(track_circuit_iterator* it, CoordsXYE first);
562 bool track_circuit_iterator_previous(track_circuit_iterator* it);
563 bool track_circuit_iterator_next(track_circuit_iterator* it);
564 bool track_circuit_iterators_match(const track_circuit_iterator* firstIt, const track_circuit_iterator* secondIt);
565 
566 void track_get_back(CoordsXYE* input, CoordsXYE* output);
567 void track_get_front(CoordsXYE* input, CoordsXYE* output);
568 
569 bool track_element_is_covered(track_type_t trackElementType);
570 bool track_type_is_station(track_type_t trackType);
571 
572 roll_type_t track_get_actual_bank(TileElement* tileElement, roll_type_t bank);
573 roll_type_t track_get_actual_bank_2(int32_t rideType, bool isInverted, roll_type_t bank);
574 roll_type_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement);
575 
576 bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flags, bool fromTrackDesign);
577 bool track_remove_station_element(const CoordsXYZD& loc, ride_id_t rideIndex, int32_t flags);
578 
579 money32 maze_set_track(
580     uint16_t x, uint16_t y, uint16_t z, uint8_t flags, bool initialPlacement, uint8_t direction, ride_id_t rideIndex,
581     uint8_t mode);
582 
583 bool TrackTypeHasSpeedSetting(track_type_t trackType);
584