From b70716d5f65cf4a0e2a54d374afe7efa858d5625 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sat, 25 Jul 2020 16:58:22 +0200 Subject: [PATCH] Fix #11804: Some RCT1 fences are imported at the wrong height --- distribution/changelog.txt | 1 + src/openrct2/rct1/S4Importer.cpp | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index e641405cad..3eb54ce027 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -40,6 +40,7 @@ - Fix: [#11640] Objects with a blank description in one language do not fall back to other languages anymore. - Fix: [#11676] Spiral Roller Coaster has regular lift hill available. - Fix: [#11695] Mechanics walk to tile 0, 0 at entrance only stations when trying to fix them. +- Fix: [#11804] Some RCT1 fences are imported at the wrong height. - Fix: [#11953] Incorrect banner text shade colour on wall text. - Fix: [#12062] Inconsistent lift hill sprites on Flying Coaster while inverted (original bug). - Fix: [#12068] Incorrect Entrance/Exit location on track design preview. Incorrect track design previews with track that contain diagonal track elements. diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c1ec835373..b105f65b41 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2807,13 +2807,25 @@ private: ConvertWall(&type, &colourA, &colourB); type = _wallTypeToEntryMap[type]; - auto edgeSlope = LandSlopeToWallSlope[slope][edge & 3] & ~EDGE_SLOPE_ELEVATED; + auto baseZ = originalTileElement.GetBaseZ(); + auto clearanceZ = originalTileElement.GetClearanceZ(); + auto edgeSlope = LandSlopeToWallSlope[slope][edge & 3]; + if (edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS)) + { + clearanceZ += LAND_HEIGHT_STEP; + } + if (edgeSlope & EDGE_SLOPE_ELEVATED) + { + edgeSlope &= ~EDGE_SLOPE_ELEVATED; + baseZ += LAND_HEIGHT_STEP; + clearanceZ += LAND_HEIGHT_STEP; + } auto element = tile_element_insert(location, originalTileElement.GetOccupiedQuadrants()); element->SetType(TILE_ELEMENT_TYPE_WALL); element->SetDirection(edge); - element->SetBaseZ(originalTileElement.GetBaseZ()); - element->SetClearanceZ(originalTileElement.GetClearanceZ()); + element->SetBaseZ(baseZ); + element->SetClearanceZ(clearanceZ); auto wallElement = element->AsWall(); wallElement->SetEntryIndex(type);