Integrate gKeyboardShortcutChangeId

This commit is contained in:
Ted John 2016-09-05 21:04:22 +01:00
parent 3c5d4adcf0
commit 2dc315f228
3 changed files with 10 additions and 4 deletions

View File

@ -31,6 +31,8 @@
#include "../platform/platform.h"
#include "../ride/track_paint.h"
uint8 gKeyboardShortcutChangeId;
typedef void (*shortcut_action)();
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
@ -52,7 +54,7 @@ void keyboard_shortcut_set(int key)
}
// Map shortcut to this key
gShortcutKeys[RCT2_GLOBAL(0x009DE511, uint8)] = key;
gShortcutKeys[gKeyboardShortcutChangeId] = key;
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
config_shortcut_keys_save();

View File

@ -19,6 +19,9 @@
#define SHORTCUT_UNDEFINED 0xFFFF
/** The current shortcut being changed. */
extern uint8 gKeyboardShortcutChangeId;
void keyboard_shortcut_set(int key);
void keyboard_shortcut_handle(int key);
void keyboard_shortcut_handle_command(int shortcutIndex);

View File

@ -16,10 +16,11 @@
#include "../addresses.h"
#include "../config.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/themes.h"
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../interface/themes.h"
extern const rct_string_id ShortcutStringIds[];
@ -80,7 +81,7 @@ void window_shortcut_change_open(int selected_key){
// Move this to window_shortcut_change_open
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
// Save the item we are selecting for new window
RCT2_GLOBAL(0x9DE511, uint8) = selected_key;
gKeyboardShortcutChangeId = selected_key;
rct_window* w = window_create_auto_pos(WW, WH, &window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);
w->widgets = window_shortcut_change_widgets;
@ -117,6 +118,6 @@ static void window_shortcut_change_paint(rct_window *w, rct_drawpixelinfo *dpi)
int x = w->x + 125;
int y = w->y + 30;
set_format_arg(0, rct_string_id, ShortcutStringIds[RCT2_GLOBAL(0x009DE511, uint8)]);
set_format_arg(0, rct_string_id, ShortcutStringIds[gKeyboardShortcutChangeId]);
gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 242, STR_SHORTCUT_CHANGE_PROMPT, RCT2_GLOBAL(0x9DEB8D, uint8));
}