From 72739e8cd851152c561c8be5ee8def89d1e0fa40 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 12 Jan 2016 22:29:36 +0100 Subject: [PATCH] Allow setting CMD as shortcut key --- data/language/english_uk.txt | 1 + src/input.c | 9 +++++++++ src/interface/keyboard_shortcut.c | 4 ++++ src/localisation/string_ids.h | 2 ++ 4 files changed, 16 insertions(+) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 6471f6ea13..6d6d35104e 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3971,6 +3971,7 @@ STR_5629 :Difficulty level STR_5630 :Enable unlocking of scenarios STR_5631 :Original DLC Parks STR_5632 :Build your own... +STR_5633 :CMD + ############# # Scenarios # diff --git a/src/input.c b/src/input.c index ece14f9867..e31076e493 100644 --- a/src/input.c +++ b/src/input.c @@ -1391,6 +1391,8 @@ void title_handle_keyboard_input() gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z; if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) gInputPlaceObjectModifier |= 4; + if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) + gInputPlaceObjectModifier |= 8; } } @@ -1451,6 +1453,9 @@ void game_handle_keyboard_input() if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) { gInputPlaceObjectModifier |= 4; } + if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) { + gInputPlaceObjectModifier |= 8; + } game_handle_key_scroll(); } } @@ -1634,6 +1639,7 @@ void game_handle_key_scroll() const int SHIFT = 0x100; const int CTRL = 0x200; const int ALT = 0x400; + const int CMD = 0x800; uint16 shortcutKey = gShortcutKeys[shortcutId]; uint8 scancode = shortcutKey & 0xFF; @@ -1650,6 +1656,9 @@ void game_handle_key_scroll() if (shortcutKey & ALT) { if (!gKeysState[SDL_SCANCODE_LALT] && !gKeysState[SDL_SCANCODE_RALT]) continue; } + if (shortcutKey & CMD) { + if (!gKeysState[SDL_SCANCODE_LGUI] && !gKeysState[SDL_SCANCODE_RGUI]) continue; + } switch (shortcutId) { case SHORTCUT_SCROLL_MAP_UP: diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index 7308fac0eb..80e4ca77e2 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -100,6 +100,10 @@ void keyboard_shortcut_format_string(char *buffer, uint16 shortcutKey) format_string(formatBuffer, STR_ALT_PLUS, NULL); strcat(buffer, formatBuffer); } + if (shortcutKey & 0x800) { + format_string(formatBuffer, STR_CMD_PLUS, NULL); + strcat(buffer, formatBuffer); + } strcat(buffer, SDL_GetScancodeName(shortcutKey & 0xFF)); } diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index d5369a1f9e..24e5f2750c 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -2256,6 +2256,8 @@ enum { STR_DLC_PARKS = 5631, STR_BUILD_YOUR_OWN_PARKS = 5632, + + STR_CMD_PLUS = 5633, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768