Refactor rct_track_preview flags (#10906)

* Refactor rct_track_preview flags

* Zero-index rct_track_preview flags
This commit is contained in:
Michael Steenbeek
2020-03-11 16:53:16 +01:00
committed by GitHub
parent 3fd96e9a02
commit e441019b04
4 changed files with 412 additions and 405 deletions

View File

@@ -2368,7 +2368,7 @@ static void window_ride_construction_draw_track_piece(
trackBlock++;
CoordsXYZ mapCoords{ trackBlock->x, trackBlock->y, trackBlock->z };
if (trackBlock->var_09 & 2)
if (trackBlock->flags & RCT_PREVIEW_TRACK_FLAG_1)
{
mapCoords.x = 0;
mapCoords.y = 0;

View File

@@ -213,7 +213,7 @@ public:
int32_t baseZ = mapLoc.z;
int32_t clearanceZ = trackBlock->var_07;
if (trackBlock->var_09 & (1 << 2) && RideData5[ride->type].clearance_height > 24)
if (trackBlock->flags & RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL && RideData5[ride->type].clearance_height > 24)
{
clearanceZ += 24;
}
@@ -453,7 +453,7 @@ public:
auto quarterTile = trackBlock->var_08.Rotate(_origin.direction);
int32_t clearanceZ = trackBlock->var_07;
if (trackBlock->var_09 & (1 << 2) && RideData5[ride->type].clearance_height > 24)
if (trackBlock->flags & RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL && RideData5[ride->type].clearance_height > 24)
{
clearanceZ += 24;
}

View File

@@ -38,7 +38,7 @@ struct rct_preview_track
int16_t z; // 0x05
uint8_t var_07;
QuarterTile var_08;
uint8_t var_09;
uint8_t flags;
};
/* size 0x0A */
@@ -52,6 +52,13 @@ struct rct_track_coordinates
int16_t y; // 0x08
};
enum
{
RCT_PREVIEW_TRACK_FLAG_0 = (1 << 0),
RCT_PREVIEW_TRACK_FLAG_1 = (1 << 1),
RCT_PREVIEW_TRACK_FLAG_IS_VERTICAL = (1 << 2),
};
enum
{
TRACK_ELEMENT_FLAG_TERMINAL_STATION = 1 << 3,

File diff suppressed because it is too large Load Diff