diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index e7db111068..bb257a0b4a 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -110,8 +110,11 @@ + + + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index e26b44910c..824a4edcc2 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -385,7 +385,6 @@ - @@ -470,6 +469,16 @@ Source\Localisation + + + Source\Windows + + + Source\Windows + + + Source\Windows + diff --git a/src/editor.c b/src/editor.c index 70a0564420..cf29c09eab 100644 --- a/src/editor.c +++ b/src/editor.c @@ -235,7 +235,6 @@ void trackdesigner_load() viewport_init_all(); news_item_init_queue(); window_editor_main_open(); - //RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create mainWindow = window_get_main(); window_scroll_to_location(mainWindow, 2400, 2400, 112); mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION; @@ -273,7 +272,6 @@ void trackmanager_load() viewport_init_all(); news_item_init_queue(); window_editor_main_open(); - //RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create mainWindow = window_get_main(); window_scroll_to_location(mainWindow, 2400, 2400, 112); mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION; @@ -721,10 +719,11 @@ static int editor_read_s6(const char *path) } /** -* -* rct2: 0x0067009A -*/ -void editor_open_windows_for_current_step() { + * + * rct2: 0x0067009A + */ +void editor_open_windows_for_current_step() +{ if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_EDITOR)) return; @@ -741,25 +740,24 @@ void editor_open_windows_for_current_step() { } window_editor_object_selection_open(); - //RCT2_CALLPROC_EBPSAFE(0x006AA64E); // window_editor_object_selection_open(); break; case EDITOR_STEP_INVENTIONS_LIST_SET_UP: if (window_find_by_class(WC_EDITOR_INVENTION_LIST)) return; - RCT2_CALLPROC_EBPSAFE(0x00684E04); // window_editor_inventions_list_open(); + window_editor_inventions_list_open(); break; case EDITOR_STEP_OPTIONS_SELECTION: if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS)) return; - RCT2_CALLPROC_EBPSAFE(0x00670138); // window_editor_scenario_options_open(); + window_editor_scenario_options_open(); break; case EDITOR_STEP_OBJECTIVE_SELECTION: if (window_find_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS)) return; - RCT2_CALLPROC_EBPSAFE(0x0067137D); // window_editor_objective_options_open(); + window_editor_objective_options_open(); break; } } diff --git a/src/editor.h b/src/editor.h index 849545c6e8..9232dd7c59 100644 --- a/src/editor.h +++ b/src/editor.h @@ -45,8 +45,6 @@ void editor_load_landscape(const char *path); void sub_6BD3A4(); -void window_editor_object_selection_open(); - void editor_open_windows_for_current_step(); #endif diff --git a/src/interface/window.h b/src/interface/window.h index c1781e384b..06546998f9 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -528,6 +528,10 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t void window_editor_main_open(); void window_editor_top_toolbar_open(); void window_editor_bottom_toolbar_open(); +void window_editor_object_selection_open(); +void window_editor_inventions_list_open(); +void window_editor_scenario_options_open(); +void window_editor_objective_options_open(); void window_guest_list_init_vars_a(); void window_guest_list_init_vars_b(); diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c new file mode 100644 index 0000000000..a2353dbc0c --- /dev/null +++ b/src/windows/editor_inventions_list.c @@ -0,0 +1,30 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John +* 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 "../addresses.h" + +/** + * + * rct2: 0x00684E04 + */ +void window_editor_inventions_list_open() +{ + RCT2_CALLPROC_EBPSAFE(0x00684E04); +} \ No newline at end of file diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 04e582c711..64f7822e2a 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -19,7 +19,77 @@ *****************************************************************************/ #include "../addresses.h" -#include "../editor.h" +#include "../game.h" +#include "../interface/widget.h" +#include "../interface/window.h" +#include "../object.h" + +#pragma region Widgets + +enum WINDOW_STAFF_LIST_WIDGET_IDX { + WIDX_EDITOR_OBJECT_SELECTION_BACKGROUND, // 0, 1 + WIDX_EDITOR_OBJECT_SELECTION_TITLE, // 1, 2 + WIDX_EDITOR_OBJECT_SELECTION_CLOSE, // 2, 4 + WIDX_EDITOR_OBJECT_SELECTION_TAB_CONTENT_PANEL, // 3, 8 + WIDX_EDITOR_OBJECT_SELECTION_TAB_1, // 4, 10 + WIDX_EDITOR_OBJECT_SELECTION_TAB_2, // 5, 20 + WIDX_EDITOR_OBJECT_SELECTION_TAB_3, // 6, 40 + WIDX_EDITOR_OBJECT_SELECTION_TAB_4, // 7, 80 + WIDX_EDITOR_OBJECT_SELECTION_TAB_5, // 8, 100 + WIDX_EDITOR_OBJECT_SELECTION_TAB_6, // 9, 200 + WIDX_EDITOR_OBJECT_SELECTION_TAB_7, // 10, 400 + WIDX_EDITOR_OBJECT_SELECTION_TAB_8, // 11, 800 + WIDX_EDITOR_OBJECT_SELECTION_TAB_9, // 12, 1000 + WIDX_EDITOR_OBJECT_SELECTION_TAB_10, // 13, 2000 + WIDX_EDITOR_OBJECT_SELECTION_TAB_11, // 14, 4000 + WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN1, // 15, 8000 + WIDX_EDITOR_OBJECT_SELECTION_LIST, // 16, 10000 + WIDX_EDITOR_OBJECT_SELECTION_FLATBTN, // 17, 20000 + WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN2, // 18, 40000 +}; + +#pragma endregion + +#pragma region Events + +static void window_editor_object_selection_emptysub() { } + +static void window_editor_object_selection_mouseup(); + +static void* window_editor_object_selection_events[] = { + (void*)0x006AB199, + (void*)window_editor_object_selection_mouseup, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)0x006AB031, + (void*)0x006AB0B6, + (void*)window_editor_object_selection_emptysub, + (void*)0x006AB079, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)0x006AB058, + (void*)window_editor_object_selection_emptysub, + (void*)window_editor_object_selection_emptysub, + (void*)0x006AA9FD, + (void*)0x006AAB56, + (void*)0x006AADA3 +}; + +#pragma endregion + +static void window_editor_object_set_page(rct_window *w, int page); /** * @@ -27,5 +97,101 @@ */ void window_editor_object_selection_open() { - RCT2_CALLPROC_EBPSAFE(0x006AA64E); + rct_window* window; + + window = window_bring_to_front_by_class(WC_EDITOR_OBJECT_SELECTION); + if (window != NULL) + return; + + RCT2_CALLPROC_EBPSAFE(0x006AB211); + RCT2_CALLPROC_EBPSAFE(0x006AA770); + + window = window_create( + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300, + max(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200, 28), + 600, + 400, + (uint32*)window_editor_object_selection_events, + WC_EDITOR_OBJECT_SELECTION, + WF_STICK_TO_FRONT + ); + window->widgets = (rct_widget*)0x009ADB00; + + window->enabled_widgets = + (1 << WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN1) | + (1 << WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN2) | + (1 << WIDX_EDITOR_OBJECT_SELECTION_CLOSE); + + for (int i = WIDX_EDITOR_OBJECT_SELECTION_TAB_1; i <= WIDX_EDITOR_OBJECT_SELECTION_TAB_11; i++) + window->enabled_widgets |= (1LL << i); + window_init_scroll_widgets(window); + + window->var_4AE = 0; + window->selected_tab = 0; + window->selected_list_item = -1; + window->var_494 = 0xFFFFFFFF; + window->colours[0] = 4; + window->colours[1] = 1; + window->colours[2] = 1; +} + +static void window_editor_object_selection_mouseup() +{ + rct_window *w; + short widgetIndex; + + window_widget_get_registers(w, widgetIndex); + + switch (widgetIndex) { + case WIDX_EDITOR_OBJECT_SELECTION_CLOSE: + game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0); + break; + + case WIDX_EDITOR_OBJECT_SELECTION_TAB_1: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_2: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_3: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_4: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_5: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_6: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_7: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_8: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_9: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_10: + case WIDX_EDITOR_OBJECT_SELECTION_TAB_11: + window_editor_object_set_page(w, widgetIndex - WIDX_EDITOR_OBJECT_SELECTION_TAB_1); + break; + + case WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN1: + w->list_information_type ^= 1; + window_invalidate(w); + break; + + case WIDX_EDITOR_OBJECT_SELECTION_DROPDOWN2: + if (w->selected_list_item != -1) { + w->selected_list_item = -1; + object_free_scenario_text(); + } + window_invalidate(w); + + int eax, ebx, ecx, edx, esi, edi, ebp; + RCT2_CALLFUNC_X(0x00674FCE, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); + if (eax == 1) { + window_close(w); + RCT2_CALLPROC_EBPSAFE(0x006D386D); + } + break; + } +} + +static void window_editor_object_set_page(rct_window *w, int page) +{ + if (w->selected_tab == page) + return; + + w->selected_tab = page; + w->selected_list_item = -1; + w->var_494 = 0xFFFFFFFF; + w->scrolls[0].v_top = 0; + object_free_scenario_text(); + window_invalidate(w); } \ No newline at end of file diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c new file mode 100644 index 0000000000..9eb591219d --- /dev/null +++ b/src/windows/editor_objective_options.c @@ -0,0 +1,30 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John +* 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 "../addresses.h" + +/** + * + * rct2: 0x0067137D + */ +void window_editor_objective_options_open() +{ + RCT2_CALLPROC_EBPSAFE(0x0067137D); +} \ No newline at end of file diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c new file mode 100644 index 0000000000..2157d3565f --- /dev/null +++ b/src/windows/editor_scenario_options.c @@ -0,0 +1,30 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John +* 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 "../addresses.h" + +/** + * + * rct2: 0x00670138 + */ +void window_editor_scenario_options_open() +{ + RCT2_CALLPROC_EBPSAFE(0x00670138); +} \ No newline at end of file