From 7bffc4ae3380386caa825436cb85df9d296bed3f Mon Sep 17 00:00:00 2001 From: zyliwax Date: Wed, 22 Nov 2017 07:02:23 -0500 Subject: [PATCH] Adding gridlines display toggle shortcut. (#6313) This feature existed in the original RCT1/2 games but was not present in the latest development commit. The original shortcut for this key was '7', placing it between the "Invisible people toggle" (6) shortcut and the "Height marks on land toggle" (8). This commit preserves as much as possible, using placeholder comments that signify the relevant values which this feature actually uses where this is not possible. --- data/language/en-GB.txt | 1 + distribution/changelog.txt | 1 + src/openrct2-ui/input/KeyboardShortcut.cpp | 9 +++++++++ src/openrct2-ui/input/KeyboardShortcuts.cpp | 1 + src/openrct2-ui/input/KeyboardShortcuts.h | 1 + src/openrct2-ui/windows/ShortcutKeys.cpp | 1 + src/openrct2/localisation/string_ids.h | 2 ++ 7 files changed, 16 insertions(+) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index f857155dca..49e34cf507 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4469,6 +4469,7 @@ STR_6157 :Console STR_6158 :Failed to load this file...{NEWLINE}Incompatible RCTC version: {COMMA16} STR_6159 :Smooth Nearest Neighbour STR_6160 :{WINDOW_COLOUR_2}Available vehicles: {BLACK}{STRING} +STR_6161 :Gridlines display toggle ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1968fc461a..b9814f03a6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -11,6 +11,7 @@ - Feature: [#6292] Allow building queue lines in the Scenario Editor. - Feature: [#6295] TrueType fonts are now rendered with light font hinting by default. - Feature: [#6307] Arrows are now shown when placing park entrances. +- Feature: [#6313] Add keyboard shortcut for toggle gridlines. - Feature: [#6324] Add command to deselect unused objects from the object selection. - Feature: [#6325] Allow using g1.dat from RCT Classic. - Feature: [#6353] Show custom RCT1 scenarios in New Scenario window. diff --git a/src/openrct2-ui/input/KeyboardShortcut.cpp b/src/openrct2-ui/input/KeyboardShortcut.cpp index df37ac1921..39aab18317 100644 --- a/src/openrct2-ui/input/KeyboardShortcut.cpp +++ b/src/openrct2-ui/input/KeyboardShortcut.cpp @@ -311,6 +311,14 @@ static void shortcut_invisible_people_toggle() toggle_view_flag(VIEWPORT_FLAG_INVISIBLE_PEEPS); } +static void shortcut_gridlines_toggle() +{ + if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + return; + + toggle_view_flag(VIEWPORT_FLAG_GRIDLINES); +} + static void shortcut_height_marks_on_land_toggle() { if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) @@ -807,6 +815,7 @@ namespace shortcut_ride_construction_demolish_current, shortcut_load_game, shortcut_clear_scenery, + shortcut_gridlines_toggle, }; } diff --git a/src/openrct2-ui/input/KeyboardShortcuts.cpp b/src/openrct2-ui/input/KeyboardShortcuts.cpp index fc3c5c4780..642856b713 100644 --- a/src/openrct2-ui/input/KeyboardShortcuts.cpp +++ b/src/openrct2-ui/input/KeyboardShortcuts.cpp @@ -307,4 +307,5 @@ const uint16 KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] = SDL_SCANCODE_KP_MINUS, // SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT PLATFORM_MODIFIER | SDL_SCANCODE_L, // SHORTCUT_LOAD_GAME SDL_SCANCODE_B, // SHORTCUT_CLEAR_SCENERY + SDL_SCANCODE_7, // SHORTCUT_GRIDLINES_DISPLAY_TOGGLE }; diff --git a/src/openrct2-ui/input/KeyboardShortcuts.h b/src/openrct2-ui/input/KeyboardShortcuts.h index 6fb279ea00..171169c136 100644 --- a/src/openrct2-ui/input/KeyboardShortcuts.h +++ b/src/openrct2-ui/input/KeyboardShortcuts.h @@ -96,6 +96,7 @@ enum SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT, SHORTCUT_LOAD_GAME, SHORTCUT_CLEAR_SCENERY, + SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, SHORTCUT_COUNT, diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index ff12fb6c33..3bbdedab4c 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -153,6 +153,7 @@ const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = { STR_SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT, STR_LOAD_GAME, STR_SHORTCUT_CLEAR_SCENERY, + STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, }; } diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index f1a3fc0069..b5a63e4ee1 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3820,6 +3820,8 @@ enum { STR_AVAILABLE_VEHICLES = 6160, + STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE = 6161, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 };