diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp
index af65cf6d9a..87d2b563d2 100644
--- a/src/openrct2-ui/windows/EditorObjectSelection.cpp
+++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp
@@ -104,10 +104,11 @@ static constexpr const ObjectPageDesc ObjectSelectionPages[] = {
{ STR_OBJECT_SELECTION_PARK_ENTRANCE, SPR_TAB_PARK, false },
{ STR_OBJECT_SELECTION_WATER, SPR_TAB_WATER, false },
- { STR_OBJECT_SELECTION_TERRAIN_SURFACES, SPR_G2_TAB_LAND, false },
- { STR_OBJECT_SELECTION_TERRAIN_EDGES, SPR_G2_TAB_LAND, false },
- { STR_OBJECT_SELECTION_STATIONS, SPR_TAB_PARK, false },
- { STR_OBJECT_SELECTION_MUSIC, SPR_TAB_MUSIC_0, false },
+ { STR_OBJECT_SELECTION_TERRAIN_SURFACES, SPR_G2_TAB_LAND, false },
+ { STR_OBJECT_SELECTION_TERRAIN_EDGES, SPR_G2_TAB_LAND, false },
+ { STR_OBJECT_SELECTION_STATIONS, SPR_TAB_PARK, false },
+ { STR_OBJECT_SELECTION_MUSIC, SPR_TAB_MUSIC_0, false },
+ { STR_OBJECT_SELECTION_FOOTPATHS, SPR_TAB_SCENERY_PATHS, false },
};
#pragma region Widgets
diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj
index 3859b5273e..55c2e6b1b4 100644
--- a/src/openrct2/libopenrct2.vcxproj
+++ b/src/openrct2/libopenrct2.vcxproj
@@ -253,6 +253,7 @@
+
@@ -672,6 +673,7 @@
+
diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp
index 6de138b344..6ffdb6dd02 100644
--- a/src/openrct2/object/FootpathObject.cpp
+++ b/src/openrct2/object/FootpathObject.cpp
@@ -100,6 +100,7 @@ void FootpathObject::ReadJson(IReadObjectContext* context, json_t& root)
{ "hasSupportImages", RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE },
{ "hasElevatedPathImages", RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS },
{ "editorOnly", FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR },
+ { "noSlopeRailings", FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS },
});
}
diff --git a/src/openrct2/object/FootpathRailingsObject.cpp b/src/openrct2/object/FootpathRailingsObject.cpp
new file mode 100644
index 0000000000..9c92dcb6c5
--- /dev/null
+++ b/src/openrct2/object/FootpathRailingsObject.cpp
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * Copyright (c) 2014-2021 OpenRCT2 developers
+ *
+ * For a complete list of all authors, please refer to contributors.md
+ * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is licensed under the GNU General Public License version 3.
+ *****************************************************************************/
+
+#include "FootpathRailingsObject.h"
+
+#include "../core/IStream.hpp"
+#include "../core/Json.hpp"
+
+void FootpathRailingsObject::Load()
+{
+ GetStringTable().Sort();
+ NameStringId = language_allocate_object_string(GetName());
+
+ auto numImages = GetImageTable().GetCount();
+ if (numImages != 0)
+ {
+ PreviewImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount());
+ BridgeImageId = PreviewImageId + 37;
+ RailingsImageId = PreviewImageId + 1;
+ }
+}
+
+void FootpathRailingsObject::Unload()
+{
+ language_free_object_string(NameStringId);
+ gfx_object_free_images(PreviewImageId, GetImageTable().GetCount());
+
+ NameStringId = 0;
+ PreviewImageId = 0;
+ BridgeImageId = 0;
+ RailingsImageId = 0;
+}
+
+void FootpathRailingsObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const
+{
+ auto screenCoords = ScreenCoordsXY{ (width - 45) / 2, (height - 34) / 2 };
+ gfx_draw_sprite(dpi, PreviewImageId, screenCoords, 0);
+}
+
+void FootpathRailingsObject::ReadJson(IReadObjectContext* context, json_t& root)
+{
+ Guard::Assert(root.is_object(), "FootpathObject::ReadJson expects parameter root to be object");
+
+ auto properties = root["properties"];
+ if (properties.is_object())
+ {
+ SupportType = ParseSupportType(Json::GetString(properties["supportType"]));
+ ScrollingMode = Json::GetNumber(properties["scrollingMode"]);
+ Flags = Json::GetFlags(
+ properties,
+ {
+ { "hasSupportImages", RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE },
+ { "hasElevatedPathImages", RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS },
+ });
+ }
+
+ PopulateTablesFromJson(context, root);
+}
+
+RailingEntrySupportType FootpathRailingsObject::ParseSupportType(std::string_view s)
+{
+ if (s == "pole")
+ return RailingEntrySupportType::Pole;
+ else /* if (s == "box") */
+ return RailingEntrySupportType::Box;
+}
diff --git a/src/openrct2/object/FootpathRailingsObject.h b/src/openrct2/object/FootpathRailingsObject.h
new file mode 100644
index 0000000000..fd67848534
--- /dev/null
+++ b/src/openrct2/object/FootpathRailingsObject.h
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2014-2021 OpenRCT2 developers
+ *
+ * For a complete list of all authors, please refer to contributors.md
+ * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is licensed under the GNU General Public License version 3.
+ *****************************************************************************/
+
+#pragma once
+
+#include "../world/Footpath.h"
+#include "Object.h"
+
+class FootpathRailingsObject final : public Object
+{
+public:
+ rct_string_id NameStringId{};
+ uint32_t PreviewImageId{};
+ uint32_t BridgeImageId{};
+ uint32_t RailingsImageId{};
+ RailingEntrySupportType SupportType{};
+ uint8_t Flags{};
+ uint8_t ScrollingMode{};
+
+public:
+ explicit FootpathRailingsObject(const rct_object_entry& entry)
+ : Object(entry)
+ {
+ }
+
+ void ReadJson(IReadObjectContext* context, json_t& root) override;
+ void Load() override;
+ void Unload() override;
+
+ void DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const override;
+
+private:
+ RailingEntrySupportType ParseSupportType(std::string_view s);
+};
diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h
index 0057bf3874..893187861b 100644
--- a/src/openrct2/object/Object.h
+++ b/src/openrct2/object/Object.h
@@ -42,6 +42,7 @@ enum class ObjectType : uint8_t
TerrainEdge,
Station,
Music,
+ FootpathRailings,
Count,
None = 255
diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp
index 98a045d31c..ceb4f429fd 100644
--- a/src/openrct2/object/ObjectFactory.cpp
+++ b/src/openrct2/object/ObjectFactory.cpp
@@ -24,6 +24,7 @@
#include "EntranceObject.h"
#include "FootpathItemObject.h"
#include "FootpathObject.h"
+#include "FootpathRailingsObject.h"
#include "LargeSceneryObject.h"
#include "MusicObject.h"
#include "Object.h"
@@ -341,6 +342,9 @@ namespace ObjectFactory
case ObjectType::Music:
result = std::make_unique(entry);
break;
+ case ObjectType::FootpathRailings:
+ result = std::make_unique(entry);
+ break;
default:
throw std::runtime_error("Invalid object type");
}
@@ -377,6 +381,8 @@ namespace ObjectFactory
return ObjectType::Station;
if (s == "music")
return ObjectType::Music;
+ if (s == "footpath_railings")
+ return ObjectType::FootpathRailings;
return ObjectType::None;
}
diff --git a/src/openrct2/object/ObjectLimits.h b/src/openrct2/object/ObjectLimits.h
index ffa9a56bd0..4807f46601 100644
--- a/src/openrct2/object/ObjectLimits.h
+++ b/src/openrct2/object/ObjectLimits.h
@@ -26,6 +26,7 @@ constexpr const uint16_t MAX_TERRAIN_SURFACE_OBJECTS = 100;
constexpr const uint16_t MAX_TERRAIN_EDGE_OBJECTS = 100;
constexpr const uint16_t MAX_STATION_OBJECTS = 100;
constexpr const uint16_t MAX_MUSIC_OBJECTS = 255;
+constexpr const uint16_t MAX_FOOTPATH_RAILINGS_OBJECTS = 32;
// clang-format off
constexpr const uint16_t OBJECT_ENTRY_COUNT =
@@ -43,7 +44,8 @@ constexpr const uint16_t OBJECT_ENTRY_COUNT =
MAX_TERRAIN_SURFACE_OBJECTS +
MAX_TERRAIN_EDGE_OBJECTS +
MAX_STATION_OBJECTS +
- MAX_MUSIC_OBJECTS;
+ MAX_MUSIC_OBJECTS +
+ MAX_FOOTPATH_RAILINGS_OBJECTS;
// clang-format on
constexpr const uint8_t DAT_NAME_LENGTH = 8;
diff --git a/src/openrct2/object/ObjectList.cpp b/src/openrct2/object/ObjectList.cpp
index 34d421c062..15fd10efdf 100644
--- a/src/openrct2/object/ObjectList.cpp
+++ b/src/openrct2/object/ObjectList.cpp
@@ -38,6 +38,7 @@ int32_t object_entry_group_counts[] = {
MAX_TERRAIN_EDGE_OBJECTS,
MAX_STATION_OBJECTS,
MAX_MUSIC_OBJECTS,
+ MAX_FOOTPATH_RAILINGS_OBJECTS,
};
// 98DA2C
diff --git a/src/openrct2/paint/Supports.cpp b/src/openrct2/paint/Supports.cpp
index cc94f12f7d..e279e6d05f 100644
--- a/src/openrct2/paint/Supports.cpp
+++ b/src/openrct2/paint/Supports.cpp
@@ -10,6 +10,7 @@
#include "Supports.h"
#include "../interface/Viewport.h"
+#include "../object/FootpathRailingsObject.h"
#include "../sprites.h"
#include "../world/Surface.h"
#include "Paint.h"
@@ -1203,7 +1204,7 @@ bool metal_b_supports_paint_setup(
*/
bool path_a_supports_paint_setup(
paint_session* session, int32_t supportType, int32_t special, int32_t height, uint32_t imageColourFlags,
- PathRailingsEntry* railingEntry, bool* underground)
+ FootpathRailingsObject* railingEntry, bool* underground)
{
if (underground != nullptr)
{
@@ -1236,7 +1237,7 @@ bool path_a_supports_paint_setup(
if (session->Support.slope & 0x20)
{
// save dx2
- PaintAddImageAsParent(session, (railingEntry->bridge_image + 48) | imageColourFlags, 0, 0, 32, 32, 0, baseHeight - 2);
+ PaintAddImageAsParent(session, (railingEntry->BridgeImageId + 48) | imageColourFlags, 0, 0, 32, 32, 0, baseHeight - 2);
hasSupports = true;
}
else if (session->Support.slope & 0x10)
@@ -1250,7 +1251,7 @@ bool path_a_supports_paint_setup(
}
uint32_t imageId = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]
- + railingEntry->bridge_image;
+ + railingEntry->BridgeImageId;
PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
baseHeight += 16;
@@ -1271,7 +1272,7 @@ bool path_a_supports_paint_setup(
}
uint32_t ebx = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]
- + railingEntry->bridge_image;
+ + railingEntry->BridgeImageId;
PaintAddImageAsParent(session, ebx | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
@@ -1283,7 +1284,7 @@ bool path_a_supports_paint_setup(
{
if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == session->WaterHeight)
{
- uint32_t imageId = (supportType * 24) + railingEntry->bridge_image + 23;
+ uint32_t imageId = (supportType * 24) + railingEntry->BridgeImageId + 23;
PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, ((heightSteps == 1) ? 7 : 12), baseHeight);
heightSteps -= 1;
@@ -1292,7 +1293,7 @@ bool path_a_supports_paint_setup(
}
else
{
- uint32_t imageId = (supportType * 24) + railingEntry->bridge_image + 22;
+ uint32_t imageId = (supportType * 24) + railingEntry->BridgeImageId + 22;
PaintAddImageAsParent(
session, imageId | imageColourFlags, 0, 0, 32, 32, ((heightSteps == 2) ? 23 : 28), baseHeight);
@@ -1306,7 +1307,7 @@ bool path_a_supports_paint_setup(
{
uint16_t specialIndex = (special - 1) & 0xFFFF;
- uint32_t imageId = railingEntry->bridge_image + 55 + specialIndex;
+ uint32_t imageId = railingEntry->BridgeImageId + 55 + specialIndex;
unk_supports_desc supportsDesc = byte_98D8D4[specialIndex];
unk_supports_desc_bound_box boundBox = supportsDesc.bounding_box;
@@ -1351,7 +1352,7 @@ bool path_a_supports_paint_setup(
*/
bool path_b_supports_paint_setup(
paint_session* session, int32_t segment, int32_t special, int32_t height, uint32_t imageColourFlags,
- PathRailingsEntry* railingEntry)
+ FootpathRailingsObject* railingEntry)
{
support_height* supportSegments = session->SupportSegments;
@@ -1373,7 +1374,7 @@ bool path_b_supports_paint_setup(
uint16_t baseHeight;
if ((supportSegments[segment].slope & 0x20) || (height - supportSegments[segment].height < 6)
- || !(railingEntry->flags & RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE))
+ || !(railingEntry->Flags & RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE))
{
baseHeight = supportSegments[segment].height;
}
@@ -1383,7 +1384,7 @@ bool path_b_supports_paint_setup(
baseHeight = supportSegments[segment].height;
PaintAddImageAsParent(
- session, (railingEntry->bridge_image + 37 + imageOffset) | imageColourFlags, SupportBoundBoxes[segment].x,
+ session, (railingEntry->BridgeImageId + 37 + imageOffset) | imageColourFlags, SupportBoundBoxes[segment].x,
SupportBoundBoxes[segment].y, 0, 0, 5, baseHeight);
baseHeight += 6;
}
@@ -1402,7 +1403,7 @@ bool path_b_supports_paint_setup(
if (heightDiff > 0)
{
PaintAddImageAsParent(
- session, (railingEntry->bridge_image + 20 + (heightDiff - 1)) | imageColourFlags, SupportBoundBoxes[segment].x,
+ session, (railingEntry->BridgeImageId + 20 + (heightDiff - 1)) | imageColourFlags, SupportBoundBoxes[segment].x,
SupportBoundBoxes[segment].y, 0, 0, heightDiff - 1, baseHeight);
}
@@ -1435,7 +1436,7 @@ bool path_b_supports_paint_setup(
}
PaintAddImageAsParent(
- session, (railingEntry->bridge_image + 20 + (z - 1)) | imageColourFlags, SupportBoundBoxes[segment].x,
+ session, (railingEntry->BridgeImageId + 20 + (z - 1)) | imageColourFlags, SupportBoundBoxes[segment].x,
SupportBoundBoxes[segment].y, 0, 0, (z - 1), baseHeight);
baseHeight += z;
@@ -1446,7 +1447,7 @@ bool path_b_supports_paint_setup(
break;
}
- uint32_t imageId = railingEntry->bridge_image + 20 + (z - 1);
+ uint32_t imageId = railingEntry->BridgeImageId + 20 + (z - 1);
if (z == 16)
{
imageId += 1;
@@ -1481,7 +1482,7 @@ bool path_b_supports_paint_setup(
break;
}
- uint32_t imageId = railingEntry->bridge_image + 20 + (z - 1);
+ uint32_t imageId = railingEntry->BridgeImageId + 20 + (z - 1);
PaintAddImageAsParent(
session, imageId | imageColourFlags, SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, 0, 0, 0,
baseHeight, SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight);
diff --git a/src/openrct2/paint/Supports.h b/src/openrct2/paint/Supports.h
index 69f9956d09..5a76a8cca0 100644
--- a/src/openrct2/paint/Supports.h
+++ b/src/openrct2/paint/Supports.h
@@ -25,10 +25,10 @@ bool metal_b_supports_paint_setup(
paint_session* session, uint8_t supportType, uint8_t segment, int32_t special, int32_t height, uint32_t imageColourFlags);
bool path_a_supports_paint_setup(
paint_session* session, int32_t supportType, int32_t special, int32_t height, uint32_t imageColourFlags,
- PathRailingsEntry* railingEntry, bool* underground);
+ FootpathRailingsObject* railingEntry, bool* underground);
bool path_b_supports_paint_setup(
paint_session* session, int32_t supportType, int32_t special, int32_t height, uint32_t imageColourFlags,
- PathRailingsEntry* railingEntry);
+ FootpathRailingsObject* railingEntry);
// There are 13 types of metal supports. A graphic showing all of them is available here:
// https://cloud.githubusercontent.com/assets/737603/19420485/7eaba28e-93ec-11e6-83cb-03190accc094.png
diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp
index 00cff7b966..a4cc361124 100644
--- a/src/openrct2/paint/tile_element/Paint.Path.cpp
+++ b/src/openrct2/paint/tile_element/Paint.Path.cpp
@@ -7,12 +7,15 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
+#include "../../Context.h"
#include "../../Game.h"
#include "../../config/Config.h"
#include "../../drawing/LightFX.h"
#include "../../interface/Viewport.h"
#include "../../localisation/Localisation.h"
+#include "../../object/FootpathRailingsObject.h"
#include "../../object/ObjectList.h"
+#include "../../object/ObjectManager.h"
#include "../../peep/Staff.h"
#include "../../ride/Track.h"
#include "../../ride/TrackDesign.h"
@@ -83,10 +86,10 @@ static constexpr const uint8_t byte_98D8A4[] = {
void path_paint_box_support(
paint_session* session, const TileElement* tileElement, int32_t height, PathSurfaceEntry* footpathEntry,
- PathRailingsEntry* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
+ FootpathRailingsObject* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
void path_paint_pole_support(
paint_session* session, const TileElement* tileElement, int16_t height, PathSurfaceEntry* footpathEntry,
- PathRailingsEntry* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
+ FootpathRailingsObject* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
/* rct2: 0x006A5AE5 */
static void path_bit_lights_paint(
@@ -321,10 +324,10 @@ static void path_bit_jumping_fountains_paint(
* @param tile_element (esi)
*/
static void sub_6A4101(
- paint_session* session, const TileElement* tile_element, uint16_t height, uint32_t connectedEdges, bool word_F3F038,
- PathRailingsEntry* railingEntry, uint32_t imageFlags)
+ paint_session* session, const TileElement* tile_element, uint16_t height, uint32_t connectedEdges, bool hasSupports,
+ PathSurfaceEntry* surfaceEntry, FootpathRailingsObject* railingEntry, uint32_t imageFlags)
{
- uint32_t base_image_id = railingEntry->railings_image | imageFlags;
+ uint32_t base_image_id = railingEntry->RailingsImageId | imageFlags;
if (tile_element->AsPath()->IsQueue())
{
@@ -446,7 +449,7 @@ static void sub_6A4101(
auto ride = get_ride(tile_element->AsPath()->GetRideIndex());
if (direction < 2 && ride != nullptr && imageFlags == 0)
{
- uint16_t scrollingMode = railingEntry->scrolling_mode;
+ uint16_t scrollingMode = railingEntry->ScrollingMode;
scrollingMode += direction;
auto ft = Formatter();
@@ -489,12 +492,13 @@ static void sub_6A4101(
uint32_t drawnCorners = 0;
// If the path is not drawn over the supports, then no corner sprites will be drawn (making double-width paths
// look like connected series of intersections).
- if (tile_element->AsPath()->ShouldDrawPathOverSupports())
+ if (railingEntry->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)
{
drawnCorners = (connectedEdges & FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK) >> 4;
}
- if (tile_element->AsPath()->IsSloped())
+ auto slopeRailingsSupported = !(surfaceEntry->flags & FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS);
+ if ((hasSupports || slopeRailingsSupported) && tile_element->AsPath()->IsSloped())
{
switch ((tile_element->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
@@ -519,7 +523,7 @@ static void sub_6A4101(
}
else
{
- if (!word_F3F038)
+ if (!hasSupports)
{
return;
}
@@ -669,7 +673,8 @@ static void sub_6A4101(
*/
static void sub_6A3F61(
paint_session* session, const TileElement* tile_element, uint16_t connectedEdges, uint16_t height,
- PathRailingsEntry* railingEntry, uint32_t imageFlags, uint32_t sceneryImageFlags, bool word_F3F038)
+ PathSurfaceEntry* surfaceEntry, FootpathRailingsObject* railingEntry, uint32_t imageFlags, uint32_t sceneryImageFlags,
+ bool hasSupports)
{
// eax --
// ebx --
@@ -749,7 +754,7 @@ static void sub_6A3F61(
// Redundant zoom-level check removed
if (paintScenery)
- sub_6A4101(session, tile_element, height, connectedEdges, word_F3F038, railingEntry, imageFlags);
+ sub_6A4101(session, tile_element, height, connectedEdges, hasSupports, surfaceEntry, railingEntry, imageFlags);
}
// This is about tunnel drawing
@@ -940,11 +945,11 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
}
PathSurfaceEntry* footpathEntry = tile_element->AsPath()->GetSurfaceEntry();
- PathRailingsEntry* railingEntry = tile_element->AsPath()->GetRailingEntry();
+ auto railingEntry = get_path_railings_entry(0);
if (footpathEntry != nullptr && railingEntry != nullptr)
{
- if (railingEntry->support_type == RailingEntrySupportType::Pole)
+ if (railingEntry->SupportType == RailingEntrySupportType::Pole)
{
path_paint_pole_support(
session, tile_element, height, footpathEntry, railingEntry, hasSupports, imageFlags, sceneryImageFlags);
@@ -990,7 +995,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
void path_paint_box_support(
paint_session* session, const TileElement* tileElement, int32_t height, PathSurfaceEntry* footpathEntry,
- PathRailingsEntry* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
+ FootpathRailingsObject* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
const PathElement* pathElement = tileElement->AsPath();
@@ -1054,11 +1059,11 @@ void path_paint_box_support(
{
image_id = ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
- + railingEntry->bridge_image + 51;
+ + railingEntry->BridgeImageId + 51;
}
else
{
- image_id = byte_98D8A4[edges] + railingEntry->bridge_image + 49;
+ image_id = byte_98D8A4[edges] + railingEntry->BridgeImageId + 49;
}
PaintAddImageAsParent(
@@ -1066,7 +1071,7 @@ void path_paint_box_support(
height + boundingBoxZOffset);
// TODO: Revert this when path import works correctly.
- if (!pathElement->IsQueue() && !pathElement->ShouldDrawPathOverSupports())
+ if (!pathElement->IsQueue() && !(railingEntry->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
{
// don't draw
}
@@ -1078,7 +1083,7 @@ void path_paint_box_support(
}
}
- sub_6A3F61(session, tileElement, edi, height, railingEntry, imageFlags, sceneryImageFlags, hasSupports);
+ sub_6A3F61(session, tileElement, edi, height, footpathEntry, railingEntry, imageFlags, sceneryImageFlags, hasSupports);
uint16_t ax = 0;
if (tileElement->AsPath()->IsSloped())
@@ -1140,7 +1145,7 @@ void path_paint_box_support(
void path_paint_pole_support(
paint_session* session, const TileElement* tileElement, int16_t height, PathSurfaceEntry* footpathEntry,
- PathRailingsEntry* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
+ FootpathRailingsObject* railingEntry, bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
const PathElement* pathElement = tileElement->AsPath();
@@ -1204,11 +1209,11 @@ void path_paint_pole_support(
{
bridgeImage = ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
- + railingEntry->bridge_image + 16;
+ + railingEntry->BridgeImageId + 16;
}
else
{
- bridgeImage = edges + railingEntry->bridge_image;
+ bridgeImage = edges + railingEntry->BridgeImageId;
bridgeImage |= imageFlags;
}
@@ -1217,7 +1222,7 @@ void path_paint_pole_support(
boundBoxOffset.y, height + boundingBoxZOffset);
// TODO: Revert this when path import works correctly.
- if (pathElement->IsQueue() || pathElement->ShouldDrawPathOverSupports())
+ if (pathElement->IsQueue() || (railingEntry->Flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
{
PaintAddImageAsChild(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
@@ -1225,7 +1230,9 @@ void path_paint_pole_support(
}
}
- sub_6A3F61(session, tileElement, edi, height, railingEntry, imageFlags, sceneryImageFlags, hasSupports); // TODO: arguments
+ sub_6A3F61(
+ session, tileElement, edi, height, footpathEntry, railingEntry, imageFlags, sceneryImageFlags,
+ hasSupports); // TODO: arguments
uint16_t ax = 0;
if (tileElement->AsPath()->IsSloped())
diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp
index 10df2b28a5..8c2d38bbd7 100644
--- a/src/openrct2/rct1/S4Importer.cpp
+++ b/src/openrct2/rct1/S4Importer.cpp
@@ -1658,7 +1658,6 @@ private:
dst2->SetIsBlockedByVehicle(false);
dst2->SetSurfaceEntryIndex(entryIndex);
- dst2->SetShouldDrawPathOverSupports(true);
if (RCT1::PathIsQueue(pathType))
{
dst2->SetIsQueue(true);
diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp
index fcf7e9aa32..6348f85f3b 100644
--- a/src/openrct2/world/Footpath.cpp
+++ b/src/openrct2/world/Footpath.cpp
@@ -20,6 +20,7 @@
#include "../management/Finance.h"
#include "../network/network.h"
#include "../object/FootpathObject.h"
+#include "../object/FootpathRailingsObject.h"
#include "../object/ObjectList.h"
#include "../object/ObjectManager.h"
#include "../paint/VirtualFloor.h"
@@ -1668,7 +1669,8 @@ PathSurfaceEntry* PathElement::GetSurfaceEntry() const
PathRailingsEntry* PathElement::GetRailingEntry() const
{
- return get_path_railings_entry(GetRailingEntryIndex());
+ return nullptr;
+ // return get_path_railings_entry(GetRailingEntryIndex());
}
void PathElement::SetSurfaceEntryIndex(PathSurfaceIndex newIndex)
@@ -1692,16 +1694,6 @@ void PathElement::SetQueueBannerDirection(uint8_t direction)
type |= (direction << 6);
}
-bool PathElement::ShouldDrawPathOverSupports() const
-{
- return (GetRailingEntry()->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS);
-}
-
-void PathElement::SetShouldDrawPathOverSupports(bool on)
-{
- log_verbose("Setting 'draw path over supports' to %d", static_cast(on));
-}
-
/**
*
* rct2: 0x006A8B12
@@ -2268,16 +2260,10 @@ PathSurfaceEntry* get_path_surface_entry(PathSurfaceIndex entryIndex)
return result;
}
-PathRailingsEntry* get_path_railings_entry(PathRailingsIndex entryIndex)
+FootpathRailingsObject* get_path_railings_entry(PathRailingsIndex entryIndex)
{
- PathRailingsEntry* result = nullptr;
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
- auto obj = objMgr.GetLoadedObject(ObjectType::Paths, entryIndex);
- if (obj != nullptr)
- {
- result = (static_cast(obj))->GetPathRailingsEntry();
- }
- return result;
+ return static_cast(objMgr.GetLoadedObject(ObjectType::FootpathRailings, entryIndex));
}
ride_id_t PathElement::GetRideIndex() const
diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h
index 94435e0f6c..e54a51b8f1 100644
--- a/src/openrct2/world/Footpath.h
+++ b/src/openrct2/world/Footpath.h
@@ -13,6 +13,8 @@
#include "../interface/Viewport.h"
#include "../object/Object.h"
+class FootpathRailingsObject;
+
enum
{
PROVISIONAL_PATH_FLAG_SHOW_ARROW = (1 << 0),
@@ -109,6 +111,7 @@ enum
{
FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR = (1 << 2),
FOOTPATH_ENTRY_FLAG_IS_QUEUE = (1 << 3),
+ FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS = (1 << 4),
};
enum
@@ -199,7 +202,7 @@ void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElem
int32_t entrance_get_directions(const TileElement* tileElement);
PathSurfaceEntry* get_path_surface_entry(PathSurfaceIndex entryIndex);
-PathRailingsEntry* get_path_railings_entry(PathRailingsIndex entryIndex);
+FootpathRailingsObject* get_path_railings_entry(PathRailingsIndex entryIndex);
void footpath_queue_chain_reset();
void footpath_queue_chain_push(ride_id_t rideIndex);
diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h
index fce4d94ae5..01d01de5bc 100644
--- a/src/openrct2/world/TileElement.h
+++ b/src/openrct2/world/TileElement.h
@@ -330,9 +330,6 @@ public:
uint8_t GetAdditionStatus() const;
void SetAdditionStatus(uint8_t newStatus);
- bool ShouldDrawPathOverSupports() const;
- void SetShouldDrawPathOverSupports(bool on);
-
bool IsLevelCrossing(const CoordsXY& coords) const;
};
assert_struct_size(PathElement, 16);