diff --git a/contributors.md b/contributors.md index b41c9c0d06..ff319d73c0 100644 --- a/contributors.md +++ b/contributors.md @@ -109,6 +109,7 @@ The following people are not part of the development team, but have been contrib * Nikolas Parshook (nparshook) - Misc. * Wenzhao Qiu (qwzhaox) - Misc. * Tiago Reul (reul) - Misc. +* Fredrik Tegnell (fredriktegnell) - Misc. ## Bug fixes * (KirilAngelov) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index d455b561c9..852197ac50 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3696,6 +3696,7 @@ STR_6590 :Show the window buttons (e.g. to close the window) on the left of t STR_6591 :Staff member is currently fixing a ride and can’t be fired. STR_6592 :Staff member is currently inspecting a ride and can’t be fired. STR_6593 :Remove park fences +STR_6594 :Tile Inspector: Toggle wall slope ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 70162c0040..b39a8ea993 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.7 (in development) ------------------------------------------------------------------------ +- Feature: [#12078] Add shortcut key for toggling wall slope. - Feature: [#19919] Add diagonal brakes and diagonal block brakes to most coaster types. - Feature: [#20141] Add additional track pieces to the Giga Coaster. - Feature: [OpenMusic#46] Added Mystic ride music style. diff --git a/src/openrct2-ui/input/ShortcutIds.h b/src/openrct2-ui/input/ShortcutIds.h index 6af3142b60..8b7e7580c3 100644 --- a/src/openrct2-ui/input/ShortcutIds.h +++ b/src/openrct2-ui/input/ShortcutIds.h @@ -117,6 +117,7 @@ namespace OpenRCT2::Ui::ShortcutId constexpr std::string_view WindowTileInspectorDecreaseY = "window.tileinspector.decrease_y"; constexpr std::string_view WindowTileInspectorIncreaseHeight = "window.tileinspector.increase_height"; constexpr std::string_view WindowTileInspectorDecreaseHeight = "window.tileinspector.decrease_height"; + constexpr std::string_view WindowTileInspectorChangeWallSlope = "window.tileinspector.toggle_wall_slope"; // Debug constexpr std::string_view DebugToggleConsole = "debug.console"; diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index c6dbe52856..e06f94bf1c 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include using namespace OpenRCT2; using namespace OpenRCT2::Ui; @@ -515,6 +517,31 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex) } } +static void ShortcutToggleWallSlope() +{ + WindowBase* window = WindowFindByClass(WindowClass::TileInspector); + if (window == nullptr) + { + return; + } + + const TileElement* tileElement = OpenRCT2::TileInspector::GetSelectedElement(); + + // Ensure an element is selected and it's a wall + if (tileElement == nullptr || tileElement->GetType() != TileElementType::Wall) + { + return; + } + + int32_t currSlopeValue = tileElement->AsWall()->GetSlope(); + int32_t newSlopeValue = (currSlopeValue + 1) % 3; + + extern TileCoordsXY windowTileInspectorTile; + auto modifyTile = TileModifyAction( + windowTileInspectorTile.ToCoordsXY(), TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex, newSlopeValue); + GameActions::Execute(&modifyTile); +} + static void ShortcutIncreaseElementHeight() { WindowBase* w = WindowFindByClass(WindowClass::TileInspector); @@ -871,6 +898,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseY, STR_SHORTCUT_DECREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE)); RegisterShortcut(ShortcutId::WindowTileInspectorIncreaseHeight, STR_SHORTCUT_INCREASE_ELEM_HEIGHT, ShortcutIncreaseElementHeight); RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseHeight, STR_SHORTCUT_DECREASE_ELEM_HEIGHT, ShortcutDecreaseElementHeight); + RegisterShortcut(ShortcutId::WindowTileInspectorChangeWallSlope, STR_SHORTCUT_TOGGLE_WALL_SLOPE, ShortcutToggleWallSlope); // Debug RegisterShortcut(ShortcutId::DebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole); diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 906598b8b4..264aa43b31 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -4002,6 +4002,8 @@ enum : uint16_t STR_CHEAT_REMOVE_PARK_FENCES = 6593, + STR_SHORTCUT_TOGGLE_WALL_SLOPE = 6594, + // 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 };