1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Allow shifting track designs underground

Since about a year ago, OpenRCT2 has allowed players to shift ride/track designs using modifier keys (#22669). This was, however, limited to heights above-ground. This PR changes this by omitting the 'Z placement assist' when ctrl/shift modifiers are used. This means the helpful 'nudge' to overground is now omitted if (and only if) these modifier keys are involved.

Below is an example of what placement now looks like (with clearance checks disabled for easier debugging):

https://github.com/user-attachments/assets/3b23bc1d-ab7b-43a2-ad40-216ab83952d2
This commit is contained in:
Aaron van Geffen
2025-09-17 23:09:07 +02:00
committed by GitHub
parent 3330513511
commit 51b4bbbce5
3 changed files with 24 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Improved: [#2296, #2307] The land tool now takes sloped track and paths into account when modifying land.
- Change: [#25161] Revert to the fair ride price calculation of vanilla RCT2.
- Fix: [#24513] Ride/track designs can now be shifted underground as well.
- Fix: [#25131] The Reverse Freefall Coaster On-ride photo section track has incorrectly coloured ties.
- Fix: [#25132] Crash when trying to use simulate on incomplete ride.
- Fix: [#25134] Vehicles visually glitch on diagonal steep slopes.

View File

@@ -98,6 +98,7 @@ namespace OpenRCT2::Ui::Windows
int32_t _trackPlaceShiftZ;
int32_t _trackPlaceZ;
bool _triggeredUndergroundView = false;
public:
void onOpen() override
@@ -538,6 +539,27 @@ namespace OpenRCT2::Ui::Windows
if (mapCoords.x == kLocationNull)
return std::nullopt;
// Trigger underground view?
auto* mainWnd = WindowGetMain();
if (mainWnd != nullptr && mainWnd->viewport != nullptr)
{
if (_trackPlaceZ < surfaceElement->GetBaseZ() && !_triggeredUndergroundView)
{
mainWnd->viewport->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
_triggeredUndergroundView = true;
}
else if (_trackPlaceZ >= surfaceElement->GetBaseZ() && _triggeredUndergroundView)
{
mainWnd->viewport->flags &= ~VIEWPORT_FLAG_UNDERGROUND_INSIDE;
_triggeredUndergroundView = false;
}
}
// Force placement at the designated position if modifiers are used
if (_trackPlaceShiftState || _trackPlaceCtrlState)
return _trackPlaceZ;
// Figure out a good position to place the design, taking other elements and surface height into account
return _trackPlaceZ
+ TrackDesignGetZPlacement(
*_trackDesign, RideGetTemporaryForPreview(), { mapCoords, _trackPlaceZ, _currentTrackPieceDirection });

View File

@@ -47,7 +47,7 @@
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
constexpr uint8_t kStreamVersion = 4;
constexpr uint8_t kStreamVersion = 5;
const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion);