diff --git a/src/input.c b/src/input.c index 4600842d16..3d1b67ce1f 100644 --- a/src/input.c +++ b/src/input.c @@ -1083,6 +1083,37 @@ static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y) #pragma region Keyboard input +/** + * + * rct2: 0x006E3B43 + */ +void title_handle_keyboard_input() +{ + int key; + + // Handle modifier keys and key scrolling + RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) = 0; + if (RCT2_GLOBAL(0x009E2B64, uint32) != 1) { + if (gKeysState[SDL_SCANCODE_LSHIFT] || gKeysState[SDL_SCANCODE_RSHIFT]) + RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 1; + if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL]) + RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 2; + if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) + RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 4; + } + + while ((key = get_next_key()) != 0) { + if (key == 255) + continue; + + key |= RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) << 8; + + if (key == gShortcutKeys[SHORTCUT_SCREENSHOT]) { + keyboard_shortcut_handle_command(SHORTCUT_SCREENSHOT); + } + } +} + /** * * rct2: 0x006E3B43 @@ -1106,6 +1137,8 @@ void game_handle_keyboard_input() RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 1; if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL]) RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 2; + if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) + RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 4; if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) == 0) game_handle_key_scroll(); } diff --git a/src/input.h b/src/input.h index 94ea8fc8e7..80f75ad920 100644 --- a/src/input.h +++ b/src/input.h @@ -44,6 +44,7 @@ enum { INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7) }; +void title_handle_keyboard_input(); void game_handle_input(); void game_handle_keyboard_input(); diff --git a/src/platform/osinterface.c b/src/platform/osinterface.c index e4440d44a5..4cb965ce22 100644 --- a/src/platform/osinterface.c +++ b/src/platform/osinterface.c @@ -419,12 +419,6 @@ void osinterface_process_messages() gKeysPressed[e.key.keysym.scancode] = 1; if (e.key.keysym.sym == SDLK_RETURN && e.key.keysym.mod & KMOD_ALT) osinterface_set_fullscreen_mode(!gGeneral_config.fullscreen_mode); - if (e.key.keysym.sym == SDLK_PRINTSCREEN){ - RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 1; - //this function is normally called only in-game (in game_update) - //calling it here will save screenshots even while in main menu - screenshot_check(); - } // Text input diff --git a/src/title.c b/src/title.c index b3d318147a..ff224451b7 100644 --- a/src/title.c +++ b/src/title.c @@ -18,16 +18,17 @@ * along with this program. If not, see . *****************************************************************************/ -#include #include #include "addresses.h" #include "audio/audio.h" #include "config.h" #include "drawing/drawing.h" #include "editor.h" +#include "game.h" +#include "input.h" #include "localisation/date.h" #include "localisation/localisation.h" -#include "game.h" +#include "interface/screenshot.h" #include "interface/viewport.h" #include "intro.h" #include "management/news_item.h" @@ -257,6 +258,9 @@ void title_update() { int tmp; + screenshot_check(); + title_handle_keyboard_input(); + if (RCT2_GLOBAL(0x009DEA6E, uint8) == 0) { title_update_showcase(); game_logic_update();