From 31035cd7aa6fd28456f8e81c90eb034a58bab1c2 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:28:10 +0200 Subject: [PATCH] Fix #22063: Incorrect colour on hybrid diag flat --- src/openrct2/ride/TrackPaint.cpp | 4 ++-- src/openrct2/ride/TrackPaint.h | 12 +++++++++++- src/openrct2/ride/coaster/HybridCoaster.cpp | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index b3cf78ccf2..f8c9e32c9f 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -1165,7 +1165,7 @@ constexpr CoordsXY defaultDiagBoundLengths[4] = { void TrackPaintUtilDiagTilesPaint( PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence, const uint32_t sprites[4], const CoordsXY offsets[4], const CoordsXY boundsLengths[4], const CoordsXYZ boundsOffsets[4], - int8_t additionalBoundsHeight) + int8_t additionalBoundsHeight, const ImageId colourFlags) { auto shouldDraw = kDiagSpriteMap[direction][trackSequence]; if (!shouldDraw) @@ -1173,7 +1173,7 @@ void TrackPaintUtilDiagTilesPaint( return; } - auto imageId = session.TrackColours.WithIndex(sprites[direction]); + auto imageId = colourFlags.WithIndex(sprites[direction]); CoordsXY offset = (offsets == nullptr ? CoordsXY() : offsets[direction]); CoordsXY boundsLength = boundsLengths[direction]; CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, additionalBoundsHeight) : boundsOffsets[direction]); diff --git a/src/openrct2/ride/TrackPaint.h b/src/openrct2/ride/TrackPaint.h index ef700a0917..d42fb8dba8 100644 --- a/src/openrct2/ride/TrackPaint.h +++ b/src/openrct2/ride/TrackPaint.h @@ -507,9 +507,19 @@ void TrackPaintUtilEighthToDiagTilesPaint( const ImageId colourFlags, const uint32_t sprites[4][4], const CoordsXY offsets[4][4], const CoordsXY boundsLengths[4][4], const CoordsXYZ boundsOffsets[4][4]); void TrackPaintUtilDiagTilesPaint( + PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence, + const uint32_t sprites[4], const CoordsXY offsets[4], const CoordsXY boundsLengths[4], const CoordsXYZ boundsOffsets[4], + int8_t additionalBoundsHeight, const ImageId colourFlags); +inline void TrackPaintUtilDiagTilesPaint( PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence, const uint32_t sprites[4], const CoordsXY offsets[4], const CoordsXY boundsLengths[4], - const CoordsXYZ boundsOffsets[4] = nullptr, int8_t additionalBoundsHeight = 0); + const CoordsXYZ boundsOffsets[4] = nullptr, int8_t additionalBoundsHeight = 0) +{ + TrackPaintUtilDiagTilesPaint( + session, thickness, height, direction, trackSequence, sprites, offsets, boundsLengths, boundsOffsets, + additionalBoundsHeight, session.TrackColours); +} + void TrackPaintUtilDiagTilesPaintExtra( PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence, const uint32_t sprites[4], MetalSupportType supportType); diff --git a/src/openrct2/ride/coaster/HybridCoaster.cpp b/src/openrct2/ride/coaster/HybridCoaster.cpp index 568dc99de2..c057db25f1 100644 --- a/src/openrct2/ride/coaster/HybridCoaster.cpp +++ b/src/openrct2/ride/coaster/HybridCoaster.cpp @@ -1389,7 +1389,7 @@ namespace HybridRC TrackPaintUtilDiagTilesPaint( session, 3, height, direction, trackSequence, images[trackElement.HasChain()], defaultDiagTileOffsets, - defaultDiagBoundLengths, nullptr); + defaultDiagBoundLengths, nullptr, 0, GetTrackColour(session)); switch (trackSequence) {