diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index e11240e1af..d2535e9d30 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3751,6 +3751,7 @@ STR_6300 :{SMALLFONT}{BLACK}Download all missing objects if available online. STR_6301 :{SMALLFONT}{BLACK}Copy the selected object name to the clipboard. STR_6302 :{SMALLFONT}{BLACK}Copy the entire list of missing objects to the clipboard. STR_6303 :Downloading object ({COMMA16} / {COMMA16}): [{STRING}] +STR_6304 :Open scenery picker ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f1dc18fa8e..e692bef16e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.2.2+ (in development) ------------------------------------------------------------------------ +- Feature: [#7296] Allow assigning a keyboard shortcut for the scenery picker. - Feature: [#8919] Allow setting ride price from console. - Change: [#8688] Move common actions from debug menu into cheats menu. - Fix: [#5579] Network desync immediately after connecting. diff --git a/src/openrct2-ui/input/KeyboardShortcut.cpp b/src/openrct2-ui/input/KeyboardShortcut.cpp index faebe827b9..8da84e3d0d 100644 --- a/src/openrct2-ui/input/KeyboardShortcut.cpp +++ b/src/openrct2-ui/input/KeyboardShortcut.cpp @@ -33,6 +33,7 @@ #include #include #include +#include uint8_t gKeyboardShortcutChangeId; @@ -767,6 +768,33 @@ static void shortcut_advance_to_next_tick() gDoSingleUpdate = true; } +static void shortcut_open_scenery_picker() +{ + if ((gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + || (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR)) + return; + + rct_window* window_scenery = window_find_by_class(WC_SCENERY); + if (window_scenery == nullptr) + { + rct_window* window_toolbar = window_find_by_class(WC_TOP_TOOLBAR); + if (window_toolbar != nullptr) + { + window_invalidate(window_toolbar); + window_event_mouse_up_call(window_toolbar, WC_TOP_TOOLBAR__WIDX_SCENERY); + } + } + + window_scenery = window_find_by_class(WC_SCENERY); + if (window_scenery != nullptr && !widget_is_disabled(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON) + && window_scenery->widgets[WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON].type != WWT_EMPTY + && !gWindowSceneryEyedropperEnabled) + { + window_event_mouse_up_call(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); + return; + } +} + namespace { const shortcut_action shortcut_table[SHORTCUT_COUNT] = { @@ -841,6 +869,7 @@ namespace shortcut_highlight_path_issues_toggle, shortcut_open_tile_inspector, shortcut_advance_to_next_tick, + shortcut_open_scenery_picker, }; } // anonymous namespace diff --git a/src/openrct2-ui/input/KeyboardShortcuts.cpp b/src/openrct2-ui/input/KeyboardShortcuts.cpp index e6e7422ae8..9046baa351 100644 --- a/src/openrct2-ui/input/KeyboardShortcuts.cpp +++ b/src/openrct2-ui/input/KeyboardShortcuts.cpp @@ -317,4 +317,6 @@ const uint16_t KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] = { SHORTCUT_UNDEFINED, // SHORTCUT_VIEW_CLIPPING SDL_SCANCODE_I, // SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE SHORTCUT_UNDEFINED, // SHORTCUT_TILE_INSPECTOR + SHORTCUT_UNDEFINED, // SHORTCUT_ADVANCE_TO_NEXT_TICK + SHORTCUT_UNDEFINED, // SHORTCUT_SCENERY_PICKER }; diff --git a/src/openrct2-ui/input/KeyboardShortcuts.h b/src/openrct2-ui/input/KeyboardShortcuts.h index b0418d6dcd..5233dbf71f 100644 --- a/src/openrct2-ui/input/KeyboardShortcuts.h +++ b/src/openrct2-ui/input/KeyboardShortcuts.h @@ -95,6 +95,7 @@ enum SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, SHORTCUT_TILE_INSPECTOR, SHORTCUT_ADVANCE_TO_NEXT_TICK, + SHORTCUT_SCENERY_PICKER, SHORTCUT_COUNT, diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 595e053c40..04a2a66e35 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -140,6 +140,7 @@ enum WINDOW_SCENERY_LIST_WIDGET_IDX { validate_global_widx(WC_SCENERY, WIDX_SCENERY_TAB_1); validate_global_widx(WC_SCENERY, WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); +validate_global_widx(WC_SCENERY, WIDX_SCENERY_EYEDROPPER_BUTTON); static rct_widget window_scenery_widgets[] = { { WWT_FRAME, 0, 0, 633, 0, 141, 0xFFFFFFFF, STR_NONE }, // 1 0x009DE298 @@ -579,6 +580,7 @@ static void window_scenery_mouseup(rct_window* w, rct_widgetindex widgetIndex) gWindowSceneryPaintEnabled = 0; gWindowSceneryClusterEnabled = 0; gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled; + scenery_remove_ghost_tool_placement(); window_invalidate(w); break; case WIDX_SCENERY_BUILD_CLUSTER_BUTTON: diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index d3f53f6c51..95c4ac7720 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -150,6 +150,7 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = { STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, STR_SHORTCUT_OPEN_TILE_INSPECTOR, STR_ADVANCE_TO_NEXT_TICK, + STR_SHORTCUT_OPEN_SCENERY_PICKER, }; // clang-format on diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 8ab1c5973b..6835f620cf 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -487,6 +487,7 @@ enum #define WC_RIDE_CONSTRUCTION__WIDX_ROTATE 32 #define WC_SCENERY__WIDX_SCENERY_TAB_1 4 #define WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON 25 +#define WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON 30 #define WC_PEEP__WIDX_PATROL 11 #define WC_PEEP__WIDX_ACTION_LBL 12 #define WC_PEEP__WIDX_PICKUP 13 diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 7f45e809ca..c4695ed7b9 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3933,6 +3933,8 @@ enum STR_COPY_ALL_TIP = 6302, STR_DOWNLOADING_OBJECTS = 6303, + STR_SHORTCUT_OPEN_SCENERY_PICKER = 6304, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 };