Skip to content

Fix land edges glitch when vehicles go through gentle to flat tunnels #23811

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

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

mixiate
Copy link
Contributor

@mixiate mixiate commented Feb 13, 2025

This fixes the land edges glitching when vehicles go through gentle to flat tunnels. It does this by drawing the edge underneath the tunnel with a lower height bounding box so that it doesn't conflict with the vehicle or track.

gentletoflattunnelsglitch.mp4
gentletoflattunnelsfixed.mp4

It doesn't fix this issue with the gentle slope tunnels, but it should help with solving it completely:
slopeendglitch
Most of this happens because those sprites are cut with the full edge beneath the tunnel in the front sprite.

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Feb 14, 2025

This seems to break some of the tunnels on the sprightly park ghost train.
Screenshot at 2025-02-14 03-20-20
Screenshot at 2025-02-14 03-21-02

@mixiate
Copy link
Contributor Author

mixiate commented Feb 14, 2025

Thanks so much for testing all of these. Really appreciate it.

It seems like a kind of random selection of door tunnels are affected by this? I'm not really sure what is happening or why. I'll try to get this sorted.

Seems like it's not just door tunnels actually.

Yeah I think the way I implemented this is just broken. The idea should still work though. Back to the drawing board.

@mixiate mixiate force-pushed the fix-gentle-to-flat-tunnel-glitch branch from f42d76d to 625cc20 Compare February 14, 2025 16:39
@mixiate
Copy link
Contributor Author

mixiate commented Feb 14, 2025

This should be working now. The implementation is simpler and more explicit what it's doing.

Copy link
Contributor

@ZeeMaji ZeeMaji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked a bunch of parks, including the previously tested sprightly park. Tunnels display as expected.

@@ -638,7 +639,9 @@ static void ViewportSurfaceDrawTileSideBottom(

if (isWater || curHeight != tunnelArray[tunnelIndex].height)
{
PaintAddImageAsParent(session, baseImageId, { offset, curHeight * kCoordsZPerTinyZ }, { bounds, 15 });
const auto td = kTunnels[EnumValue(tunnelArray[tunnelIndex].type)];
const auto boundBoxZ = curHeight == tunnelArray[tunnelIndex].height - 1 ? td.lowerEdgeBoundingBoxZ : 15;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What edge case is this intended to catch?

Copy link
Contributor Author

@mixiate mixiate Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's so only the edge section directly under the tunnel has a lower bounding box, rather than all of them. It's a little hard to get a clear picture because of how the bbs draw. Some of the bb edges are missing in this picture.

edgeboundingboxes

@Gymnasiast Gymnasiast merged commit d946ab3 into OpenRCT2:develop Feb 18, 2025
23 checks passed
Gymnasiast added a commit to Gymnasiast/OpenRCT2 that referenced this pull request Feb 25, 2025
- Feature: [OpenRCT2#22905] Add diagonal downward-inclined brakes to hybrid coaster and single rail coaster.
- Feature: [OpenRCT2#23759] Add see-through option to the “Cut-away View“.
- Improved: [OpenRCT2#23677] Building new ride track now inherits the colour scheme from the previous piece.
- Improved: [OpenRCT2#23720] Text fields now allow cutting to clipboard (Ctrl+X) in addition to copy and paste.
- Improved: [OpenRCT2#23874] The load/save file browser window now uses icons for its action buttons.
- Improved: [OpenRCT2#23875] Rides forbidden to be modified or destroyed can now be edited with the All destructible cheat.
- Improved: [OpenRCT2#23879] Unique weather icons for snow, heavy snow and blizzard.
- Fix: [OpenRCT2#1972, OpenRCT2#11679] Vehicles passing by toilets can cause them to glitch (original bug).
- Fix: [OpenRCT2#9999, OpenRCT2#10000, OpenRCT2#10001, OpenRCT2#10002, OpenRCT2#10003] Truncated scenario strings when using Catalan, Czech, Japanese, Polish or Russian.
- Fix: [OpenRCT2#14486] Guests will fall through upwards sloped paths when making their way through a park entrance or ride exit (original bug).
- Fix: [OpenRCT2#15826, OpenRCT2#23835] Wooden Roller Coaster steep turn supports glitch when train goes over them (original bug).
- Fix: [OpenRCT2#16357] Chairlift station covers draw incorrectly.
- Fix: [OpenRCT2#16657] Mine Ride right S-bend uses Mini Roller Coaster sprite (original bug).
- Fix: [OpenRCT2#18376] Ghost train gentle to flat track is not visible in tunnels.
- Fix: [OpenRCT2#18389] Gentle sloped track pieces are not visible in low clearance height tunnels (original bug).
- Fix: [OpenRCT2#18423] Underground Mini Golf holes can draw over land edges (original bug).
- Fix: [OpenRCT2#18433] CJK TrueType fonts cannot be located when font names are translated by the OS.
- Fix: [OpenRCT2#18436] Scenery on the same tile as steep to vertical track can draw over the track (original bug).
- Fix: [OpenRCT2#18711] Park entrances with their sides underground can cause glitching.
- Fix: [OpenRCT2#20848] Junior Roller Coaster booster track does not draw correctly in tunnels.
- Fix: [OpenRCT2#20948] Incorrect diagonal brakes supports on the Giga Coaster, Looping Roller Coaster and Wooden Roller Coaster.
- Fix: [OpenRCT2#21768] Dirty blocks debug overlay is rendered incorrectly on high DPI screens.
- Fix: [OpenRCT2#22229] Opening a park save file from a newer version of OpenRCT2 yields an unhelpful error message.
- Fix: [OpenRCT2#22617] Sloped Wooden and Side-Friction supports draw out of order when built directly above diagonal track pieces (original bug).
- Fix: [OpenRCT2#22620] Mine Train Coaster trains glitch on large banked turns.
- Fix: [OpenRCT2#23522] Diagonal sloped Steeplechase supports have glitched sprites at the base.
- Fix: [OpenRCT2#23580] Table header labels may overlap if the window is made very small.
- Fix: [OpenRCT2#23641] Steep to flat track is not drawn correctly in tunnels (original bug).
- Fix: [OpenRCT2#23795] Looping Roller Coaster vertical loop supports are drawn incorrectly.
- Fix: [OpenRCT2#23797] 3D Text cut off too early on multi-line signs.
- Fix: [OpenRCT2#23809] Trains glitch on Bobsleigh Coaster small helixes.
- Fix: [OpenRCT2#23811] Land edges glitch when vehicles go through gentle to flat tunnels.
- Fix: [OpenRCT2#23814] Scenarios not indexed on first start.
- Fix: [OpenRCT2#23818] Spinning tunnels can draw over sloped terrain in front of them.
- Fix: [OpenRCT2#23828] Vehicles passing by station entrances and exits can cause them to glitch (original bug).
- Fix: [OpenRCT2#23831] Hybrid Coaster large gentle banked right turns glitch when diagonal track is above them.
- Fix: [OpenRCT2#23832] Hybrid Coaster large gentle banked left turns supports glitch as train passes.
- Fix: [OpenRCT2#23836] Adjacent track can draw over large turns (original bug).
- Fix: [OpenRCT2#23858] LSM launched lift hill has a misaligned sprite.
CorySanin added a commit to CorySanin/OpenRCT2 that referenced this pull request Jun 22, 2025
- Feature: [OpenRCT2#22905] Add diagonal downward-inclined brakes to hybrid coaster and single rail coaster.
- Feature: [OpenRCT2#23759] Add see-through option to the “Cut-away View“.
- Improved: [OpenRCT2#23677] Building new ride track now inherits the colour scheme from the previous piece.
- Improved: [OpenRCT2#23720] Text fields now allow cutting to clipboard (Ctrl+X) in addition to copy and paste.
- Improved: [OpenRCT2#23874] The load/save file browser window now uses icons for its action buttons.
- Improved: [OpenRCT2#23875] Rides forbidden to be modified or destroyed can now be edited with the All destructible cheat.
- Improved: [OpenRCT2#23879] Unique weather icons for snow, heavy snow and blizzard.
- Fix: [OpenRCT2#1972, OpenRCT2#11679] Vehicles passing by toilets can cause them to glitch (original bug).
- Fix: [OpenRCT2#9999, OpenRCT2#10000, OpenRCT2#10001, OpenRCT2#10002, OpenRCT2#10003] Truncated scenario strings when using Catalan, Czech, Japanese, Polish or Russian.
- Fix: [OpenRCT2#14486] Guests will fall through upwards sloped paths when making their way through a park entrance or ride exit (original bug).
- Fix: [OpenRCT2#15826, OpenRCT2#23835] Wooden Roller Coaster steep turn supports glitch when train goes over them (original bug).
- Fix: [OpenRCT2#16357] Chairlift station covers draw incorrectly.
- Fix: [OpenRCT2#16657] Mine Ride right S-bend uses Mini Roller Coaster sprite (original bug).
- Fix: [OpenRCT2#18376] Ghost train gentle to flat track is not visible in tunnels.
- Fix: [OpenRCT2#18389] Gentle sloped track pieces are not visible in low clearance height tunnels (original bug).
- Fix: [OpenRCT2#18423] Underground Mini Golf holes can draw over land edges (original bug).
- Fix: [OpenRCT2#18433] CJK TrueType fonts cannot be located when font names are translated by the OS.
- Fix: [OpenRCT2#18436] Scenery on the same tile as steep to vertical track can draw over the track (original bug).
- Fix: [OpenRCT2#18711] Park entrances with their sides underground can cause glitching.
- Fix: [OpenRCT2#20848] Junior Roller Coaster booster track does not draw correctly in tunnels.
- Fix: [OpenRCT2#20948] Incorrect diagonal brakes supports on the Giga Coaster, Looping Roller Coaster and Wooden Roller Coaster.
- Fix: [OpenRCT2#21768] Dirty blocks debug overlay is rendered incorrectly on high DPI screens.
- Fix: [OpenRCT2#22229] Opening a park save file from a newer version of OpenRCT2 yields an unhelpful error message.
- Fix: [OpenRCT2#22617] Sloped Wooden and Side-Friction supports draw out of order when built directly above diagonal track pieces (original bug).
- Fix: [OpenRCT2#22620] Mine Train Coaster trains glitch on large banked turns.
- Fix: [OpenRCT2#23522] Diagonal sloped Steeplechase supports have glitched sprites at the base.
- Fix: [OpenRCT2#23580] Table header labels may overlap if the window is made very small.
- Fix: [OpenRCT2#23641] Steep to flat track is not drawn correctly in tunnels (original bug).
- Fix: [OpenRCT2#23795] Looping Roller Coaster vertical loop supports are drawn incorrectly.
- Fix: [OpenRCT2#23797] 3D Text cut off too early on multi-line signs.
- Fix: [OpenRCT2#23809] Trains glitch on Bobsleigh Coaster small helixes.
- Fix: [OpenRCT2#23811] Land edges glitch when vehicles go through gentle to flat tunnels.
- Fix: [OpenRCT2#23814] Scenarios not indexed on first start.
- Fix: [OpenRCT2#23818] Spinning tunnels can draw over sloped terrain in front of them.
- Fix: [OpenRCT2#23828] Vehicles passing by station entrances and exits can cause them to glitch (original bug).
- Fix: [OpenRCT2#23831] Hybrid Coaster large gentle banked right turns glitch when diagonal track is above them.
- Fix: [OpenRCT2#23832] Hybrid Coaster large gentle banked left turns supports glitch as train passes.
- Fix: [OpenRCT2#23836] Adjacent track can draw over large turns (original bug).
- Fix: [OpenRCT2#23858] LSM launched lift hill has a misaligned sprite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants