Skip to content

Building new track inherits alternate colour scheme from previous piece #23677

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 11 commits into from
Feb 3, 2025

Conversation

fidwell
Copy link
Contributor

@fidwell fidwell commented Jan 22, 2025

Implementation of suggestion in #23623.

When building a tracked ride, the ride's colour scheme will now "inherit" the scheme of the previous piece, if you were using one of the three alternate colour schemes. (Previously, it would always use the main scheme for new construction.)

This change will affect two use cases that behave slightly differently:

  1. Starting in the middle of a ride, then navigating with the << and >> arrows to the end of an unfinished track, and continuing the build.
  2. Right-clicking on the end of an unfinished track, and immediately building from there.

I'm also sneaking in a similar fix for brake speed and seat rotation. All three properties are combined in the properties track element and ought to behave similarly. For case 1, brake speed and seat rotation would correctly be "inherited", but they would not be in case 2.

Demonstrative screenshot

You can see that the main colour scheme is brown, but alternate colour scheme 2 (blue) is visible in the construction window, and will be used when building new track. (Alternate scheme 1, yellow, was also used to test.)

image

Technical notes

There's some repeated code in the diff for src/openrct2/ride/RideConstruction.cpp, but the two branches in that function already have a good amount of duplicated code. It felt more natural to follow the existing pattern there.

I haven't noticed any regression with constructing track yet (neither coasters and mazes).

Copy link
Member

@Gymnasiast Gymnasiast left a comment

Choose a reason for hiding this comment

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

Code looks good, needs testing.

@Gymnasiast Gymnasiast requested a review from ZeeMaji January 22, 2025 22:51
@Gymnasiast
Copy link
Member

Could you test this one as well, @ZeeMaji ?

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Jan 22, 2025

Sure!

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Jan 23, 2025

The color of the currently selected track piece doesn't update in the build menu or when you build it if you change the color of the piece before it. It won't update when changing pieces in the build menu either. It'll only update when you use the arrow buttons to move the selection backwards and then forwards again or re-select the track piece by right clicking.
Screenshot at 2025-01-23 04-34-50

Screenshot at 2025-01-23 04-36-43

@fidwell fidwell force-pushed the construction-alternate-schemes branch from 715065d to 33b647d Compare January 23, 2025 22:44
@fidwell
Copy link
Contributor Author

fidwell commented Jan 23, 2025

@ZeeMaji I have implemented this. I used the _previousTrackPiece variable to keep track of the last-built piece, and update the colour scheme when you paint that piece. I think it works? I tested a few different configurations (both building forward and backward) and it seems to work as intended.

(The _previousTrackPiece variable only seemed to be used when placing a new ride, so reusing it this way seems safe.)

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Jan 25, 2025

When building (block) brakes on the multi dim, the seat rotation gets set to the lowest value of -180
This applies to the built piece itself as it gets inherited by the next piece, so whatever you set it's rotation to gets overwriten to -180. Applies to both orthogonal and diagonal brakes.

Screenshot at 2025-01-25 06-47-34
Screenshot at 2025-01-25 06-47-55

@fidwell
Copy link
Contributor Author

fidwell commented Jan 25, 2025

@ZeeMaji Nice find! I think that this is actually a pre-existing bug. Try this on develop/release: build a multidim with seat rotation at 0°, build a block brake, and keep going. It looks like the block brake was also at 0° as you built it, but if you navigate back to it, it is set to -180°. This is because the construction window would set either the brake speed or the rotation, but not both, so it gets reset to -180° (which is an internal value of 0). You're seeing it show -180° in my branch because the visual in the construction window is now actually updated, where it wasn't before.

I'd guess this was a side effect of the speedy block brakes feature. I have pushed a change which should fix this by always setting the seat rotation.

@spacek531
Copy link
Contributor

spacek531 commented Jan 25, 2025

That is an original feature (not bug) that I somehow missed in speedy block brakes. In vanilla the speed and multidim properties occupied the same bits, so only one could be written at a time. The multidim option is not available on brakes still, for TD6 compatibility and ease of importing from older park versions. Somebody changed this (maybe it was me) but that was the original configuration.

@fidwell
Copy link
Contributor Author

fidwell commented Jan 25, 2025

So are you saying that the behavior ZeeMaji found is intended? I'm not sure if you're saying we should change it or not.

@spacek531
Copy link
Contributor

spacek531 commented Jan 25, 2025

I think someone changed it since speedy block brakes. The way I made it, there should be seat rotation on block brake, but not brakes. Apparently setting seat rotation never worked on block brakes and I never noticed.

The bugs are:

  • seat rotation isn't written on TrackElemType::BlockBrakes
  • seat rotation widget appears when building TrackElemType::Brakes and TrackElemType::Booster when building forward or backwards.

Setting seat rotation on brakes and boosters could be added, but it will cause TD6 compatibility problems.

@fidwell
Copy link
Contributor Author

fidwell commented Jan 25, 2025

In that case, I'd vote that we file these as separate bugs and fix them in new PRs. This one has already grown to be a bit more than I bargained for.

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Jan 26, 2025

Asides from the multidim bugs everything else seems to be working about as i'd expect.

@fidwell fidwell force-pushed the construction-alternate-schemes branch 2 times, most recently from 794abac to ea8930d Compare February 1, 2025 22:10
@Gymnasiast
Copy link
Member

Do I understand correctly that the seat rotation stuff was broken before the PR, and this doesn’t break it further?

@fidwell
Copy link
Contributor Author

fidwell commented Feb 1, 2025

From what I can tell, yes, that is the case. The behavior Maji found is already present in release.

@Gymnasiast
Copy link
Member

@ZeeMaji Could you approve if that’s the case?

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Feb 2, 2025

The multi-dim brake behavior seems different from release, as i can set it and it seemingly gets stored in the element as it gets inherited whenever i continue building from a brakes piece rather than getting set to -180 like on release. It doesn't have any affect on the trains however. It does work properly on block brakes now as in release it would get set to -180 there but here i can set it on block brakes and it gets saved and seems to work?

@fidwell
Copy link
Contributor Author

fidwell commented Feb 3, 2025

Yeah, this change will fix the seat rotation a little bit, but it won't fix it to the extent that SpaceK described. If you prefer, I can change it back to its previous behavior.

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Feb 3, 2025

I think reverting regular brakes to previous behavior would probably be the safest option. Block brakes seem fine from what i tested so they can probably remain fixed? Up to you though.

@fidwell fidwell force-pushed the construction-alternate-schemes branch from ea8930d to 54c0c74 Compare February 3, 2025 02:48
@fidwell
Copy link
Contributor Author

fidwell commented Feb 3, 2025

Sounds good. I've reverted the change to seat rotation; now only the color scheme should be affected with this PR.

@Gymnasiast Gymnasiast added the squash merge A PR that should be squashed on merge. label Feb 3, 2025
@Gymnasiast Gymnasiast force-pushed the construction-alternate-schemes branch from 54c0c74 to cf1f324 Compare February 3, 2025 21:36
@Gymnasiast Gymnasiast enabled auto-merge (squash) February 3, 2025 21:38
@Gymnasiast Gymnasiast added this to the v0.4.20 milestone Feb 3, 2025
@Gymnasiast Gymnasiast merged commit ca40a41 into OpenRCT2:develop Feb 3, 2025
23 checks passed
@fidwell fidwell deleted the construction-alternate-schemes branch February 3, 2025 22:07
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
squash merge A PR that should be squashed on merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants