From 4d76e8c6191107f2d290035c3bda254efd437607 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 4 May 2020 12:30:03 +0200 Subject: [PATCH] Add booster drawing support to the APVC --- .../coaster/AirPoweredVerticalCoaster.cpp | 38 +++++++++++++++++++ .../coaster/meta/AirPoweredVerticalCoaster.h | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp index 99047ba44a..c7f11fd1e9 100644 --- a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp @@ -21,6 +21,9 @@ enum { + SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164, + SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165, + SPR_AIR_POWERED_VERTICAL_RC_FLAT_SW_NE = 22226, SPR_AIR_POWERED_VERTICAL_RC_FLAT_NW_SE = 22227, SPR_AIR_POWERED_VERTICAL_RC_STATION_SW_NE = 22228, @@ -893,6 +896,39 @@ static void air_powered_vertical_rc_track_vertical_slope_down( session, rideIndex, 6 - trackSequence, (direction + 2) & 3, height, tileElement); } +static void air_powered_vertical_rc_track_booster( + paint_session* session, ride_id_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, + const TileElement* tileElement) +{ + // The booster piece is borrowed from the Reverse Freefall Colour. + // It has two track colours, instead of the one that the APVC has. + uint32_t colour = session->TrackColours[SCHEME_TRACK]; + if (!tileElement->IsGhost() && !tileElement->AsTrack()->IsHighlighted()) + { + // Replace remap colour 2 (bits 24-28) with a copy of remap colour 1 (bits 19-23). + colour_t colour1 = (colour >> 19) & 31; + colour &= ~0x1F000000; + colour |= (colour1 << 24); + } + + if (direction & 1) + { + uint32_t imageId = SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE | colour; + sub_98197C(session, imageId, 0, 0, 20, 32, 1, height, 6, 0, height); + paint_util_push_tunnel_right(session, height, TUNNEL_6); + } + else + { + uint32_t imageId = SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE | colour; + sub_98197C(session, imageId, 0, 0, 32, 20, 1, height, 0, 6, height); + paint_util_push_tunnel_left(session, height, TUNNEL_6); + } + + wooden_a_supports_paint_setup(session, (direction & 1) ? 1 : 0, 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); + paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(session, height + 32, 0x20); +} + TRACK_PAINT_FUNCTION get_track_paint_function_air_powered_vertical_rc(int32_t trackType, int32_t direction) { switch (trackType) @@ -935,6 +971,8 @@ TRACK_PAINT_FUNCTION get_track_paint_function_air_powered_vertical_rc(int32_t tr return air_powered_vertical_rc_track_vertical_down; case TRACK_ELEM_AIR_THRUST_VERTICAL_DOWN_TO_LEVEL: return air_powered_vertical_rc_track_vertical_slope_down; + case TRACK_ELEM_BOOSTER: + return air_powered_vertical_rc_track_booster; } return nullptr; } diff --git a/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h b/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h index e27dae343c..1b645c4292 100644 --- a/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h +++ b/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h @@ -19,7 +19,7 @@ constexpr const RideTypeDescriptor AirPoweredVerticalCoasterRTD = SET_FIELD(AlternateType, RIDE_TYPE_NULL), SET_FIELD(Category, RIDE_CATEGORY_ROLLERCOASTER), SET_FIELD(EnabledTrackPieces, (1ULL << TRACK_STRAIGHT) | (1ULL << TRACK_STATION_END) | (1ULL << TRACK_LIFT_HILL_STEEP) | (1ULL << TRACK_LIFT_HILL_CURVE) | (1ULL << TRACK_FLAT_ROLL_BANKING) | (1ULL << TRACK_CURVE) | (1ULL << TRACK_BRAKES) | (1ULL << TRACK_REVERSE_FREEFALL) | (1ULL << TRACK_SLOPE_TO_FLAT)), - SET_FIELD(ExtraTrackPieces, 0), + SET_FIELD(ExtraTrackPieces, (1ULL << TRACK_BOOSTER)), SET_FIELD(StartTrackPiece, TRACK_ELEM_END_STATION), SET_FIELD(TrackPaintFunction, get_track_paint_function_air_powered_vertical_rc), SET_FIELD(Flags, RIDE_TYPE_FLAGS_TRACK_HAS_3_COLOURS | RIDE_TYPE_FLAGS_COMMON_COASTER | RIDE_TYPE_FLAGS_COMMON_COASTER_NON_ALT | RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES),