1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Add scenery picker shortcut

This commit is contained in:
Ben Hopkins
2019-03-24 16:45:42 -05:00
committed by Michael Steenbeek
parent 262a9f29e8
commit c537f87fd5
9 changed files with 40 additions and 0 deletions

View File

@@ -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_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_6302 :{SMALLFONT}{BLACK}Copy the entire list of missing objects to the clipboard.
STR_6303 :Downloading object ({COMMA16} / {COMMA16}): [{STRING}] STR_6303 :Downloading object ({COMMA16} / {COMMA16}): [{STRING}]
STR_6304 :Open scenery picker
############# #############
# Scenarios # # Scenarios #

View File

@@ -1,5 +1,6 @@
0.2.2+ (in development) 0.2.2+ (in development)
------------------------------------------------------------------------ ------------------------------------------------------------------------
- Feature: [#7296] Allow assigning a keyboard shortcut for the scenery picker.
- Feature: [#8919] Allow setting ride price from console. - Feature: [#8919] Allow setting ride price from console.
- Change: [#8688] Move common actions from debug menu into cheats menu. - Change: [#8688] Move common actions from debug menu into cheats menu.
- Fix: [#5579] Network desync immediately after connecting. - Fix: [#5579] Network desync immediately after connecting.

View File

@@ -33,6 +33,7 @@
#include <openrct2/util/Util.h> #include <openrct2/util/Util.h>
#include <openrct2/windows/Intent.h> #include <openrct2/windows/Intent.h>
#include <openrct2/world/Park.h> #include <openrct2/world/Park.h>
#include <openrct2/world/Scenery.h>
uint8_t gKeyboardShortcutChangeId; uint8_t gKeyboardShortcutChangeId;
@@ -767,6 +768,33 @@ static void shortcut_advance_to_next_tick()
gDoSingleUpdate = true; 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 namespace
{ {
const shortcut_action shortcut_table[SHORTCUT_COUNT] = { const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
@@ -841,6 +869,7 @@ namespace
shortcut_highlight_path_issues_toggle, shortcut_highlight_path_issues_toggle,
shortcut_open_tile_inspector, shortcut_open_tile_inspector,
shortcut_advance_to_next_tick, shortcut_advance_to_next_tick,
shortcut_open_scenery_picker,
}; };
} // anonymous namespace } // anonymous namespace

View File

@@ -317,4 +317,6 @@ const uint16_t KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] = {
SHORTCUT_UNDEFINED, // SHORTCUT_VIEW_CLIPPING SHORTCUT_UNDEFINED, // SHORTCUT_VIEW_CLIPPING
SDL_SCANCODE_I, // SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE SDL_SCANCODE_I, // SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_TILE_INSPECTOR SHORTCUT_UNDEFINED, // SHORTCUT_TILE_INSPECTOR
SHORTCUT_UNDEFINED, // SHORTCUT_ADVANCE_TO_NEXT_TICK
SHORTCUT_UNDEFINED, // SHORTCUT_SCENERY_PICKER
}; };

View File

@@ -95,6 +95,7 @@ enum
SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE,
SHORTCUT_TILE_INSPECTOR, SHORTCUT_TILE_INSPECTOR,
SHORTCUT_ADVANCE_TO_NEXT_TICK, SHORTCUT_ADVANCE_TO_NEXT_TICK,
SHORTCUT_SCENERY_PICKER,
SHORTCUT_COUNT, SHORTCUT_COUNT,

View File

@@ -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_TAB_1);
validate_global_widx(WC_SCENERY, WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); 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[] = { static rct_widget window_scenery_widgets[] = {
{ WWT_FRAME, 0, 0, 633, 0, 141, 0xFFFFFFFF, STR_NONE }, // 1 0x009DE298 { 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; gWindowSceneryPaintEnabled = 0;
gWindowSceneryClusterEnabled = 0; gWindowSceneryClusterEnabled = 0;
gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled; gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled;
scenery_remove_ghost_tool_placement();
window_invalidate(w); window_invalidate(w);
break; break;
case WIDX_SCENERY_BUILD_CLUSTER_BUTTON: case WIDX_SCENERY_BUILD_CLUSTER_BUTTON:

View File

@@ -150,6 +150,7 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = {
STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE,
STR_SHORTCUT_OPEN_TILE_INSPECTOR, STR_SHORTCUT_OPEN_TILE_INSPECTOR,
STR_ADVANCE_TO_NEXT_TICK, STR_ADVANCE_TO_NEXT_TICK,
STR_SHORTCUT_OPEN_SCENERY_PICKER,
}; };
// clang-format on // clang-format on

View File

@@ -487,6 +487,7 @@ enum
#define WC_RIDE_CONSTRUCTION__WIDX_ROTATE 32 #define WC_RIDE_CONSTRUCTION__WIDX_ROTATE 32
#define WC_SCENERY__WIDX_SCENERY_TAB_1 4 #define WC_SCENERY__WIDX_SCENERY_TAB_1 4
#define WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON 25 #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_PATROL 11
#define WC_PEEP__WIDX_ACTION_LBL 12 #define WC_PEEP__WIDX_ACTION_LBL 12
#define WC_PEEP__WIDX_PICKUP 13 #define WC_PEEP__WIDX_PICKUP 13

View File

@@ -3933,6 +3933,8 @@ enum
STR_COPY_ALL_TIP = 6302, STR_COPY_ALL_TIP = 6302,
STR_DOWNLOADING_OBJECTS = 6303, 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 // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768 STR_COUNT = 32768
}; };