Merge pull request #2711 from marijnvdwerf/add-cmd-modifier

Allow using CMD as shortcut modifier
This commit is contained in:
Ted John committed 2016-01-13 12:45:21 +00:00
commit 38c52e28dc
6 files changed
+39 -3

No files matched your search

+2
View File
@@ -3971,6 +3971,8 @@ STR_5629 :Difficulty level
STR_5630 :Enable unlocking of scenarios
STR_5631 :Original DLC Parks
STR_5632 :Build your own...
STR_5633 :CMD +
STR_5634 :OPTION +
#############
# Scenarios #
+1
View File
@@ -15,6 +15,7 @@
- Fix: [#2650] Server did not validate actions send from clients (caused error box and desynchronisation)
- Fix: [#2651] Ride was not removed when multiplayer client aborted ride construction.
- Fix: [#2654] Free transport rides can prevent guests from properly leaving the park
- Fix: [#2704] OSX Command Key not read for keyboard shortcuts.
0.0.3.1-beta (2015-12-04)
------------------------------------------------------------------------
+9 -3
View File
@@ -894,6 +894,12 @@ void config_apply_to_old_addresses()
#define SHIFT 0x100
#define CTRL 0x200
#define ALT 0x400
#define CMD 0x800
#if defined(__APPLE__) && defined(__MACH__)
#define PLATFORM_MODIFIER CMD
#else
#define PLATFORM_MODIFIER CTRL
#endif
// Current keyboard shortcuts
uint16 gShortcutKeys[SHORTCUT_COUNT];
@@ -932,19 +938,19 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
CTRL | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
PLATFORM_MODIFIER | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
// New
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
CTRL | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
PLATFORM_MODIFIER | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
CTRL | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
PLATFORM_MODIFIER | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
};
#define SHORTCUT_FILE_VERSION 1
+16
View File
@@ -1391,6 +1391,11 @@ void title_handle_keyboard_input()
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])
gInputPlaceObjectModifier |= 4;
#if defined(__APPLE__) && defined(__MACH__)
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
gInputPlaceObjectModifier |= 8;
}
#endif
}
}
@@ -1451,6 +1456,11 @@ void game_handle_keyboard_input()
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) {
gInputPlaceObjectModifier |= 4;
}
#if defined(__APPLE__) && defined(__MACH__)
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
gInputPlaceObjectModifier |= 8;
}
#endif
game_handle_key_scroll();
}
}
@@ -1634,6 +1644,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 +1661,11 @@ void game_handle_key_scroll()
if (shortcutKey & ALT) {
if (!gKeysState[SDL_SCANCODE_LALT] && !gKeysState[SDL_SCANCODE_RALT]) continue;
}
#if defined(__APPLE__) && defined(__MACH__)
if (shortcutKey & CMD) {
if (!gKeysState[SDL_SCANCODE_LGUI] && !gKeysState[SDL_SCANCODE_RGUI]) continue;
}
#endif
switch (shortcutId) {
case SHORTCUT_SCROLL_MAP_UP:
+8
View File
@@ -97,7 +97,15 @@ void keyboard_shortcut_format_string(char *buffer, uint16 shortcutKey)
strcat(buffer, formatBuffer);
}
if (shortcutKey & 0x400) {
#if defined(__APPLE__) && defined(__MACH__)
format_string(formatBuffer, STR_OPTION_PLUS, NULL);
#else
format_string(formatBuffer, STR_ALT_PLUS, NULL);
#endif
strcat(buffer, formatBuffer);
}
if (shortcutKey & 0x800) {
format_string(formatBuffer, STR_CMD_PLUS, NULL);
strcat(buffer, formatBuffer);
}
strcat(buffer, SDL_GetScancodeName(shortcutKey & 0xFF));
+3
View File
@@ -2256,6 +2256,9 @@ enum {
STR_DLC_PARKS = 5631,
STR_BUILD_YOUR_OWN_PARKS = 5632,
STR_CMD_PLUS = 5633,
STR_OPTION_PLUS = 5634,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768