1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

fixes #337 - shortcut keys on title screen propagating to game

This commit is contained in:
IntelOrca
2014-11-24 17:18:21 +00:00
parent 73a6b1acea
commit 5190862573
4 changed files with 40 additions and 8 deletions

View File

@@ -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();
}

View File

@@ -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();

View File

@@ -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

View File

@@ -18,16 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <time.h>
#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();