From 24581e781f815a2639561d737c5ccaa76727ec4b Mon Sep 17 00:00:00 2001 From: Duncan Date: Fri, 27 Jan 2023 19:44:58 +0000 Subject: [PATCH] Move misc ObjectEntries into Object folder (#19281) * Move water entry * Move FootpathEntry * Move EntranceEntry * Move SceneryGroupEntry --- src/openrct2-ui/interface/Dropdown.h | 1 + src/openrct2-ui/windows/Scenery.cpp | 1 + src/openrct2/EditorObjectSelectionSession.cpp | 1 + src/openrct2/Game.cpp | 2 +- src/openrct2/drawing/Drawing.cpp | 2 +- src/openrct2/entity/Staff.cpp | 1 + src/openrct2/interface/Widget.h | 1 + src/openrct2/interface/Window.h | 1 + src/openrct2/libopenrct2.vcxproj | 5 +- src/openrct2/management/Research.cpp | 1 + src/openrct2/object/EntranceEntry.h | 21 +++++++ src/openrct2/object/EntranceObject.h | 1 + src/openrct2/object/FootpathEntry.h | 55 +++++++++++++++++++ src/openrct2/object/FootpathObject.h | 1 + src/openrct2/object/FootpathSurfaceObject.cpp | 3 +- src/openrct2/object/SceneryGroupEntry.h | 25 +++++++++ src/openrct2/object/SceneryGroupObject.cpp | 1 + src/openrct2/object/SceneryGroupObject.h | 2 +- .../{world/Water.h => object/WaterEntry.h} | 3 - src/openrct2/object/WaterObject.h | 2 +- src/openrct2/scenario/Scenario.cpp | 2 +- src/openrct2/world/Entrance.h | 11 ---- src/openrct2/world/Footpath.h | 48 ---------------- src/openrct2/world/Scenery.cpp | 1 + src/openrct2/world/Scenery.h | 10 +--- src/openrct2/world/ScenerySelection.h | 2 +- 26 files changed, 125 insertions(+), 79 deletions(-) create mode 100644 src/openrct2/object/EntranceEntry.h create mode 100644 src/openrct2/object/FootpathEntry.h create mode 100644 src/openrct2/object/SceneryGroupEntry.h rename src/openrct2/{world/Water.h => object/WaterEntry.h} (89%) diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h index 049e32cd67..174462d250 100644 --- a/src/openrct2-ui/interface/Dropdown.h +++ b/src/openrct2-ui/interface/Dropdown.h @@ -13,6 +13,7 @@ #include #include #include +#include namespace Dropdown { diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index fc35f6c0a5..529f9fe4c6 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 96dde98ae8..86402667f3 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -18,6 +18,7 @@ #include "localisation/Localisation.h" #include "management/Research.h" #include "object/DefaultObjects.h" +#include "object/FootpathEntry.h" #include "object/ObjectList.h" #include "object/ObjectManager.h" #include "object/ObjectRepository.h" diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index da2d18f184..1185f7c4dc 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -41,6 +41,7 @@ #include "network/network.h" #include "object/Object.h" #include "object/ObjectList.h" +#include "object/WaterEntry.h" #include "platform/Platform.h" #include "ride/Ride.h" #include "ride/RideRatings.h" @@ -65,7 +66,6 @@ #include "world/Park.h" #include "world/Scenery.h" #include "world/Surface.h" -#include "world/Water.h" #include #include diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 20b1061a21..b2324df5cc 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -16,12 +16,12 @@ #include "../config/Config.h" #include "../core/Guard.hpp" #include "../object/Object.h" +#include "../object/WaterEntry.h" #include "../platform/Platform.h" #include "../sprites.h" #include "../util/Util.h" #include "../world/Climate.h" #include "../world/Location.hpp" -#include "../world/Water.h" #include "LightFX.h" #include diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 5c1c700a69..d731666e2f 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -26,6 +26,7 @@ #include "../object/FootpathItemEntry.h" #include "../object/ObjectList.h" #include "../object/ObjectManager.h" +#include "../object/SceneryGroupEntry.h" #include "../object/SmallSceneryEntry.h" #include "../object/TerrainSurfaceObject.h" #include "../paint/tile_element/Paint.TileElement.h" diff --git a/src/openrct2/interface/Widget.h b/src/openrct2/interface/Widget.h index f6b0544701..f76149527c 100644 --- a/src/openrct2/interface/Widget.h +++ b/src/openrct2/interface/Widget.h @@ -9,6 +9,7 @@ #pragma once +#include "../drawing/Drawing.h" #include "../localisation/StringIds.h" #include "Window.h" diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index a5849f50f8..824df28ad0 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -11,6 +11,7 @@ #include "../Identifiers.h" #include "../common.h" +#include "../drawing/ImageId.hpp" #include "../localisation/Formatter.h" #include "../ride/RideTypes.h" #include "../world/Location.hpp" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 2d363255a1..195d904168 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -297,7 +297,9 @@ + + @@ -317,6 +319,7 @@ + @@ -327,6 +330,7 @@ + @@ -563,7 +567,6 @@ - diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 568bc1e42f..24e8c9a9d0 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -23,6 +23,7 @@ #include "../localisation/StringIds.h" #include "../object/ObjectList.h" #include "../object/RideObject.h" +#include "../object/SceneryGroupEntry.h" #include "../profiling/Profiling.h" #include "../ride/Ride.h" #include "../ride/RideData.h" diff --git a/src/openrct2/object/EntranceEntry.h b/src/openrct2/object/EntranceEntry.h new file mode 100644 index 0000000000..5136d6ce48 --- /dev/null +++ b/src/openrct2/object/EntranceEntry.h @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2014-2023 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 "../common.h" +#include "ObjectTypes.h" + +struct EntranceEntry +{ + StringId string_idx; // 0x00 + uint32_t image_id; // 0x02 + uint8_t scrolling_mode; // 0x06 + uint8_t text_height; // 0x07 +}; diff --git a/src/openrct2/object/EntranceObject.h b/src/openrct2/object/EntranceObject.h index f4782b1502..3a0dbdf6a0 100644 --- a/src/openrct2/object/EntranceObject.h +++ b/src/openrct2/object/EntranceObject.h @@ -11,6 +11,7 @@ #include "../world/Entrance.h" #include "../world/Location.hpp" +#include "EntranceEntry.h" #include "Object.h" class EntranceObject final : public Object diff --git a/src/openrct2/object/FootpathEntry.h b/src/openrct2/object/FootpathEntry.h new file mode 100644 index 0000000000..ff630a9f15 --- /dev/null +++ b/src/openrct2/object/FootpathEntry.h @@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright (c) 2014-2023 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 "../common.h" +#include "ObjectTypes.h" + +enum class RailingEntrySupportType : uint8_t; + +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), +}; + +struct FootpathEntry +{ + StringId string_idx; // 0x00 + uint32_t image; // 0x02 + uint32_t bridge_image; // 0x06 + RailingEntrySupportType support_type; // 0x0A + uint8_t flags; // 0x0B + uint8_t scrolling_mode; // 0x0C + + constexpr uint32_t GetQueueImage() const + { + return image + 51; + } + constexpr uint32_t GetPreviewImage() const + { + return image + 71; + } + constexpr uint32_t GetQueuePreviewImage() const + { + // Editor-only paths usually lack queue images. In this case, use the main path image. + if (flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) + { + return GetPreviewImage(); + } + + return image + 72; + } + constexpr uint32_t GetRailingsImage() const + { + return image + 73; + } +}; diff --git a/src/openrct2/object/FootpathObject.h b/src/openrct2/object/FootpathObject.h index 4ba4fbd3bf..c2ac12252b 100644 --- a/src/openrct2/object/FootpathObject.h +++ b/src/openrct2/object/FootpathObject.h @@ -10,6 +10,7 @@ #pragma once #include "../world/Footpath.h" +#include "FootpathEntry.h" #include "Object.h" class FootpathObject final : public Object diff --git a/src/openrct2/object/FootpathSurfaceObject.cpp b/src/openrct2/object/FootpathSurfaceObject.cpp index d59fcb3f43..2caf1a95be 100644 --- a/src/openrct2/object/FootpathSurfaceObject.cpp +++ b/src/openrct2/object/FootpathSurfaceObject.cpp @@ -12,7 +12,8 @@ #include "../core/IStream.hpp" #include "../core/Json.hpp" #include "../drawing/Image.h" -#include "../object/ObjectRepository.h" +#include "FootpathEntry.h" +#include "ObjectRepository.h" void FootpathSurfaceObject::Load() { diff --git a/src/openrct2/object/SceneryGroupEntry.h b/src/openrct2/object/SceneryGroupEntry.h new file mode 100644 index 0000000000..ebbec326b6 --- /dev/null +++ b/src/openrct2/object/SceneryGroupEntry.h @@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2014-2023 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 "../common.h" +#include "../world/ScenerySelection.h" +#include "ObjectTypes.h" + +#include + +struct SceneryGroupEntry +{ + StringId name; + uint32_t image; + std::vector SceneryEntries; + uint8_t priority; + uint32_t entertainer_costumes; +}; diff --git a/src/openrct2/object/SceneryGroupObject.cpp b/src/openrct2/object/SceneryGroupObject.cpp index 2999438404..f19c876a29 100644 --- a/src/openrct2/object/SceneryGroupObject.cpp +++ b/src/openrct2/object/SceneryGroupObject.cpp @@ -20,6 +20,7 @@ #include "../drawing/Image.h" #include "../entity/Staff.h" #include "../localisation/Language.h" +#include "../world/Scenery.h" #include "ObjectLimits.h" #include "ObjectManager.h" #include "ObjectRepository.h" diff --git a/src/openrct2/object/SceneryGroupObject.h b/src/openrct2/object/SceneryGroupObject.h index 69749cf701..ca385ee3ce 100644 --- a/src/openrct2/object/SceneryGroupObject.h +++ b/src/openrct2/object/SceneryGroupObject.h @@ -9,8 +9,8 @@ #pragma once -#include "../world/Scenery.h" #include "Object.h" +#include "SceneryGroupEntry.h" #include diff --git a/src/openrct2/world/Water.h b/src/openrct2/object/WaterEntry.h similarity index 89% rename from src/openrct2/world/Water.h rename to src/openrct2/object/WaterEntry.h index a07cc01107..dbb85d0099 100644 --- a/src/openrct2/world/Water.h +++ b/src/openrct2/object/WaterEntry.h @@ -16,7 +16,6 @@ enum WATER_FLAGS_ALLOW_DUCKS = (1 << 0) }; -#pragma pack(push, 1) struct WaterObjectEntry { StringId string_idx; // 0x00 @@ -25,5 +24,3 @@ struct WaterObjectEntry uint32_t palette_index_2; // 0x0A uint16_t flags; // 0x0E }; -assert_struct_size(WaterObjectEntry, 16); -#pragma pack(pop) diff --git a/src/openrct2/object/WaterObject.h b/src/openrct2/object/WaterObject.h index 2d36c5803b..6a9cee3cbe 100644 --- a/src/openrct2/object/WaterObject.h +++ b/src/openrct2/object/WaterObject.h @@ -9,8 +9,8 @@ #pragma once -#include "../world/Water.h" #include "Object.h" +#include "WaterEntry.h" #include diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 62009281a2..d5d703311c 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -38,6 +38,7 @@ #include "../object/Object.h" #include "../object/ObjectList.h" #include "../object/ObjectManager.h" +#include "../object/WaterEntry.h" #include "../platform/Platform.h" #include "../profiling/Profiling.h" #include "../rct1/RCT1.h" @@ -52,7 +53,6 @@ #include "../world/Map.h" #include "../world/Park.h" #include "../world/Scenery.h" -#include "../world/Water.h" #include "ScenarioRepository.h" #include "ScenarioSources.h" diff --git a/src/openrct2/world/Entrance.h b/src/openrct2/world/Entrance.h index da72cf7801..1c09d4fde0 100644 --- a/src/openrct2/world/Entrance.h +++ b/src/openrct2/world/Entrance.h @@ -16,17 +16,6 @@ #include -#pragma pack(push, 1) -struct EntranceEntry -{ - StringId string_idx; // 0x00 - uint32_t image_id; // 0x02 - uint8_t scrolling_mode; // 0x06 - uint8_t text_height; // 0x07 -}; -assert_struct_size(EntranceEntry, 8); -#pragma pack(pop) - struct TileElement; enum diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index ebec1419e7..6d26872a34 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -37,60 +37,12 @@ enum class RailingEntrySupportType : uint8_t Count }; -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), -}; - -#pragma pack(push, 1) -struct FootpathEntry -{ - StringId string_idx; // 0x00 - uint32_t image; // 0x02 - uint32_t bridge_image; // 0x06 - RailingEntrySupportType support_type; // 0x0A - uint8_t flags; // 0x0B - uint8_t scrolling_mode; // 0x0C - - constexpr uint32_t GetQueueImage() const - { - return image + 51; - } - constexpr uint32_t GetPreviewImage() const - { - return image + 71; - } - constexpr uint32_t GetQueuePreviewImage() const - { - // Editor-only paths usually lack queue images. In this case, use the main path image. - if (flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) - { - return GetPreviewImage(); - } - - return image + 72; - } - constexpr uint32_t GetRailingsImage() const - { - return image + 73; - } -}; -assert_struct_size(FootpathEntry, 13); -#pragma pack(pop) - struct PathSurfaceDescriptor { StringId Name; uint32_t Image; uint32_t PreviewImage; uint8_t Flags; - - inline constexpr bool IsEditorOnly() const - { - return Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR; - } }; struct PathRailingsDescriptor diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 60306f820d..6c6712ca8c 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -27,6 +27,7 @@ #include "../object/LargeSceneryEntry.h" #include "../object/ObjectList.h" #include "../object/ObjectManager.h" +#include "../object/SceneryGroupEntry.h" #include "../object/SmallSceneryEntry.h" #include "../object/WallSceneryEntry.h" #include "../scenario/Scenario.h" diff --git a/src/openrct2/world/Scenery.h b/src/openrct2/world/Scenery.h index c2693ec362..28dde2985d 100644 --- a/src/openrct2/world/Scenery.h +++ b/src/openrct2/world/Scenery.h @@ -19,15 +19,6 @@ #define SCENERY_WITHER_AGE_THRESHOLD_1 0x28 #define SCENERY_WITHER_AGE_THRESHOLD_2 0x37 -struct SceneryGroupEntry -{ - StringId name; - uint32_t image; - std::vector SceneryEntries; - uint8_t priority; - uint32_t entertainer_costumes; -}; - enum { SCENERY_TYPE_SMALL, @@ -85,6 +76,7 @@ void ScenerySetDefaultPlacementConfiguration(); void SceneryRemoveGhostToolPlacement(); struct WallSceneryEntry; +struct SceneryGroupEntry; WallSceneryEntry* GetWallEntry(ObjectEntryIndex entryIndex); BannerSceneryEntry* GetBannerEntry(ObjectEntryIndex entryIndex); diff --git a/src/openrct2/world/ScenerySelection.h b/src/openrct2/world/ScenerySelection.h index 030c76663f..f8f0c12508 100644 --- a/src/openrct2/world/ScenerySelection.h +++ b/src/openrct2/world/ScenerySelection.h @@ -9,7 +9,7 @@ #pragma once -#include "../object/Object.h" +#include "../object/ObjectTypes.h" #include #include