diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 10a1dad985..d91f354187 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -45,6 +45,7 @@ #include #include #include +#include using namespace OpenRCT2; using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 7bab99d682..34be65ac1f 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -52,8 +52,8 @@ #include #include #include -#include #include +#include using namespace OpenRCT2; using namespace OpenRCT2::Ui::Windows; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 7af4b72184..4b0ac2cb4a 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -50,6 +50,7 @@ #include #include #include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 15358aba33..9deff0ae4d 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index dba404683d..6e0585eaf2 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -43,6 +43,7 @@ #include #include #include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 82b170f2e5..7990116f8b 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 814f10e95c..79b41c0ebd 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -31,6 +31,7 @@ #include "world/Footpath.h" #include "world/Scenery.h" #include "world/tile_element/EntranceElement.h" +#include "world/tile_element/WallElement.h" #include #include diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index c3ba64ac4c..9c75c5f2bf 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -23,7 +23,6 @@ #include "../world/Location.hpp" #include "../world/Park.h" #include "../world/Scenery.h" -#include "../world/Wall.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index 1d6d3bba05..d592ab7ba2 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -20,7 +20,6 @@ #include "../world/Footpath.h" #include "../world/Location.hpp" #include "../world/Park.h" -#include "../world/Wall.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 982c5cc262..b99740aa17 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -23,7 +23,6 @@ #include "../world/Park.h" #include "../world/QuarterTile.h" #include "../world/Surface.h" -#include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index 14a19f47cf..70eb1d1418 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -29,7 +29,6 @@ #include "../world/Scenery.h" #include "../world/Surface.h" #include "../world/TileElementsView.h" -#include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index 44b35a5ad9..21b5b5ec9d 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -19,7 +19,6 @@ #include "../world/Footpath.h" #include "../world/Location.hpp" #include "../world/Park.h" -#include "../world/Wall.h" #include "BannerRemoveAction.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/SignSetStyleAction.cpp b/src/openrct2/actions/SignSetStyleAction.cpp index a6b4c1c829..df5cbf31d1 100644 --- a/src/openrct2/actions/SignSetStyleAction.cpp +++ b/src/openrct2/actions/SignSetStyleAction.cpp @@ -18,6 +18,7 @@ #include "../windows/Intent.h" #include "../world/Banner.h" #include "../world/Scenery.h" +#include "../world/tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index b930aa0ac3..8f40159e08 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -25,6 +25,7 @@ #include "../world/Surface.h" #include "../world/Wall.h" #include "../world/tile_element/Slope.h" +#include "../world/tile_element/WallElement.h" using namespace OpenRCT2; using namespace OpenRCT2::TrackMetaData; diff --git a/src/openrct2/actions/WallRemoveAction.cpp b/src/openrct2/actions/WallRemoveAction.cpp index 41a01ea093..f524c96370 100644 --- a/src/openrct2/actions/WallRemoveAction.cpp +++ b/src/openrct2/actions/WallRemoveAction.cpp @@ -18,7 +18,7 @@ #include "../management/Finance.h" #include "../world/Location.hpp" #include "../world/TileElementsView.h" -#include "../world/Wall.h" +#include "../world/tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index 9c0a12579b..e027958d42 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -20,6 +20,7 @@ #include "../world/MapAnimation.h" #include "../world/Scenery.h" #include "../world/Surface.h" +#include "../world/tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index c09f0e2e01..35cd3e777f 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -61,6 +61,7 @@ #include "../world/Surface.h" #include "../world/TileElementsView.h" #include "../world/tile_element/EntranceElement.h" +#include "../world/tile_element/WallElement.h" #include "Peep.h" #include "Staff.h" diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 8e4d4a8a37..5baa7d259f 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -38,6 +38,7 @@ #include "../util/Math.hpp" #include "../world/Climate.h" #include "../world/Map.h" +#include "../world/tile_element/WallElement.h" #include "Colour.h" #include "Window.h" #include "Window_internal.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 1765cdb9ed..2d729f224a 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -624,6 +624,7 @@ + @@ -1105,6 +1106,7 @@ + NotUsing @@ -1114,4 +1116,4 @@ - + \ No newline at end of file diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index 5f091e477a..d2cfbb1454 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -25,7 +25,7 @@ #include "../../world/Map.h" #include "../../world/Scenery.h" #include "../../world/TileInspector.h" -#include "../../world/Wall.h" +#include "../../world/tile_element/WallElement.h" #include "Paint.TileElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index e84ee3ddba..b5eaec8471 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -73,6 +73,7 @@ #include "../world/TilePointerIndex.hpp" #include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" +#include "../world/tile_element/WallElement.h" #include "RCT1.h" #include "Tables.h" diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index 7cbcffd2c1..cc6ffc2a0f 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -27,6 +27,7 @@ #include "../world/TileElement.h" #include "../world/Wall.h" #include "../world/tile_element/Slope.h" +#include "../world/tile_element/WallElement.h" #include "EntryList.h" using namespace OpenRCT2; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 0a5dd0203e..06476b20db 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -78,6 +78,7 @@ #include "../world/Surface.h" #include "../world/TilePointerIndex.hpp" #include "../world/tile_element/EntranceElement.h" +#include "../world/tile_element/WallElement.h" #include diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 376cef2df9..6dda14b77e 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -57,7 +57,6 @@ #include "../world/Park.h" #include "../world/Scenery.h" #include "../world/Surface.h" -#include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" #include "Ride.h" diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 5714b72797..2ba0111554 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -25,8 +25,8 @@ #include "../windows/Intent.h" #include "../world/Footpath.h" #include "../world/Scenery.h" -#include "../world/Wall.h" #include "../world/tile_element/EntranceElement.h" +#include "../world/tile_element/WallElement.h" #include "RideData.h" #include "Station.h" #include "Track.h" diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 51701479d5..7c30157c8d 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -47,7 +47,7 @@ #include "../world/Park.h" #include "../world/Scenery.h" #include "../world/Surface.h" -#include "../world/Wall.h" +#include "../world/tile_element/WallElement.h" #include "CableLift.h" #include "Ride.h" #include "RideData.h" diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.cpp b/src/openrct2/scripting/bindings/world/ScTileElement.cpp index 6f545616e0..0ee51b394a 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.cpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.cpp @@ -23,6 +23,7 @@ # include "../../../world/Scenery.h" # include "../../../world/Surface.h" # include "../../../world/tile_element/EntranceElement.h" +# include "../../../world/tile_element/WallElement.h" # include "../../Duktape.hpp" # include "../../ScriptEngine.h" diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 94dd98b6c3..dc1e6dec07 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -27,11 +27,12 @@ #include "../ride/RideData.h" #include "../ride/Track.h" #include "../windows/Intent.h" -#include "../world/TileElementsView.h" #include "Map.h" #include "MapAnimation.h" #include "Park.h" #include "Scenery.h" +#include "TileElementsView.h" +#include "tile_element/WallElement.h" #include #include diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index 7335bda579..428deec5cf 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -24,6 +24,7 @@ #include "Surface.h" #include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" +#include "tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 960de4270c..3730807b1a 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -57,7 +57,6 @@ #include "Surface.h" #include "TileElementsView.h" #include "TileInspector.h" -#include "Wall.h" #include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 7b755bbfa4..46ff7bdae4 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -24,12 +24,12 @@ #include "../ride/Ride.h" #include "../ride/RideData.h" #include "../ride/Track.h" -#include "../world/Wall.h" #include "Banner.h" #include "Footpath.h" #include "Map.h" #include "Scenery.h" #include "tile_element/EntranceElement.h" +#include "tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 5d7ba79544..c2c5a424b6 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -36,7 +36,6 @@ #include "Footpath.h" #include "Map.h" #include "Park.h" -#include "Wall.h" uint8_t gSceneryQuadrant; diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index bc298b743b..c98f5b35ed 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -20,6 +20,7 @@ #include "Scenery.h" #include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" +#include "tile_element/WallElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index da3545cb0c..e7487ef2b1 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -456,51 +456,6 @@ public: }; static_assert(sizeof(LargeSceneryElement) == 16); -struct WallElement : TileElementBase -{ - static constexpr TileElementType ElementType = TileElementType::Wall; - -private: - ObjectEntryIndex entryIndex; // 05 - colour_t colour_1; // 07 - colour_t colour_2; // 08 - colour_t colour_3; // 09 - BannerIndex banner_index; // 0A - uint8_t animation; // 0C 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-private-field" - uint8_t Pad0D[3]; -#pragma clang diagnostic pop - -public: - uint16_t GetEntryIndex() const; - void SetEntryIndex(uint16_t newIndex); - const WallSceneryEntry* GetEntry() const; - - uint8_t GetSlope() const; - void SetSlope(uint8_t newslope); - - colour_t GetPrimaryColour() const; - void SetPrimaryColour(colour_t newColour); - colour_t GetSecondaryColour() const; - void SetSecondaryColour(colour_t newColour); - colour_t GetTertiaryColour() const; - void SetTertiaryColour(colour_t newColour); - - uint8_t GetAnimationFrame() const; - void SetAnimationFrame(uint8_t frameNum); - - Banner* GetBanner() const; - BannerIndex GetBannerIndex() const; - void SetBannerIndex(BannerIndex newIndex); - - bool IsAcrossTrack() const; - void SetAcrossTrack(bool acrossTrack); - bool AnimationIsBackwards() const; - void SetAnimationIsBackwards(bool isBackwards); -}; -static_assert(sizeof(WallElement) == 16); - struct BannerElement : TileElementBase { static constexpr TileElementType ElementType = TileElementType::Banner; diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 30223f62e1..cf7445d784 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -17,16 +17,17 @@ #include "../ride/Track.h" #include "../ride/TrackData.h" #include "../windows/TileInspectorGlobals.h" -#include "../world/MapAnimation.h" #include "Banner.h" #include "Footpath.h" #include "Location.hpp" #include "Map.h" +#include "MapAnimation.h" #include "Park.h" #include "Scenery.h" #include "Surface.h" #include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" +#include "tile_element/WallElement.h" #include diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index f8b9871ce0..22e34cbcfe 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -9,23 +9,8 @@ #include "Wall.h" -#include "../Cheats.h" -#include "../Game.h" -#include "../OpenRCT2.h" -#include "../localisation/StringIds.h" -#include "../management/Finance.h" -#include "../network/network.h" -#include "../object/ObjectEntryManager.h" -#include "../object/WallSceneryEntry.h" -#include "../ride/Track.h" -#include "../ride/TrackData.h" -#include "Banner.h" #include "Map.h" -#include "MapAnimation.h" -#include "Park.h" -#include "Scenery.h" -#include "Surface.h" -#include "Wall.h" +#include "tile_element/WallElement.h" /** * @@ -79,112 +64,6 @@ void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direc } while (!(tileElement++)->IsLastForTile()); } -uint8_t WallElement::GetSlope() const -{ - return (Type & kTileElementQuadrantMask) >> 6; -} - -void WallElement::SetSlope(uint8_t newSlope) -{ - Type &= ~kTileElementQuadrantMask; - Type |= (newSlope << 6); -} - -colour_t WallElement::GetPrimaryColour() const -{ - return colour_1; -} - -colour_t WallElement::GetSecondaryColour() const -{ - return colour_2; -} - -colour_t WallElement::GetTertiaryColour() const -{ - return colour_3; -} - -void WallElement::SetPrimaryColour(colour_t newColour) -{ - colour_1 = newColour; -} - -void WallElement::SetSecondaryColour(colour_t newColour) -{ - colour_2 = newColour; -} - -void WallElement::SetTertiaryColour(colour_t newColour) -{ - colour_3 = newColour; -} - -uint8_t WallElement::GetAnimationFrame() const -{ - return (animation >> 3) & 0xF; -} - -void WallElement::SetAnimationFrame(uint8_t frameNum) -{ - animation &= WALL_ANIMATION_FLAG_ALL_FLAGS; - animation |= (frameNum & 0xF) << 3; -} - -uint16_t WallElement::GetEntryIndex() const -{ - return entryIndex; -} - -const WallSceneryEntry* WallElement::GetEntry() const -{ - return OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); -} - -void WallElement::SetEntryIndex(uint16_t newIndex) -{ - entryIndex = newIndex; -} - -Banner* WallElement::GetBanner() const -{ - return ::GetBanner(GetBannerIndex()); -} - -BannerIndex WallElement::GetBannerIndex() const -{ - return banner_index; -} - -void WallElement::SetBannerIndex(BannerIndex newIndex) -{ - banner_index = newIndex; -} - -bool WallElement::IsAcrossTrack() const -{ - return (animation & WALL_ANIMATION_FLAG_ACROSS_TRACK) != 0; -} - -void WallElement::SetAcrossTrack(bool acrossTrack) -{ - animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK; - if (acrossTrack) - animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK; -} - -bool WallElement::AnimationIsBackwards() const -{ - return (animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) != 0; -} - -void WallElement::SetAnimationIsBackwards(bool isBackwards) -{ - animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD; - if (isBackwards) - animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD; -} - #pragma region Edge Slopes Table // clang-format off diff --git a/src/openrct2/world/Wall.h b/src/openrct2/world/Wall.h index 354c5bafc2..43e39b5e69 100644 --- a/src/openrct2/world/Wall.h +++ b/src/openrct2/world/Wall.h @@ -11,14 +11,6 @@ #include "TileElement.h" -enum -{ - WALL_ANIMATION_FLAG_ACROSS_TRACK = (1 << 2), - // 3 - 6 animation frame number - WALL_ANIMATION_FLAG_DIRECTION_BACKWARD = (1 << 7), - WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD -}; - enum EDGE_SLOPE { EDGE_SLOPE_UPWARDS = (1 << 0), diff --git a/src/openrct2/world/tile_element/TileElementBase.cpp b/src/openrct2/world/tile_element/TileElementBase.cpp index 3541e6c02e..a8af4cacd5 100644 --- a/src/openrct2/world/tile_element/TileElementBase.cpp +++ b/src/openrct2/world/tile_element/TileElementBase.cpp @@ -10,6 +10,7 @@ #include "../Map.h" #include "../TileElement.h" #include "EntranceElement.h" +#include "WallElement.h" TileElementType TileElementBase::GetType() const { diff --git a/src/openrct2/world/tile_element/WallElement.cpp b/src/openrct2/world/tile_element/WallElement.cpp new file mode 100644 index 0000000000..0f34685ac6 --- /dev/null +++ b/src/openrct2/world/tile_element/WallElement.cpp @@ -0,0 +1,118 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 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 "WallElement.h" + +#include "../../object/ObjectEntryManager.h" +#include "../../object/WallSceneryEntry.h" + +uint8_t WallElement::GetSlope() const +{ + return (Type & kTileElementQuadrantMask) >> 6; +} + +void WallElement::SetSlope(uint8_t newSlope) +{ + Type &= ~kTileElementQuadrantMask; + Type |= (newSlope << 6); +} + +colour_t WallElement::GetPrimaryColour() const +{ + return colour_1; +} + +colour_t WallElement::GetSecondaryColour() const +{ + return colour_2; +} + +colour_t WallElement::GetTertiaryColour() const +{ + return colour_3; +} + +void WallElement::SetPrimaryColour(colour_t newColour) +{ + colour_1 = newColour; +} + +void WallElement::SetSecondaryColour(colour_t newColour) +{ + colour_2 = newColour; +} + +void WallElement::SetTertiaryColour(colour_t newColour) +{ + colour_3 = newColour; +} + +uint8_t WallElement::GetAnimationFrame() const +{ + return (animation >> 3) & 0xF; +} + +void WallElement::SetAnimationFrame(uint8_t frameNum) +{ + animation &= WALL_ANIMATION_FLAG_ALL_FLAGS; + animation |= (frameNum & 0xF) << 3; +} + +uint16_t WallElement::GetEntryIndex() const +{ + return entryIndex; +} + +const WallSceneryEntry* WallElement::GetEntry() const +{ + return OpenRCT2::ObjectManager::GetObjectEntry(entryIndex); +} + +void WallElement::SetEntryIndex(uint16_t newIndex) +{ + entryIndex = newIndex; +} + +Banner* WallElement::GetBanner() const +{ + return ::GetBanner(GetBannerIndex()); +} + +BannerIndex WallElement::GetBannerIndex() const +{ + return banner_index; +} + +void WallElement::SetBannerIndex(BannerIndex newIndex) +{ + banner_index = newIndex; +} + +bool WallElement::IsAcrossTrack() const +{ + return (animation & WALL_ANIMATION_FLAG_ACROSS_TRACK) != 0; +} + +void WallElement::SetAcrossTrack(bool acrossTrack) +{ + animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK; + if (acrossTrack) + animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK; +} + +bool WallElement::AnimationIsBackwards() const +{ + return (animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) != 0; +} + +void WallElement::SetAnimationIsBackwards(bool isBackwards) +{ + animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD; + if (isBackwards) + animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD; +} diff --git a/src/openrct2/world/tile_element/WallElement.h b/src/openrct2/world/tile_element/WallElement.h new file mode 100644 index 0000000000..bb179b4425 --- /dev/null +++ b/src/openrct2/world/tile_element/WallElement.h @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 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 "../../Identifiers.h" +#include "../TileElement.h" + +#include + +enum +{ + WALL_ANIMATION_FLAG_ACROSS_TRACK = (1 << 2), + // 3 - 6 animation frame number + WALL_ANIMATION_FLAG_DIRECTION_BACKWARD = (1 << 7), + WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD +}; + +#pragma pack(push, 1) +struct WallElement : TileElementBase +{ + static constexpr TileElementType ElementType = TileElementType::Wall; + +private: + ObjectEntryIndex entryIndex; // 05 + colour_t colour_1; // 07 + colour_t colour_2; // 08 + colour_t colour_3; // 09 + BannerIndex banner_index; // 0A + uint8_t animation; // 0C 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-private-field" + uint8_t Pad0D[3]; +#pragma clang diagnostic pop + +public: + uint16_t GetEntryIndex() const; + void SetEntryIndex(uint16_t newIndex); + const WallSceneryEntry* GetEntry() const; + + uint8_t GetSlope() const; + void SetSlope(uint8_t newslope); + + colour_t GetPrimaryColour() const; + void SetPrimaryColour(colour_t newColour); + colour_t GetSecondaryColour() const; + void SetSecondaryColour(colour_t newColour); + colour_t GetTertiaryColour() const; + void SetTertiaryColour(colour_t newColour); + + uint8_t GetAnimationFrame() const; + void SetAnimationFrame(uint8_t frameNum); + + Banner* GetBanner() const; + BannerIndex GetBannerIndex() const; + void SetBannerIndex(BannerIndex newIndex); + + bool IsAcrossTrack() const; + void SetAcrossTrack(bool acrossTrack); + bool AnimationIsBackwards() const; + void SetAnimationIsBackwards(bool isBackwards); +}; +static_assert(sizeof(WallElement) == kTileElementSize); + +#pragma pack(pop) diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index 0229ffb4b2..edc026eeb6 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace OpenRCT2;