From ff1b124572dae5e4ff28003f6e64773ef3b2f470 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sun, 5 Oct 2014 14:21:35 +0100 Subject: [PATCH] Added start of shortcut window --- projects/openrct2.vcxproj | 1 + projects/openrct2.vcxproj.filters | 3 + src/window.h | 1 + src/window_options.c | 2 +- src/window_shortcut_keys.c | 101 ++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/window_shortcut_keys.c diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 38e1118dbe..7d2141ddcc 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -136,6 +136,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index b1610b9290..cfc27fe39c 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -431,6 +431,9 @@ Source Files + + Windows + diff --git a/src/window.h b/src/window.h index f7c27d7b1d..6e59bc1cd0 100644 --- a/src/window.h +++ b/src/window.h @@ -476,6 +476,7 @@ void window_staff_open(); void window_guest_list_open(); void window_map_open(); void window_options_open(); +void window_shortcut_keys_open(); void window_peep_open(rct_peep* peep); void window_staff_peep_open(rct_peep* peep); void window_park_awards_open(); diff --git a/src/window_options.c b/src/window_options.c index 4df489aa0f..b2a1325b43 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -286,7 +286,7 @@ static void window_options_mouseup() window_options_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_HOTKEY_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006E3884); + window_shortcut_keys_open(); break; case WIDX_SCREEN_EDGE_SCROLLING: RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_EDGE_SCROLLING, uint8) ^= 1; diff --git a/src/window_shortcut_keys.c b/src/window_shortcut_keys.c new file mode 100644 index 0000000000..27c63021d4 --- /dev/null +++ b/src/window_shortcut_keys.c @@ -0,0 +1,101 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John, Duncan Frost +* OpenRCT2, an open source clone of Roller Coaster Tycoon 2. +* +* This file is part of OpenRCT2. +* +* OpenRCT2 is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. + +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*****************************************************************************/ + +#include "window.h" +#include "widget.h" + +#define WW 340 +#define WH 240 + +enum WINDOW_SHORTCUT_WIDGET_IDX { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_SCROLL, + WIDX_RESET +}; + +// 9DE48C +static rct_widget window_shortcut_widgets[] = { + { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OPTIONS, STR_WINDOW_TITLE_TIP }, + { WWT_CLOSEBOX, 0, WW-13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, + { WWT_SCROLL, 0, 4, WW - 5, 18, WH - 18, 2, 2786 }, + { WWT_DROPDOWN_BUTTON, 0, 4, 153, WH-15, WH - 4, 2491, 2492 }, + { WIDGETS_END } +}; + +void window_shortcut_emptysub() { } + +static void* window_options_events[] = { + window_shortcut_emptysub, + (void*)0x6E39E4, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + (void*)0x6E3A07, + (void*)0x6E3A3E, + window_shortcut_emptysub, + (void*)0x6E3A16, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + (void*)0x6E3A0C, + window_shortcut_emptysub, + window_shortcut_emptysub, + window_shortcut_emptysub, + (void*)0x6E38E0, + (void*)0x6E38E6 +}; + +/** + * + * rct2: 0x006E3884 + */ +void window_shortcut_keys_open() +{ + rct_window* w; + + w = window_bring_to_front_by_id(WC_KEYBOARD_SHORTCUT_LIST, 0); + + if (w) return; + + w = window_create_auto_pos(WW, WH, (uint32*)0x9A3F0C, WC_KEYBOARD_SHORTCUT_LIST, 0); + + w->widgets = window_shortcut_widgets; + w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RESET); + window_init_scroll_widgets(w); + + w->colours[0] = 7; + w->colours[1] = 7; + w->colours[2] = 7; + w->no_list_items = 32; + w->selected_list_item = -1; +} \ No newline at end of file