From 1eda151c704278e17de7b0ee88849342706b2bbc Mon Sep 17 00:00:00 2001 From: ddevrien Date: Fri, 9 May 2014 10:04:40 +0200 Subject: [PATCH 01/13] Added basic code for banner window --- projects/openrct2.vcxproj | 1 + projects/openrct2.vcxproj.filters | 3 + src/window.h | 2 + src/window_banner.c | 211 ++++++++++++++++++++++++++++++ src/window_cheats.c | 4 +- 5 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 src/window_banner.c diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 3c13ff3f2b..ba0b2c85a4 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -96,6 +96,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 00a17f947b..e542a6e094 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -281,6 +281,9 @@ Source Files + + Windows + diff --git a/src/window.h b/src/window.h index 1aefaf65e4..21d7321eb4 100644 --- a/src/window.h +++ b/src/window.h @@ -275,6 +275,7 @@ enum { WC_CHANGE_KEYBOARD_SHORTCUT = 37, WC_MAP = 38, WC_TITLE_LOGO = 39, + WC_BANNER = 40, WC_EDITOR_OBJECT_SELECTION = 42, WC_EDITOR_INVENTION_LIST = 43, WC_EDITOR_SCENARIO_OPTIONS = 45, @@ -345,6 +346,7 @@ void window_guest_list_open(); void window_park_entrance_open(); void window_park_objective_open(); void window_ride_list_open(); +void window_banner_open(); void window_cheats_open(); void window_guest_list_init_vars_a(); diff --git a/src/window_banner.c b/src/window_banner.c new file mode 100644 index 0000000000..d8fc973a20 --- /dev/null +++ b/src/window_banner.c @@ -0,0 +1,211 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John, Dennis Devriendt + * 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 +#include "addresses.h" +#include "strings.h" +#include "widget.h" +#include "window.h" + +static enum WINDOW_CLEAR_SCENERY_WIDGET_IDX { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_VIEWPORT, + WIDX_BANNER_TEXT, + WIDX_BANNER_NO_ENTRY, + WIDX_BANNER_DEMOLISH, + WIDX_MAIN_COLOR, + WIDX_TEXT_COLOR_DROPDOWN, + WIDX_TEXT_COLOR_DROPDOWN_BUTTON +}; + +static rct_widget window_banner_widgets[] = { + { WWT_FRAME, 0, 0, 112, 0, 95, 0x0FFFFFFFF, 65535}, // panel / background + { WWT_CAPTION, 0, 1, 111, 1, 14, 0xBA9, STR_WINDOW_TITLE_TIP}, // title bar + { WWT_CLOSEBOX, 0, 100, 110, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button + { WWT_VIEWPORT, 1, 3, 87, 17, 76, 0x0FFFFFFFE, 65535}, // tab content panel + { WWT_FLATBTN, 1, 88, 111, 19, 42, 0x1430, STR_CHANGE_BANNER_TEXT_TIP}, // change banner button + { WWT_FLATBTN, 1, 88, 111, 43, 66, 0x143A, STR_SET_AS_NO_ENTRY_BANNER_TIP}, // no entry button + { WWT_FLATBTN, 1, 88, 111, 67, 90, 0x142D, STR_DEMOLISH_BANNER_TIP}, // demolish button + { WWT_COLORBTN, 1, 5, 16, 80, 91, 0x0FFFFFFFF, STR_SELECT_MAIN_COLOR_TIP}, // high money + { WWT_DROPDOWN, 1, 43, 81, 80, 91, 0x0FFFFFFFF, 65535}, // high money + { WWT_DROPDOWN_BUTTON, 1, 70, 80, 81, 90, 0x36C, STR_SELECT_TEXT_COLOR_TIP}, // high money + { WIDGETS_END }, +}; + +static void window_banner_emptysub() { } +static void window_banner_mouseup(); +static void window_banner_mousedown(); +static void window_banner_dropdown(); +static void window_banner_textinput(); +static void window_banner_invalidate(); +static void window_banner_paint(); + +static uint32 window_banner_events[] = { + window_banner_emptysub, + window_banner_mouseup, + window_banner_emptysub, + window_banner_mousedown, + window_banner_dropdown, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_textinput, + 0x006BA7B5, //sub_6BA7B5 + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_invalidate, + window_banner_paint, + window_banner_emptysub +}; + +/** +* +* rct2: 0x006BA305 +*/ +void window_banner_open() +{ + rct_window* w; + + // Check if window is already open + w = window_bring_to_front_by_id(WC_BANNER, 0); + if (w != NULL) + return; + + w = window_create_auto_pos(113, 96, window_banner_events, WC_BANNER, 0); + w->widgets = window_banner_widgets; + w->enabled_widgets = + (1 << WIDX_CLOSE) | + (1 << WIDX_BANNER_TEXT) | + (1 << WIDX_BANNER_NO_ENTRY) | + (1 << WIDX_BANNER_DEMOLISH) | + (1 << WIDX_MAIN_COLOR) | + (1 << WIDX_TEXT_COLOR_DROPDOWN) | + (1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON); + + window_init_scroll_widgets(w); + w->colours[0] = 24; + w->colours[1] = 24; + w->colours[2] = 24; + + // loc_6BA43E + w->flags |= WF_TRANSPARENT; + window_invalidate(w); +} + +static void window_banner_mouseup() +{ + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_CLOSE: + window_close(w); + break; + case WIDX_BANNER_DEMOLISH: + RCT2_CALLPROC_EBPSAFE(0x006BA739); + break; + case WIDX_BANNER_TEXT: + RCT2_CALLPROC_EBPSAFE(0x006BA6BC); + break; + case WIDX_BANNER_NO_ENTRY: + RCT2_CALLPROC_EBPSAFE(0x006BA64D); + break; + } +} + +static void window_banner_mousedown() +{ + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_MAIN_COLOR: + RCT2_CALLPROC_EBPSAFE(0x006BA528); + break; + case WIDX_TEXT_COLOR_DROPDOWN_BUTTON: + RCT2_CALLPROC_EBPSAFE(0x006BA563); + break; + } +} + +static void window_banner_dropdown() +{ + short widgetIndex; + + __asm mov widgetIndex, dx; + + if (widgetIndex == WIDX_MAIN_COLOR) + RCT2_CALLPROC_EBPSAFE(0x006BA548); + else if (widgetIndex == WIDX_TEXT_COLOR_DROPDOWN_BUTTON) + RCT2_CALLPROC_EBPSAFE(0x006BA5D0); +} + +static void window_banner_textinput() +{ + short widgetIndex; + + __asm mov widgetIndex, dx; + + if (widgetIndex == WIDX_BANNER_TEXT) { + RCT2_CALLPROC_EBPSAFE(0x006BA6D8); + } +} + +static void window_banner_invalidate() +{ + RCT2_CALLPROC_EBPSAFE(0x006BA44D); +} + +static void window_banner_paint() +{ + rct_window *w; + rct_drawpixelinfo *dpi; + + __asm mov w, esi + __asm mov dpi, edi + + window_draw_widgets(w, dpi); + + // Draw viewport + if (w->viewport != NULL) { + window_draw_viewport(dpi, w); + } +} diff --git a/src/window_cheats.c b/src/window_cheats.c index 4e9b188f53..50385e2ad3 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -28,7 +28,6 @@ #include "widget.h" #include "window.h" - #define WW 200 #define WH 128 #define CHEATS_MONEY_INCREMENT 10000 @@ -207,6 +206,9 @@ static void window_cheats_money_mouseup() window_invalidate_by_id(0x40 | WC_BOTTOM_TOOLBAR, 0); break; } + + window_park_entrance_open(); + window_banner_open(); } static void window_cheats_guests_mouseup() From 3eff5ebf6f005a3f9ebd0e4434f8ecbf0b30a1cb Mon Sep 17 00:00:00 2001 From: ddevrien Date: Fri, 9 May 2014 10:04:40 +0200 Subject: [PATCH 02/13] Added basic code for banner window --- src/window.h | 2 + src/window_banner.c | 211 ++++++++++++++++++++++++++++++++++++++++++++ src/window_cheats.c | 4 +- 3 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/window_banner.c diff --git a/src/window.h b/src/window.h index 956507fa1e..01ce98f35c 100644 --- a/src/window.h +++ b/src/window.h @@ -275,6 +275,7 @@ enum { WC_CHANGE_KEYBOARD_SHORTCUT = 37, WC_MAP = 38, WC_TITLE_LOGO = 39, + WC_BANNER = 40, WC_EDITOR_OBJECT_SELECTION = 42, WC_EDITOR_INVENTION_LIST = 43, WC_EDITOR_SCENARIO_OPTIONS = 45, @@ -349,6 +350,7 @@ void window_park_guests_open(); void window_park_objective_open(); void window_park_rating_open(); void window_ride_list_open(); +void window_banner_open(); void window_cheats_open(); void window_guest_list_init_vars_a(); diff --git a/src/window_banner.c b/src/window_banner.c new file mode 100644 index 0000000000..d8fc973a20 --- /dev/null +++ b/src/window_banner.c @@ -0,0 +1,211 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John, Dennis Devriendt + * 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 +#include "addresses.h" +#include "strings.h" +#include "widget.h" +#include "window.h" + +static enum WINDOW_CLEAR_SCENERY_WIDGET_IDX { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_VIEWPORT, + WIDX_BANNER_TEXT, + WIDX_BANNER_NO_ENTRY, + WIDX_BANNER_DEMOLISH, + WIDX_MAIN_COLOR, + WIDX_TEXT_COLOR_DROPDOWN, + WIDX_TEXT_COLOR_DROPDOWN_BUTTON +}; + +static rct_widget window_banner_widgets[] = { + { WWT_FRAME, 0, 0, 112, 0, 95, 0x0FFFFFFFF, 65535}, // panel / background + { WWT_CAPTION, 0, 1, 111, 1, 14, 0xBA9, STR_WINDOW_TITLE_TIP}, // title bar + { WWT_CLOSEBOX, 0, 100, 110, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button + { WWT_VIEWPORT, 1, 3, 87, 17, 76, 0x0FFFFFFFE, 65535}, // tab content panel + { WWT_FLATBTN, 1, 88, 111, 19, 42, 0x1430, STR_CHANGE_BANNER_TEXT_TIP}, // change banner button + { WWT_FLATBTN, 1, 88, 111, 43, 66, 0x143A, STR_SET_AS_NO_ENTRY_BANNER_TIP}, // no entry button + { WWT_FLATBTN, 1, 88, 111, 67, 90, 0x142D, STR_DEMOLISH_BANNER_TIP}, // demolish button + { WWT_COLORBTN, 1, 5, 16, 80, 91, 0x0FFFFFFFF, STR_SELECT_MAIN_COLOR_TIP}, // high money + { WWT_DROPDOWN, 1, 43, 81, 80, 91, 0x0FFFFFFFF, 65535}, // high money + { WWT_DROPDOWN_BUTTON, 1, 70, 80, 81, 90, 0x36C, STR_SELECT_TEXT_COLOR_TIP}, // high money + { WIDGETS_END }, +}; + +static void window_banner_emptysub() { } +static void window_banner_mouseup(); +static void window_banner_mousedown(); +static void window_banner_dropdown(); +static void window_banner_textinput(); +static void window_banner_invalidate(); +static void window_banner_paint(); + +static uint32 window_banner_events[] = { + window_banner_emptysub, + window_banner_mouseup, + window_banner_emptysub, + window_banner_mousedown, + window_banner_dropdown, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_textinput, + 0x006BA7B5, //sub_6BA7B5 + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_emptysub, + window_banner_invalidate, + window_banner_paint, + window_banner_emptysub +}; + +/** +* +* rct2: 0x006BA305 +*/ +void window_banner_open() +{ + rct_window* w; + + // Check if window is already open + w = window_bring_to_front_by_id(WC_BANNER, 0); + if (w != NULL) + return; + + w = window_create_auto_pos(113, 96, window_banner_events, WC_BANNER, 0); + w->widgets = window_banner_widgets; + w->enabled_widgets = + (1 << WIDX_CLOSE) | + (1 << WIDX_BANNER_TEXT) | + (1 << WIDX_BANNER_NO_ENTRY) | + (1 << WIDX_BANNER_DEMOLISH) | + (1 << WIDX_MAIN_COLOR) | + (1 << WIDX_TEXT_COLOR_DROPDOWN) | + (1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON); + + window_init_scroll_widgets(w); + w->colours[0] = 24; + w->colours[1] = 24; + w->colours[2] = 24; + + // loc_6BA43E + w->flags |= WF_TRANSPARENT; + window_invalidate(w); +} + +static void window_banner_mouseup() +{ + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_CLOSE: + window_close(w); + break; + case WIDX_BANNER_DEMOLISH: + RCT2_CALLPROC_EBPSAFE(0x006BA739); + break; + case WIDX_BANNER_TEXT: + RCT2_CALLPROC_EBPSAFE(0x006BA6BC); + break; + case WIDX_BANNER_NO_ENTRY: + RCT2_CALLPROC_EBPSAFE(0x006BA64D); + break; + } +} + +static void window_banner_mousedown() +{ + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_MAIN_COLOR: + RCT2_CALLPROC_EBPSAFE(0x006BA528); + break; + case WIDX_TEXT_COLOR_DROPDOWN_BUTTON: + RCT2_CALLPROC_EBPSAFE(0x006BA563); + break; + } +} + +static void window_banner_dropdown() +{ + short widgetIndex; + + __asm mov widgetIndex, dx; + + if (widgetIndex == WIDX_MAIN_COLOR) + RCT2_CALLPROC_EBPSAFE(0x006BA548); + else if (widgetIndex == WIDX_TEXT_COLOR_DROPDOWN_BUTTON) + RCT2_CALLPROC_EBPSAFE(0x006BA5D0); +} + +static void window_banner_textinput() +{ + short widgetIndex; + + __asm mov widgetIndex, dx; + + if (widgetIndex == WIDX_BANNER_TEXT) { + RCT2_CALLPROC_EBPSAFE(0x006BA6D8); + } +} + +static void window_banner_invalidate() +{ + RCT2_CALLPROC_EBPSAFE(0x006BA44D); +} + +static void window_banner_paint() +{ + rct_window *w; + rct_drawpixelinfo *dpi; + + __asm mov w, esi + __asm mov dpi, edi + + window_draw_widgets(w, dpi); + + // Draw viewport + if (w->viewport != NULL) { + window_draw_viewport(dpi, w); + } +} diff --git a/src/window_cheats.c b/src/window_cheats.c index 4e9b188f53..50385e2ad3 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -28,7 +28,6 @@ #include "widget.h" #include "window.h" - #define WW 200 #define WH 128 #define CHEATS_MONEY_INCREMENT 10000 @@ -207,6 +206,9 @@ static void window_cheats_money_mouseup() window_invalidate_by_id(0x40 | WC_BOTTOM_TOOLBAR, 0); break; } + + window_park_entrance_open(); + window_banner_open(); } static void window_cheats_guests_mouseup() From 6eb635fd2b7592281b79b796cf5d1fd276cec8ea Mon Sep 17 00:00:00 2001 From: ddevrien Date: Fri, 9 May 2014 10:15:10 +0200 Subject: [PATCH 03/13] master project files --- projects/openrct2.vcxproj | 4 ---- projects/openrct2.vcxproj.filters | 4 ---- 2 files changed, 8 deletions(-) diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 094b40be3e..8438e163f6 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -98,11 +98,7 @@ -<<<<<<< HEAD -======= - ->>>>>>> 1eda151c704278e17de7b0ee88849342706b2bbc diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index c505b74ce7..c11377bf77 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -281,7 +281,6 @@ Source Files -<<<<<<< HEAD Windows @@ -289,9 +288,6 @@ Windows -======= - ->>>>>>> 1eda151c704278e17de7b0ee88849342706b2bbc Windows From 6ddeb610f0dadf403eeedf1e60183c5f2ab8f4e1 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Fri, 9 May 2014 20:59:41 +0200 Subject: [PATCH 04/13] Some additions to window_banner --- projects/openrct2.vcxproj | 1 + projects/openrct2.vcxproj.filters | 3 +++ src/window_banner.c | 35 +++++++++++++++++++++++++------ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 8438e163f6..0bb32ba58a 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -84,6 +84,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index c11377bf77..973add4e53 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -290,6 +290,9 @@ Windows + + Windows + diff --git a/src/window_banner.c b/src/window_banner.c index d8fc973a20..e3766a829d 100644 --- a/src/window_banner.c +++ b/src/window_banner.c @@ -20,7 +20,9 @@ #include #include "addresses.h" +#include "config.h" #include "strings.h" +#include "viewport.h" #include "widget.h" #include "window.h" @@ -80,7 +82,7 @@ static uint32 window_banner_events[] = { window_banner_emptysub, window_banner_emptysub, window_banner_textinput, - 0x006BA7B5, //sub_6BA7B5 + 0x006BA7B5, window_banner_emptysub, window_banner_emptysub, window_banner_emptysub, @@ -96,10 +98,16 @@ static uint32 window_banner_events[] = { */ void window_banner_open() { + rct_windownumber windownumber; rct_window* w; + rct_viewport *viewport; + rct_widget *viewportWidget; + + //__asm mov windownumber, ax // not quite right I think + windownumber = 0; // Check if window is already open - w = window_bring_to_front_by_id(WC_BANNER, 0); + w = window_bring_to_front_by_id(WC_BANNER, windownumber); if (w != NULL) return; @@ -114,13 +122,30 @@ void window_banner_open() (1 << WIDX_TEXT_COLOR_DROPDOWN) | (1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON); + w->number = windownumber; window_init_scroll_widgets(w); w->colours[0] = 24; w->colours[1] = 24; w->colours[2] = 24; - // loc_6BA43E - w->flags |= WF_TRANSPARENT; + /* + TODO: MISSING CODE 006BA377 -> 006BA3F6, need the banner map element + */ + + // Create viewport + viewportWidget = &window_banner_widgets[WIDX_VIEWPORT]; + viewport_create( + w, + w->x + viewportWidget->left + 1, + w->y + viewportWidget->top + 1, + (viewportWidget->right - viewportWidget->left) - 2, + (viewportWidget->bottom - viewportWidget->top) - 2, + 100, // TODO: needs banner map position + 100 // TODO: needs banner map position + ); + + w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0; + w->flags |= WF_2 | WF_TRANSPARENT; window_invalidate(w); } @@ -151,10 +176,8 @@ static void window_banner_mouseup() static void window_banner_mousedown() { short widgetIndex; - rct_window *w; __asm mov widgetIndex, dx - __asm mov w, esi switch (widgetIndex) { case WIDX_MAIN_COLOR: From b280675ab57a6a549292cb250ff4f5f4230c56ce Mon Sep 17 00:00:00 2001 From: ddevrien Date: Fri, 9 May 2014 21:03:00 +0200 Subject: [PATCH 05/13] cleanup --- src/window_cheats.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/window_cheats.c b/src/window_cheats.c index 50385e2ad3..4e9b188f53 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -28,6 +28,7 @@ #include "widget.h" #include "window.h" + #define WW 200 #define WH 128 #define CHEATS_MONEY_INCREMENT 10000 @@ -206,9 +207,6 @@ static void window_cheats_money_mouseup() window_invalidate_by_id(0x40 | WC_BOTTOM_TOOLBAR, 0); break; } - - window_park_entrance_open(); - window_banner_open(); } static void window_cheats_guests_mouseup() From b2d1f0dfd6a9b9a00d85f36e9e3231e506cc630d Mon Sep 17 00:00:00 2001 From: ZedThree Date: Fri, 9 May 2014 12:54:11 +0200 Subject: [PATCH 06/13] Add functions for closing top/all window(s) --- src/window.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- src/window.h | 2 ++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/window.c b/src/window.c index 0a7f726040..9ce9708cdf 100644 --- a/src/window.c +++ b/src/window.c @@ -1,5 +1,5 @@ /***************************************************************************** -* Copyright (c) 2014 Ted John +* Copyright (c) 2014 Ted John, Peter Hill * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * This file is part of OpenRCT2. @@ -493,6 +493,47 @@ rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number) return NULL; } +/** + * Closes the top-most window + * + * rct2: 0x006E403C + */ +void window_close_top() { + rct_window* w; + + window_close_by_id(WC_DROPDOWN, 0); + + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){ + if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) { + window_close(w); + return; + } + } +} + +/** + * Closes all open windows + * + * rct2: 0x006EE927 + */ +void window_close_all() { + rct_window* w; + + window_close_by_id(WC_DROPDOWN, 0); + + for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){ + if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) { + window_close(w); + w = RCT2_FIRST_WINDOW; + } + } +} + /** * * rct2: 0x006EA845 @@ -1203,4 +1244,4 @@ void window_guest_list_init_vars_b() { RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF; RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF; RCT2_GLOBAL(0x00F1AF20, uint16) = 0; -} \ No newline at end of file +} diff --git a/src/window.h b/src/window.h index 956507fa1e..a9dad108d6 100644 --- a/src/window.h +++ b/src/window.h @@ -291,6 +291,8 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags); void window_close(rct_window *window); void window_close_by_id(rct_windowclass cls, rct_windownumber number); +void window_close_top(); +void window_close_all(); rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number); rct_window *window_find_from_point(int x, int y); int window_find_widget_from_point(rct_window *w, int x, int y); From bc413fede97db2354944913b34e6f9ac4078f847 Mon Sep 17 00:00:00 2001 From: ZedThree Date: Fri, 9 May 2014 18:27:59 +0200 Subject: [PATCH 07/13] Add helper function for calling widget events Add window_event_helper --- src/window.c | 9 +++++++++ src/window.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/window.c b/src/window.c index 9ce9708cdf..f41a874ff6 100644 --- a/src/window.c +++ b/src/window.c @@ -1245,3 +1245,12 @@ void window_guest_list_init_vars_b() { RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF; RCT2_GLOBAL(0x00F1AF20, uint16) = 0; } + +/** + * Wrapper for window events so C functions can call them + */ +void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event) { + + RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, w, 0, 0); + +} diff --git a/src/window.h b/src/window.h index a9dad108d6..faa40a5878 100644 --- a/src/window.h +++ b/src/window.h @@ -360,4 +360,6 @@ void window_ride_construction_init_vars(); void window_staff_init_vars(); +void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event); + #endif From 93d062704d0a2b64570e484408b878e526f1980f Mon Sep 17 00:00:00 2001 From: ZedThree Date: Fri, 9 May 2014 09:47:20 +0200 Subject: [PATCH 08/13] Add code to handle shortcuts --- src/game.c | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 257 insertions(+), 8 deletions(-) diff --git a/src/game.c b/src/game.c index 9d7611bbc3..14b0627211 100644 --- a/src/game.c +++ b/src/game.c @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 Ted John + * Copyright (c) 2014 Ted John, Peter Hill * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * This file is part of OpenRCT2. @@ -870,15 +870,264 @@ int get_next_key() * * rct2: 0x006E3E68 */ -void handle_shortcut(int key) -{ - int i; - for (i = 0; i < 32; i++) { - if (key == gShortcutKeys[i]) { - RCT2_CALLPROC_EBPSAFE(RCT2_ADDRESS(0x006E3FB4, uint32)[i]); - break; +void handle_shortcut(int key) { + + rct_window* window; + + if (key == gShortcutKeys[0]) { + // Close top most window + window_close_top(); + + } else if (key == gShortcutKeys[1]) { + // Close all windows + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)) { + window_close_all(); + return; } + if (RCT2_ADDRESS(0x0141F570, uint8) == 1) { + window_close_top(); + } + } else if (key == gShortcutKeys[2]) { + // Cancel construction mode + window = window_find_by_id(WC_ERROR, 0); + if (window != NULL) { + window_close(window); + return; + } + if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) { + tool_cancel(); + } + } else if (key == gShortcutKeys[3]) { + // Pause + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 10)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 0, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[4]) { + // Zoom out + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 2, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[5]) { + // Zoom in + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 3, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[6]) { + // Rotate view + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 4, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[7]) { + // Rotate object + RCT2_CALLPROC_EBPSAFE(0x006E4182); + } else if (key == gShortcutKeys[8]) { + // Underground view toggle + RCT2_CALLPROC_X(0x0066CF8A, 0, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[9]) { + // Remove base land toggle + RCT2_CALLPROC_X(0x0066CF8A, 1, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[10]) { + // Remove vertical land toggle + RCT2_CALLPROC_X(0x0066CF8A, 2, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[11]) { + // See through rides toggle + RCT2_CALLPROC_X(0x0066CF8A, 4, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[12]) { + // See through scenery toggle + RCT2_CALLPROC_X(0x0066CF8A, 5, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[13]) { + // Invisible supports toggle + RCT2_CALLPROC_X(0x0066CF8A, 6, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[14]) { + // Invisible people toggle + RCT2_CALLPROC_X(0x0066CF8A, 7, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[15]) { + // Height marks on land toggle + RCT2_CALLPROC_X(0x0066CF8A, 9, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[16]) { + // Height marks on ride tracks toggle + RCT2_CALLPROC_X(0x0066CF8A, 10, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[17]) { + // Height marks on paths toggle + RCT2_CALLPROC_X(0x0066CF8A, 11, 0, 0, 0, 0, 0, 0); + } else if (key == gShortcutKeys[18]) { + // Adjust land + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 7, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[19]) { + // Adjust water + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 8, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[20]) { + // Build scenery + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 9, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[21]) { + // Build paths + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 10, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[22]) { + // Build new ride + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 11, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[23]) { + // Show financial information + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) { + RCT2_CALLPROC_EBPSAFE(0x0069DDF1); + } + } + } else if (key == gShortcutKeys[24]) { + // Show research information + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + // Open new ride window + RCT2_CALLPROC_EBPSAFE(0x006B3CFF); + window = window_find_by_id(WC_CONSTRUCT_RIDE, 0); + if (window != NULL) { + window_event_helper(window, 10, WE_MOUSE_DOWN); + } + } + } else if (key == gShortcutKeys[25]) { + // Show rides list + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 12, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[26]) { + // Show park information + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 13, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[27]) { + // Show guest list + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 15, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[28]) { + // Show staff information + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 14, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[29]) { + // Show recent messages + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window_news_open(); + } + } else if (key == gShortcutKeys[30]) { + // Show map + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { + if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { + return; + } + } + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 6, WE_MOUSE_UP); + } + } + } else if (key == gShortcutKeys[31]) { + // Screenshot + RCT2_CALLPROC_EBPSAFE(0x006E4034); } + } /** From 2523b1f328a0b56fa9d836362c41dc28bf0663b9 Mon Sep 17 00:00:00 2001 From: ZedThree Date: Fri, 9 May 2014 22:44:55 +0200 Subject: [PATCH 09/13] Fix a couple of window bugs --- src/window_game_top_toolbar.c | 7 ++++--- src/window_guest_list.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/window_game_top_toolbar.c b/src/window_game_top_toolbar.c index fa59d02950..afacce3cf1 100644 --- a/src/window_game_top_toolbar.c +++ b/src/window_game_top_toolbar.c @@ -208,9 +208,10 @@ static void window_game_top_toolbar_mouseup() } break; case WIDX_SCENERY: - tool_set(w, WIDX_SCENERY, 0); - RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); - RCT2_CALLPROC_EBPSAFE(0x006E0FEF); + if (!tool_set(w, WIDX_SCENERY, 0)) { + RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); + RCT2_CALLPROC_EBPSAFE(0x006E0FEF); + } break; case WIDX_PATH: if (window_find_by_id(WC_FOOTPATH, 0) == NULL) { diff --git a/src/window_guest_list.c b/src/window_guest_list.c index 4af11e4dd4..a3f2de1480 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -142,7 +142,7 @@ void window_guest_list_open() rct_window* window; // Check if window is already open - window = window_bring_to_front_by_id(WC_RIDE_LIST, 0); + window = window_bring_to_front_by_id(WC_GUEST_LIST, 0); if (window != NULL) return; @@ -994,4 +994,4 @@ static int get_guest_face_sprite_large(rct_peep* peep){ } return sprite; -} \ No newline at end of file +} From 3b8f0d685bc8c5a78ef64f795ce8b475e7288d2a Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Fri, 9 May 2014 23:05:50 +0100 Subject: [PATCH 10/13] convert handling shortcut keys to switch --- src/game.c | 361 +++++++++++++++++++--------------------- src/window_guest_list.c | 2 +- 2 files changed, 168 insertions(+), 195 deletions(-) diff --git a/src/game.c b/src/game.c index 14b0627211..1a775dcf4c 100644 --- a/src/game.c +++ b/src/game.c @@ -866,39 +866,28 @@ int get_next_key() return 0; } -/** - * - * rct2: 0x006E3E68 - */ -void handle_shortcut(int key) { +void handle_shortcut_command(int shortcutIndex) +{ + rct_window *window; - rct_window* window; - - if (key == gShortcutKeys[0]) { - // Close top most window + switch (shortcutIndex) { + case SHORTCUT_CLOSE_TOP_MOST_WINDOW: window_close_top(); - - } else if (key == gShortcutKeys[1]) { - // Close all windows - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)) { + break; + case SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)) window_close_all(); - return; - } - if (RCT2_ADDRESS(0x0141F570, uint8) == 1) { + else if (RCT2_ADDRESS(0x0141F570, uint8) == 1) window_close_top(); - } - } else if (key == gShortcutKeys[2]) { - // Cancel construction mode + break; + case SHORTCUT_CANCEL_CONSTRUCTION_MODE: window = window_find_by_id(WC_ERROR, 0); - if (window != NULL) { + if (window != NULL) window_close(window); - return; - } - if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) { + else if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) tool_cancel(); - } - } else if (key == gShortcutKeys[3]) { - // Pause + break; + case SHORTCUT_PAUSE_GAME: if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 10)) { window = window_find_by_id(WC_TOP_TOOLBAR, 0); if (window != NULL) { @@ -906,228 +895,212 @@ void handle_shortcut(int key) { window_event_helper(window, 0, WE_MOUSE_UP); } } - } else if (key == gShortcutKeys[4]) { - // Zoom out - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_ZOOM_VIEW_OUT: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 2, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 2, WE_MOUSE_UP); + break; + case SHORTCUT_ZOOM_VIEW_IN: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 3, WE_MOUSE_UP); + } } } - } else if (key == gShortcutKeys[5]) { - // Zoom in - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_ROTATE_VIEW: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 4, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 3, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[6]) { - // Rotate view - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; - } - } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 4, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[7]) { - // Rotate object + break; + case SHORTCUT_ROTATE_CONSTRUCTION_OBJECT: RCT2_CALLPROC_EBPSAFE(0x006E4182); - } else if (key == gShortcutKeys[8]) { - // Underground view toggle + break; + case SHORTCUT_UNDERGROUND_VIEW_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 0, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[9]) { - // Remove base land toggle + break; + case SHORTCUT_REMOVE_BASE_LAND_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 1, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[10]) { - // Remove vertical land toggle + break; + case SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 2, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[11]) { - // See through rides toggle + break; + case SHORTCUT_SEE_THROUGH_RIDES_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 4, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[12]) { - // See through scenery toggle + break; + case SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 5, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[13]) { - // Invisible supports toggle + break; + case SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 6, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[14]) { - // Invisible people toggle + break; + case SHORTCUT_INVISIBLE_PEOPLE_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 7, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[15]) { - // Height marks on land toggle + break; + case SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 9, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[16]) { - // Height marks on ride tracks toggle + break; + case SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 10, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[17]) { - // Height marks on paths toggle + break; + case SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE: RCT2_CALLPROC_X(0x0066CF8A, 11, 0, 0, 0, 0, 0, 0); - } else if (key == gShortcutKeys[18]) { - // Adjust land - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_ADJUST_LAND: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 7, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 7, WE_MOUSE_UP); + break; + case SHORTCUT_ADJUST_WATER: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 8, WE_MOUSE_UP); + } } } - } else if (key == gShortcutKeys[19]) { - // Adjust water - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_BUILD_SCENERY: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 9, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 8, WE_MOUSE_UP); + break; + case SHORTCUT_BUILD_PATHS: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 10, WE_MOUSE_UP); + } } } - } else if (key == gShortcutKeys[20]) { - // Build scenery - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_BUILD_NEW_RIDE: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 11, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 9, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[21]) { - // Build paths - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; - } - } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 10, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[22]) { - // Build new ride - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; - } - } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 11, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[23]) { - // Show financial information - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) { - RCT2_CALLPROC_EBPSAFE(0x0069DDF1); - } - } - } else if (key == gShortcutKeys[24]) { - // Show research information - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { - // Open new ride window - RCT2_CALLPROC_EBPSAFE(0x006B3CFF); - window = window_find_by_id(WC_CONSTRUCT_RIDE, 0); - if (window != NULL) { + break; + case SHORTCUT_SHOW_FINANCIAL_INFORMATION: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) + RCT2_CALLPROC_EBPSAFE(0x0069DDF1); + break; + case SHORTCUT_SHOW_RESEARCH_INFORMATION: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + // Open new ride window + RCT2_CALLPROC_EBPSAFE(0x006B3CFF); + window = window_find_by_id(WC_CONSTRUCT_RIDE, 0); + if (window != NULL) window_event_helper(window, 10, WE_MOUSE_DOWN); - } } - } else if (key == gShortcutKeys[25]) { - // Show rides list - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); + break; + case SHORTCUT_SHOW_RIDES_LIST: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); if (window != NULL) { window_invalidate(window); window_event_helper(window, 12, WE_MOUSE_UP); } } - } else if (key == gShortcutKeys[26]) { - // Show park information - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); + break; + case SHORTCUT_SHOW_PARK_INFORMATION: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); if (window != NULL) { window_invalidate(window); window_event_helper(window, 13, WE_MOUSE_UP); } } - } else if (key == gShortcutKeys[27]) { - // Show guest list - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); + break; + case SHORTCUT_SHOW_GUEST_LIST: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); if (window != NULL) { window_invalidate(window); window_event_helper(window, 15, WE_MOUSE_UP); } } - } else if (key == gShortcutKeys[28]) { - // Show staff information - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { + break; + case SHORTCUT_SHOW_STAFF_LIST: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { window = window_find_by_id(WC_TOP_TOOLBAR, 0); if (window != NULL) { window_invalidate(window); window_event_helper(window, 14, WE_MOUSE_UP); } } - } else if (key == gShortcutKeys[29]) { - // Show recent messages - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) { - window_news_open(); - } - } else if (key == gShortcutKeys[30]) { - // Show map - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) { - if (RCT2_ADDRESS(0x0141F570, uint8) != 1) { - return; + break; + case SHORTCUT_SHOW_RECENT_MESSAGES: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) + window_news_open(); + break; + case SHORTCUT_SHOW_MAP: + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { + window = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (window != NULL) { + window_invalidate(window); + window_event_helper(window, 6, WE_MOUSE_UP); + } } } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) { - window = window_find_by_id(WC_TOP_TOOLBAR, 0); - if (window != NULL) { - window_invalidate(window); - window_event_helper(window, 6, WE_MOUSE_UP); - } - } - } else if (key == gShortcutKeys[31]) { - // Screenshot - RCT2_CALLPROC_EBPSAFE(0x006E4034); + break; + case SHORTCUT_SCREENSHOT: + RCT2_CALLPROC_EBPSAFE(0x006E4034); // set screenshot countdown to 2 + break; } +} +/** + * + * rct2: 0x006E3E68 + */ +void handle_shortcut(int key) +{ + int i; + for (i = 0; i < SHORTCUT_COUNT; i++) { + if (key == gShortcutKeys[i]) { + handle_shortcut_command(i); + break; + } + } } /** diff --git a/src/window_guest_list.c b/src/window_guest_list.c index a3f2de1480..0dbd247bb3 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -161,7 +161,7 @@ void window_guest_list_open() window_init_scroll_widgets(window); _window_guest_list_highlighted_index = -1; window->var_490 = 0; - _window_guest_list_selected_tab = 1; + _window_guest_list_selected_tab = PAGE_INDIVIDUAL; _window_guest_list_selected_filter = -1; _window_guest_list_selected_page = 0; _window_guest_list_num_pages = 1; From 73d06418b62f0302614371b68990812276dba5e0 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Fri, 9 May 2014 23:06:53 +0100 Subject: [PATCH 11/13] Adding ride build date, reset function --- src/ride.c | 17 +++++++++++++++++ src/ride.h | 5 ++++- src/scenario.c | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ride.c b/src/ride.c index cc6f543d7f..bb4d8e7164 100644 --- a/src/ride.c +++ b/src/ride.c @@ -150,3 +150,20 @@ void ride_init_all() ride_measurement->var_00 = 0xFF; } } + +/** +* +* rct2: 0x006B7A38 +*/ +void reset_all_ride_build_dates() { + int i; + rct_ride *ride; + for (i = 0; i < MAX_RIDES; i++) { + ride = GET_RIDE(i); + if (ride->type != RIDE_TYPE_NULL) { + //mov ax, current_month_year + //sub [esi + 180h], ax + ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + } + } +} \ No newline at end of file diff --git a/src/ride.h b/src/ride.h index 78574be103..f7152bf3e5 100644 --- a/src/ride.h +++ b/src/ride.h @@ -72,7 +72,9 @@ typedef struct { uint8 var_14D; uint8 pad_14E[0x0A]; uint16 var_158; - uint8 pad_15A[0x3C]; + uint8 pad_15A[0x26]; + uint16 build_date; + uint8 pad_182[0x14]; uint16 var_196; uint8 pad_198; uint8 var_199; @@ -257,5 +259,6 @@ int ride_get_count(); int ride_get_total_queue_length(rct_ride *ride); int ride_get_max_queue_time(rct_ride *ride); void ride_init_all(); +void reset_all_ride_build_dates(); #endif diff --git a/src/scenario.c b/src/scenario.c index 0752ea39df..fbbb839e67 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -513,7 +513,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario) RCT2_GLOBAL(0x013587D8, uint16) = 63; RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related, called above already) RCT2_CALLPROC_EBPSAFE(0x0066729F); // reset history / finance / awards - RCT2_CALLPROC_EBPSAFE(0x006B7A38); // reset_all_ride_build_dates + reset_all_ride_build_dates(); date_reset(); RCT2_CALLPROC_EBPSAFE(0x00674576); park_calculate_size(); From d3382e3a3877ba5c15049bf56ae08486236206d1 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Fri, 9 May 2014 23:11:51 +0100 Subject: [PATCH 12/13] Renaming ride construction content --- projects/openrct2.vcxproj | 2 +- projects/openrct2.vcxproj.filters | 6 +++--- src/editor.c | 6 +++--- src/game.c | 2 +- src/rct2.c | 2 +- src/scenario.c | 2 +- src/title.c | 4 ++-- src/window.h | 2 +- ..._ride_construction.c => window_new_ride.c} | 20 +++++++++---------- 9 files changed, 23 insertions(+), 23 deletions(-) rename src/{window_ride_construction.c => window_new_ride.c} (80%) diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 0bb32ba58a..6f1ca98c26 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -96,7 +96,7 @@ - + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 973add4e53..f575f5e573 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -281,9 +281,6 @@ Source Files - - Windows - Windows @@ -293,6 +290,9 @@ Windows + + Windows + diff --git a/src/editor.c b/src/editor.c index 57ec041be7..e2d8e01f7b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -62,7 +62,7 @@ void editor_load() RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_SCENARIO_EDITOR; RCT2_GLOBAL(0x0141F570, uint8) = 0; RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; - window_ride_construction_init_vars(); + window_new_ride_init_vars(); RCT2_GLOBAL(0x0141F571, uint8) = 4; viewport_init_all(); news_item_init_queue(); @@ -110,7 +110,7 @@ void trackdesigner_load() window_staff_init_vars(); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER; RCT2_GLOBAL(0x0141F570, uint8) = 0; - window_ride_construction_init_vars(); + window_new_ride_init_vars(); viewport_init_all(); news_item_init_queue(); RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create @@ -148,7 +148,7 @@ void trackmanager_load() window_staff_init_vars(); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER; RCT2_GLOBAL(0x0141F570, uint8) = 0; - window_ride_construction_init_vars(); + window_new_ride_init_vars(); viewport_init_all(); news_item_init_queue(); RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create diff --git a/src/game.c b/src/game.c index 1a775dcf4c..ad0852b179 100644 --- a/src/game.c +++ b/src/game.c @@ -1520,7 +1520,7 @@ int game_load_save() RCT2_CALLPROC_EBPSAFE(0x0069E9A7); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_construction_init_vars(); + window_new_ride_init_vars(); RCT2_GLOBAL(0x009DEB7C, uint16) = 0; if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play RCT2_CALLPROC_EBPSAFE(0x0069E869); diff --git a/src/rct2.c b/src/rct2.c index f586b16230..d4cc2fe042 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -135,7 +135,7 @@ void rct2_init() date_reset(); climate_reset(CLIMATE_COOL_AND_WET); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_construction_init_vars(); + window_new_ride_init_vars(); window_guest_list_init_vars_b(); window_staff_init_vars(); diff --git a/src/scenario.c b/src/scenario.c index fbbb839e67..a05cc25216 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -450,7 +450,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario) window_invalidate(mainWindow); RCT2_CALLPROC_EBPSAFE(0x0069E9A7); - window_ride_construction_init_vars(); + window_new_ride_init_vars(); RCT2_GLOBAL(0x00F663B0, sint32) = RCT2_GLOBAL(0x009AA0F0, sint32); RCT2_GLOBAL(0x00F663B4, sint32) = RCT2_GLOBAL(0x009AA0F4, sint32); diff --git a/src/title.c b/src/title.c index e32641a20b..ec26fb9133 100644 --- a/src/title.c +++ b/src/title.c @@ -103,7 +103,7 @@ void title_load() date_reset(); RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_construction_init_vars(); + window_new_ride_init_vars(); window_guest_list_init_vars_b(); window_staff_init_vars(); RCT2_CALLPROC_EBPSAFE(0x0068AFFD); @@ -191,7 +191,7 @@ static void title_update_showcase() window_invalidate(w); RCT2_CALLPROC_EBPSAFE(0x0069E9A7); - window_ride_construction_init_vars(); + window_new_ride_init_vars(); RCT2_CALLPROC_EBPSAFE(0x00684AC3); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); news_item_init_queue(); diff --git a/src/window.h b/src/window.h index eb4abfa776..e163eb81e2 100644 --- a/src/window.h +++ b/src/window.h @@ -358,7 +358,7 @@ void window_cheats_open(); void window_guest_list_init_vars_a(); void window_guest_list_init_vars_b(); -void window_ride_construction_init_vars(); +void window_new_ride_init_vars(); void window_staff_init_vars(); diff --git a/src/window_ride_construction.c b/src/window_new_ride.c similarity index 80% rename from src/window_ride_construction.c rename to src/window_new_ride.c index 35b813ac78..edbb45d96e 100644 --- a/src/window_ride_construction.c +++ b/src/window_new_ride.c @@ -24,26 +24,26 @@ #include "window.h" enum { - WINDOW_RIDE_CONSTRUCTION_TAB_TRANSPORT, - WINDOW_RIDE_CONSTRUCTION_TAB_GENTLE, - WINDOW_RIDE_CONSTRUCTION_TAB_ROLLER_COASTER, - WINDOW_RIDE_CONSTRUCTION_TAB_THRILL, - WINDOW_RIDE_CONSTRUCTION_TAB_WATER, - WINDOW_RIDE_CONSTRUCTION_TAB_SHOP, - WINDOW_RIDE_CONSTRUCTION_TAB_RESEARCH + WINDOW_NEW_RIDE_TAB_TRANSPORT, + WINDOW_NEW_RIDE_TAB_GENTLE, + WINDOW_NEW_RIDE_TAB_ROLLER_COASTER, + WINDOW_NEW_RIDE_TAB_THRILL, + WINDOW_NEW_RIDE_TAB_WATER, + WINDOW_NEW_RIDE_TAB_SHOP, + WINDOW_NEW_RIDE_TAB_RESEARCH } WINDOW_RIDE_CONSTRUCTION_TAB; /** * * rct2: 0x006ACA58 */ -void window_ride_construction_init_vars() { +void window_new_ride_init_vars() { // If we are in the track designer, default to the Roller Coaster tab if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) { - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_CONSTRUCTION_TAB_ROLLER_COASTER; + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_ROLLER_COASTER; } else { - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_CONSTRUCTION_TAB_TRANSPORT; + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_TRANSPORT; } for (short i = 0; i < 6; i++) { From 61ceee26a7b9d31be2ce64a987d5694f26f18edb Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 10 May 2014 00:40:47 +0100 Subject: [PATCH 13/13] remove extra scenario name address macro --- src/addresses.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 0917bbfe59..a23cc338b0 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -208,8 +208,6 @@ #define RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID 0x0141E9AE #define RCT2_ADDRESS_CURRENT_ROTATION 0x0141E9E0 -#define RCT2_ADDRESS_SCENARIO_NAME 0x0141F5B8 - #define RCT2_ADDRESS_WATER_RAISE_COST 0x0141F738 #define RCT2_ADDRESS_WATER_LOWER_COST 0x0141F73C