Expose “animation is backwards” flag in Tile Inspector

This commit is contained in:
Michael Steenbeek 2024-04-12 20:08:34 +02:00 committed by GitHub
parent f9bd26214b
commit 005aece802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 51 additions and 2 deletions

View File

@ -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 #

View File

@ -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)

View File

@ -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;
}

View File

@ -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(

View File

@ -38,6 +38,7 @@ enum class TileModifyType : uint8_t
ScenerySetQuarterLocation,
ScenerySetQuarterCollision,
BannerToggleBlockingEdge,
WallSetAnimationIsBackwards,
Count,
};

View File

@ -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
};

View File

@ -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

View File

@ -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)

View File

@ -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