From 5fc55a0009857b0388022011f13128188dd44b14 Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Sat, 15 Feb 2025 17:02:56 +0000 Subject: [PATCH] Fix #1972, #11679: Vehicles passing by toilets can cause them to glitch --- distribution/changelog.txt | 1 + src/openrct2/paint/track/shops/Facility.cpp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 10452f5818..5566ab665e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.4.20 (in development) ------------------------------------------------------------------------ - Improved: [#23677] Building new ride track now inherits the colour scheme from the previous piece. +- Fix: [#1972, #11679] Vehicles passing by toilets can cause them to glitch. - Fix: [#9999, #10000, #10001, #10002, #10003] Truncated scenario strings when using Catalan, Czech, Japanese, Polish or Russian. - Fix: [#16357] Chairlift station covers draw incorrectly. - Fix: [#21768] Dirty blocks debug overlay is rendered incorrectly on high DPI screens. diff --git a/src/openrct2/paint/track/shops/Facility.cpp b/src/openrct2/paint/track/shops/Facility.cpp index c09efcacb7..ca003055ce 100644 --- a/src/openrct2/paint/track/shops/Facility.cpp +++ b/src/openrct2/paint/track/shops/Facility.cpp @@ -42,11 +42,10 @@ static void PaintFacility( if (firstCarEntry == nullptr) return; - auto lengthX = (direction & 1) == 0 ? 28 : 2; - auto lengthY = (direction & 1) == 0 ? 2 : 28; - CoordsXYZ offset(0, 0, height); - BoundBoxXYZ bb = { { direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height }, - { lengthX, lengthY, trackElement.GetClearanceZ() - trackElement.GetBaseZ() - 3 } }; + const auto lengthZ = trackElement.GetClearanceZ() - trackElement.GetBaseZ() - 3; + const CoordsXYZ offset(0, 0, height); + const BoundBoxXYZ bb = (direction == 0 || direction == 3) ? BoundBoxXYZ{ { 2, 2, height + lengthZ }, { 28, 28, 1 } } + : BoundBoxXYZ{ { 2, 2, height }, { 28, 8, lengthZ } }; auto imageTemplate = session.TrackColours; auto imageIndex = firstCarEntry->base_image_id + ((direction + 2) & 3); @@ -57,21 +56,21 @@ static void PaintFacility( auto foundationImageIndex = (direction & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS; auto foundationImageId = foundationImageTemplate.WithIndex(foundationImageIndex); PaintAddImageAsParent(session, foundationImageId, offset, bb); - PaintAddImageAsChild(session, imageId, offset, bb); + PaintAddImageAsChildRotated(session, direction, imageId, offset, bb); } else { - PaintAddImageAsParent(session, imageId, offset, bb); + PaintAddImageAsParentRotated(session, direction, imageId, offset, bb); } // Base image if door was drawn if (direction == 1) { - PaintAddImageAsParent(session, imageId.WithIndexOffset(2), offset, { { 28, 2, height }, { 2, 28, 29 } }); + PaintAddImageAsParent(session, imageId.WithIndexOffset(2), offset, { { 2, 2, height + lengthZ }, { 28, 28, 1 } }); } else if (direction == 2) { - PaintAddImageAsParent(session, imageId.WithIndexOffset(4), offset, { { 2, 28, height }, { 28, 2, 29 } }); + PaintAddImageAsParent(session, imageId.WithIndexOffset(4), offset, { { 2, 2, height + lengthZ }, { 28, 28, 1 } }); } PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0);