mirror of https://github.com/OpenRCT2/OpenRCT2.git
Integrate gKeyboardShortcutChangeId
This commit is contained in:
parent
3c5d4adcf0
commit
2dc315f228
|
@ -31,6 +31,8 @@
|
||||||
#include "../platform/platform.h"
|
#include "../platform/platform.h"
|
||||||
#include "../ride/track_paint.h"
|
#include "../ride/track_paint.h"
|
||||||
|
|
||||||
|
uint8 gKeyboardShortcutChangeId;
|
||||||
|
|
||||||
typedef void (*shortcut_action)();
|
typedef void (*shortcut_action)();
|
||||||
|
|
||||||
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
|
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
|
||||||
|
@ -52,7 +54,7 @@ void keyboard_shortcut_set(int key)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map shortcut to this key
|
// Map shortcut to this key
|
||||||
gShortcutKeys[RCT2_GLOBAL(0x009DE511, uint8)] = key;
|
gShortcutKeys[gKeyboardShortcutChangeId] = key;
|
||||||
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
||||||
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
|
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
|
||||||
config_shortcut_keys_save();
|
config_shortcut_keys_save();
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
#define SHORTCUT_UNDEFINED 0xFFFF
|
#define SHORTCUT_UNDEFINED 0xFFFF
|
||||||
|
|
||||||
|
/** The current shortcut being changed. */
|
||||||
|
extern uint8 gKeyboardShortcutChangeId;
|
||||||
|
|
||||||
void keyboard_shortcut_set(int key);
|
void keyboard_shortcut_set(int key);
|
||||||
void keyboard_shortcut_handle(int key);
|
void keyboard_shortcut_handle(int key);
|
||||||
void keyboard_shortcut_handle_command(int shortcutIndex);
|
void keyboard_shortcut_handle_command(int shortcutIndex);
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
|
|
||||||
#include "../addresses.h"
|
#include "../addresses.h"
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
|
#include "../interface/keyboard_shortcut.h"
|
||||||
|
#include "../interface/themes.h"
|
||||||
#include "../interface/window.h"
|
#include "../interface/window.h"
|
||||||
#include "../interface/widget.h"
|
#include "../interface/widget.h"
|
||||||
#include "../localisation/localisation.h"
|
#include "../localisation/localisation.h"
|
||||||
#include "../interface/themes.h"
|
|
||||||
|
|
||||||
extern const rct_string_id ShortcutStringIds[];
|
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
|
// Move this to window_shortcut_change_open
|
||||||
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
|
||||||
// Save the item we are selecting for new window
|
// 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);
|
rct_window* w = window_create_auto_pos(WW, WH, &window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);
|
||||||
|
|
||||||
w->widgets = window_shortcut_change_widgets;
|
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 x = w->x + 125;
|
||||||
int y = w->y + 30;
|
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));
|
gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 242, STR_SHORTCUT_CHANGE_PROMPT, RCT2_GLOBAL(0x9DEB8D, uint8));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue