From b6bcb8e106038bf3ce3af79d9e38b131037e0efe Mon Sep 17 00:00:00 2001 From: Spacek531 Date: Sat, 23 Dec 2023 12:23:55 -0800 Subject: [PATCH] Add secondary colour to supports scheme The wooden roller coaster and air powered vertical coaster both construct a paint scheme that incorporates the tertiary colour in the primary slot and the secondary colour in the secondary slot. Constructing the scheme requires at least one condition that can be removed by constructing the scheme when populating the PaintSessionCore. --- src/openrct2/ride/TrackPaint.cpp | 3 ++- .../coaster/AirPoweredVerticalCoaster.cpp | 19 ++++--------------- .../ride/coaster/WoodenRollerCoaster.h | 3 +-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index 220eb51c94..c471cd1db7 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -2256,7 +2256,8 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons session.InteractionType = ViewportInteractionItem::Ride; session.TrackColours = ImageId( 0, ride->track_colour[trackColourScheme].main, ride->track_colour[trackColourScheme].additional); - session.SupportColours = ImageId(0, ride->track_colour[trackColourScheme].supports); + session.SupportColours = ImageId( + 0, ride->track_colour[trackColourScheme].supports, ride->track_colour[trackColourScheme].additional); if (trackElement.IsHighlighted() || session.SelectedElement == reinterpret_cast(&trackElement)) { session.TrackColours = HighlightMarker; diff --git a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp index 1dd8fe4b9c..ce99201a53 100644 --- a/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/ride/coaster/AirPoweredVerticalCoaster.cpp @@ -164,17 +164,6 @@ enum SPR_AIR_POWERED_VERTICAL_RC_BANKED_QUARTER_TURN_5_FRONT_SE_NE_PART_0 = 22333, }; -static ImageId AirPoweredVerticalRCGetSupportColour(PaintSession& session) -{ - auto colourFlags = session.SupportColours; - auto trackColour = session.TrackColours; - if (trackColour.HasSecondary()) - { - colourFlags = colourFlags.WithSecondary(trackColour.GetSecondary()); - } - return colourFlags; -} - /** rct2: 0x008AFAD4 */ static void AirPoweredVerticalRCTrackFlat( PaintSession& session, const Ride& ride, uint8_t trackSequence, uint8_t direction, int32_t height, @@ -645,7 +634,7 @@ static void AirPoweredVerticalRCTrackVerticalSlopeUp( 48, 64, 128, 176, 208, 240, 240, }; - auto supportsImageId = AirPoweredVerticalRCGetSupportColour(session).WithIndex(supportImageIds[trackSequence][direction]); + auto supportsImageId = session.SupportColours.WithIndex(supportImageIds[trackSequence][direction]); auto trackImageId = session.TrackColours.WithIndex(trackImageIds[trackSequence][direction]); int8_t bbHeight; bool isDirection03 = (direction == 0 || direction == 3); @@ -782,7 +771,7 @@ static void AirPoweredVerticalRCTrackVerticalUp( switch (trackSequence) { case 0: - imageId = AirPoweredVerticalRCGetSupportColour(session).WithIndex(imageIds[direction][0]); + imageId = session.SupportColours.WithIndex(imageIds[direction][0]); PaintAddImageAsParentRotated(session, direction, imageId, { 0, 0, height }, { { 3, 3, height }, { 26, 26, 79 } }); break; case 1: @@ -839,7 +828,7 @@ static void AirPoweredVerticalRCTrackVerticalTop( switch (trackSequence) { case 0: - imageIdS = AirPoweredVerticalRCGetSupportColour(session).WithIndex(imageIds[direction][0]); + imageIdS = session.SupportColours.WithIndex(imageIds[direction][0]); imageIdT = session.TrackColours.WithIndex(imageIds[direction][1]); if (direction == 0) { @@ -885,7 +874,7 @@ static void AirPoweredVerticalRCTrackVerticalTop( PaintUtilSetVerticalTunnel(session, height + 80); break; case 3: - imageIdS = AirPoweredVerticalRCGetSupportColour(session).WithIndex(imageIds[direction][4]); + imageIdS = session.SupportColours.WithIndex(imageIds[direction][4]); imageIdT = session.TrackColours.WithIndex(imageIds[direction][5]); if (direction == 0) { diff --git a/src/openrct2/ride/coaster/WoodenRollerCoaster.h b/src/openrct2/ride/coaster/WoodenRollerCoaster.h index 70f6809abc..8dafc5e68c 100644 --- a/src/openrct2/ride/coaster/WoodenRollerCoaster.h +++ b/src/openrct2/ride/coaster/WoodenRollerCoaster.h @@ -38,8 +38,7 @@ template ImageId WoodenRCGetTrackColour(const PaintSession& sess if (isClassic) return session.TrackColours; else - return session.TrackColours.IsRemap() ? session.TrackColours - : session.TrackColours.WithPrimary(session.SupportColours.GetPrimary()); + return session.SupportColours; } ImageId WoodenRCGetRailsColour(PaintSession& session);