Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor more constants in TrackPaint.h #21942

Merged
79 changes: 0 additions & 79 deletions src/openrct2/ride/TrackPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,85 +51,6 @@ static constexpr TileCoordsXY EntranceOffsetEdgeNW[] = {
{ -1, 0 },
};

const MetalSupportPlace DiagSupportPlacement[] = {
MetalSupportPlace::LeftCorner,
MetalSupportPlace::TopCorner,
MetalSupportPlace::RightCorner,
MetalSupportPlace::BottomCorner,
};

const uint32_t floorSpritesCork[] = {
SPR_FLOOR_CORK_SE_SW,
SPR_FLOOR_CORK_SW,
SPR_FLOOR_CORK_SE,
SPR_FLOOR_CORK,
};

const uint32_t floorSpritesMetal[] = {
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
};

const uint32_t floorSpritesMetalB[] = {
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
};

const uint32_t fenceSpritesRope[] = {
SPR_FENCE_ROPE_NE,
SPR_FENCE_ROPE_SE,
SPR_FENCE_ROPE_SW,
SPR_FENCE_ROPE_NW,
};

const uint32_t fenceSpritesMetal[] = {
SPR_FENCE_METAL_NE,
SPR_FENCE_METAL_SE,
SPR_FENCE_METAL_SW,
SPR_FENCE_METAL_NW,
};

const uint32_t fenceSpritesMetalB[] = {
SPR_FENCE_METAL_B_NE,
SPR_FENCE_METAL_B_SE,
SPR_FENCE_METAL_B_SW,
SPR_FENCE_METAL_B_NW,
};

const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3] = {
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2,
}
};

const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4] = {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW,
};

static constexpr uint32_t trackSpritesGhostTrainSpinningTunnel[2][2][4] = {
{
{
Expand Down
79 changes: 70 additions & 9 deletions src/openrct2/ride/TrackPaint.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ constexpr uint8_t kTrackMap1x4[][4] = {
{ 0, 1, 2, 3 },
};

extern const MetalSupportPlace DiagSupportPlacement[];
constexpr MetalSupportPlace kDiagSupportPlacement[] = {
MetalSupportPlace::LeftCorner,
MetalSupportPlace::TopCorner,
MetalSupportPlace::RightCorner,
MetalSupportPlace::BottomCorner,
};

enum
{
Expand Down Expand Up @@ -290,16 +295,72 @@ enum
MAZE_ENTRY_FLAG_15 = (1 << 15),
};

extern const uint32_t floorSpritesCork[];
extern const uint32_t floorSpritesMetal[];
extern const uint32_t floorSpritesMetalB[];
constexpr uint32_t kFloorSpritesCork[] = {
SPR_FLOOR_CORK_SE_SW,
SPR_FLOOR_CORK_SW,
SPR_FLOOR_CORK_SE,
SPR_FLOOR_CORK,
};
constexpr uint32_t kFloorSpritesMetal[] = {
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
SPR_FLOOR_METAL,
};
constexpr uint32_t kFloorSpritesMetalB[] = {
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
SPR_FLOOR_METAL_B,
};

extern const uint32_t fenceSpritesRope[];
extern const uint32_t fenceSpritesMetal[];
extern const uint32_t fenceSpritesMetalB[];
constexpr uint32_t kFenceSpritesRope[] = {
SPR_FENCE_ROPE_NE,
SPR_FENCE_ROPE_SE,
SPR_FENCE_ROPE_SW,
SPR_FENCE_ROPE_NW,
};
constexpr uint32_t kFenceSpritesMetal[] = {
SPR_FENCE_METAL_NE,
SPR_FENCE_METAL_SE,
SPR_FENCE_METAL_SW,
SPR_FENCE_METAL_NW,
};
constexpr uint32_t kFenceSpritesMetalB[] = {
SPR_FENCE_METAL_B_NE,
SPR_FENCE_METAL_B_SE,
SPR_FENCE_METAL_B_SW,
SPR_FENCE_METAL_B_NW,
};

extern const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3];
extern const uint32_t trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4];
constexpr uint32_t kTrackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3] = {
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2,
},
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2,
}
};
constexpr uint32_t kTrackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4] = {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW,
};

extern const uint8_t mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[];
extern const Direction mapReversedDiagonalStraight[];
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2/ride/coaster/BolligerMabillardTrack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14495,7 +14495,7 @@ static void BolligerMabillardTrackDiagBrakes(

if (trackSequence == 3)
{
MetalASupportsPaintSetup(session, supportType, DiagSupportPlacement[direction], 0, height, session.SupportColours);
MetalASupportsPaintSetup(session, supportType, kDiagSupportPlacement[direction], 0, height, session.SupportColours);
}

int32_t blockedSegments = BlockedSegments::kDiagStraightFlat[trackSequence];
Expand All @@ -14514,7 +14514,7 @@ static void BolligerMabillardTrackDiagBlockBrakes(

if (trackSequence == 3)
{
MetalASupportsPaintSetup(session, supportType, DiagSupportPlacement[direction], 0, height, session.SupportColours);
MetalASupportsPaintSetup(session, supportType, kDiagSupportPlacement[direction], 0, height, session.SupportColours);
}

int32_t blockedSegments = BlockedSegments::kDiagStraightFlat[trackSequence];
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/coaster/CompactInvertedCoaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6685,7 +6685,7 @@ inline void CompactInvertedRCTrackDiagFlatBase(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::TubesInverted, DiagSupportPlacement[direction], 0, height + 38, session.SupportColours);
session, MetalSupportType::TubesInverted, kDiagSupportPlacement[direction], 0, height + 38, session.SupportColours);
}
PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20);
}
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2/ride/coaster/CorkscrewRollerCoaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6526,7 +6526,7 @@ static void CorkscrewRCTrackDiagBrakes(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::Tubes, DiagSupportPlacement[direction], 0, height, session.SupportColours);
session, MetalSupportType::Tubes, kDiagSupportPlacement[direction], 0, height, session.SupportColours);
}

int32_t blockedSegments = BlockedSegments::kDiagStraightFlat[trackSequence];
Expand All @@ -6545,7 +6545,7 @@ static void CorkscrewRCTrackDiagBlockBrakes(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::Tubes, DiagSupportPlacement[direction], 0, height, session.SupportColours);
session, MetalSupportType::Tubes, kDiagSupportPlacement[direction], 0, height, session.SupportColours);
}

int32_t blockedSegments = BlockedSegments::kDiagStraightFlat[trackSequence];
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/coaster/FlyingRollerCoaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10055,7 +10055,7 @@ static void FlyingRCTrackDiagBrakesInverted(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::Boxed, DiagSupportPlacement[direction], 0, height + 39, session.SupportColours);
session, MetalSupportType::Boxed, kDiagSupportPlacement[direction], 0, height + 39, session.SupportColours);
}
PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20);
}
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/coaster/GigaCoaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18255,7 +18255,7 @@ static void GigaRCTrackDiagBrakes(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::Tubes, DiagSupportPlacement[direction], 0, height, session.SupportColours);
session, MetalSupportType::Tubes, kDiagSupportPlacement[direction], 0, height, session.SupportColours);
}

PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/coaster/InvertedRollerCoaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6396,7 +6396,7 @@ inline void InvertedRCTrackDiagFlatBase(
if (trackSequence == 3)
{
MetalASupportsPaintSetup(
session, MetalSupportType::Boxed, DiagSupportPlacement[direction], 0, height + 44, session.SupportColours);
session, MetalSupportType::Boxed, kDiagSupportPlacement[direction], 0, height + 44, session.SupportColours);
}
PaintUtilSetGeneralSupportHeight(session, height + 48, 0x20);
}
Expand Down