From 005aece8023f82b48492abe4c62e3d8593f8a134 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Fri, 12 Apr 2024 20:08:34 +0200 Subject: [PATCH] =?UTF-8?q?Expose=20=E2=80=9Canimation=20is=20backwards?= =?UTF-8?q?=E2=80=9D=20flag=20in=20Tile=20Inspector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/language/en-GB.txt | 1 + distribution/changelog.txt | 1 + src/openrct2-ui/windows/TileInspector.cpp | 22 +++++++++++++++++++++- src/openrct2/actions/TileModifyAction.cpp | 7 +++++++ src/openrct2/actions/TileModifyAction.h | 1 + src/openrct2/localisation/StringIds.h | 2 ++ src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/world/TileInspector.cpp | 15 +++++++++++++++ src/openrct2/world/TileInspector.h | 2 ++ 9 files changed, 51 insertions(+), 2 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index ff5d99048e..d5ce3860c6 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3697,6 +3697,7 @@ STR_6622 :Restrict object to the Scenario Editor and Sandbox mode. STR_6623 :Type ‘help’ for a list of available commands. Type ‘hide’ to hide the console. STR_6624 :Tile Inspector: Sort elements STR_6625 :Invalid colour +STR_6626 :Animation is backwards ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index a3f86b6ff6..841af623a9 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.11 (in development) ------------------------------------------------------------------------ +- Improved: [#21769] Expose “animation is backwards” wall property in Tile Inspector. - Fix: [#866] Boat Hire boats get stuck entering track. 0.4.10 (2024-04-02) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 7c3a925784..c99c94e3e8 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -159,6 +159,7 @@ namespace OpenRCT2::Ui::Windows WIDX_WALL_SPINNER_ANIMATION_FRAME, WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, + WIDX_WALL_ANIMATION_IS_BACKWARDS, // Large WIDX_LARGE_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS, @@ -359,7 +360,7 @@ static Widget EntranceWidgets[] = { kWidgetsEnd, }; -constexpr int32_t NumWallProperties = 3; +constexpr int32_t NumWallProperties = 4; constexpr int32_t NumWallDetails = 2; constexpr int32_t WallPropertiesHeight = 16 + NumWallProperties * 21; constexpr int32_t WallDetailsHeight = 20 + NumWallDetails * 11; @@ -369,6 +370,7 @@ static Widget WallWidgets[] = { MakeWidget(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::DropdownMenu, WindowColour::Secondary), // WIDX_WALL_DROPDOWN_SLOPE MakeWidget(PropertyRowCol({ 12 + PropertyButtonSize.width - 12, 0 }, 1, 1), { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), // WIDX_WALL_DROPDOWN_SLOPE_BUTTON MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 2, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_ANIMATION_FRAME{,_INCREASE,_DECREASE} + MakeWidget(PropertyRowCol({ 12, 0 }, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS), // WIDX_WALL_ANIMATION_IS_BACKWARDS kWidgetsEnd, }; @@ -706,6 +708,13 @@ static uint64_t PageDisabledWidgets[] = { case TileElementType::LargeScenery: case TileElementType::Wall: + switch (widgetIndex) + { + case WIDX_WALL_ANIMATION_IS_BACKWARDS: + WallSetAnimationIsBackwards( + windowTileInspectorSelectedIndex, !tileElement->AsWall()->AnimationIsBackwards()); + break; + } default: break; } @@ -2023,6 +2032,12 @@ static uint64_t PageDisabledWidgets[] = { GameActions::Execute(&modifyTile); } + void WallSetAnimationIsBackwards(int32_t elementIndex, bool backwards) + { + auto modifyTile = TileModifyAction(_toolMap, TileModifyType::WallSetAnimationIsBackwards, elementIndex, backwards); + GameActions::Execute(&modifyTile); + } + void OnPrepareDraw() override { const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); @@ -2333,6 +2348,8 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE].bottom = GBBB(propertiesAnchor, 2) - 4; widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].top = GBBT(propertiesAnchor, 2) + 4; widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE].bottom = GBBB(propertiesAnchor, 2) - 4; + widgets[WIDX_WALL_ANIMATION_IS_BACKWARDS].top = GBBT(propertiesAnchor, 3); + widgets[WIDX_WALL_ANIMATION_IS_BACKWARDS].bottom = GBBB(propertiesAnchor, 3); // Wall slope dropdown SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE, !canBeSloped); @@ -2343,6 +2360,9 @@ static uint64_t PageDisabledWidgets[] = { SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME, !hasAnimation); SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, !hasAnimation); SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, !hasAnimation); + + SetCheckboxValue(WIDX_WALL_ANIMATION_IS_BACKWARDS, tileElement->AsWall()->AnimationIsBackwards()); + SetWidgetDisabled(WIDX_WALL_ANIMATION_IS_BACKWARDS, !hasAnimation); break; } diff --git a/src/openrct2/actions/TileModifyAction.cpp b/src/openrct2/actions/TileModifyAction.cpp index 67fcd5677a..d579a5399a 100644 --- a/src/openrct2/actions/TileModifyAction.cpp +++ b/src/openrct2/actions/TileModifyAction.cpp @@ -229,6 +229,13 @@ GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const res = TileInspector::BannerToggleBlockingEdge(_loc, elementIndex, edgeIndex, isExecuting); break; } + case TileModifyType::WallSetAnimationIsBackwards: + { + const auto elementIndex = _value1; + const bool broken = _value2; + res = TileInspector::WallSetAnimationIsBackwards(_loc, elementIndex, broken, isExecuting); + break; + } default: LOG_ERROR("Invalid tile modification type %u", _setting); return GameActions::Result( diff --git a/src/openrct2/actions/TileModifyAction.h b/src/openrct2/actions/TileModifyAction.h index d8a74dab85..008073a094 100644 --- a/src/openrct2/actions/TileModifyAction.h +++ b/src/openrct2/actions/TileModifyAction.h @@ -38,6 +38,7 @@ enum class TileModifyType : uint8_t ScenerySetQuarterLocation, ScenerySetQuarterCollision, BannerToggleBlockingEdge, + WallSetAnimationIsBackwards, Count, }; diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 3afad4e011..c078ae0144 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -4043,6 +4043,8 @@ enum : uint16_t STR_ERR_INVALID_COLOUR = 6625, + STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS = 6626, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings }; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 1e32583e17..f7bd6ee87a 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -46,7 +46,7 @@ using namespace OpenRCT2; // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 2de34811c4..307e540116 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -940,6 +940,21 @@ namespace OpenRCT2::TileInspector return GameActions::Result(); } + GameActions::Result WallSetAnimationIsBackwards(const CoordsXY& loc, int32_t elementIndex, bool backwards, bool isExecuting) + { + TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex); + if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) + return GameActions::Result( + GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_WALL_ELEMENT_NOT_FOUND); + + if (isExecuting) + { + wallElement->AsWall()->SetAnimationIsBackwards(backwards); + } + + return GameActions::Result(); + } + TileElement* GetSelectedElement() { if (windowTileInspectorSelectedIndex == -1) diff --git a/src/openrct2/world/TileInspector.h b/src/openrct2/world/TileInspector.h index bc7e23267d..3ba6ba3463 100644 --- a/src/openrct2/world/TileInspector.h +++ b/src/openrct2/world/TileInspector.h @@ -53,5 +53,7 @@ namespace OpenRCT2::TileInspector const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting); GameActions::Result BannerToggleBlockingEdge( const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting); + GameActions::Result WallSetAnimationIsBackwards( + const CoordsXY& loc, int32_t elementIndex, bool backwards, bool isExecuting); } // namespace OpenRCT2::TileInspector