From 0c34c3791c1fd9ad69a5034a92ff684a16dedb5c Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Thu, 8 May 2014 21:48:31 +0100 Subject: [PATCH] Cleaning up files and code related to windows --- projects/openrct2.vcxproj | 3 ++ projects/openrct2.vcxproj.filters | 9 +++++ src/addresses.h | 2 ++ src/editor.c | 12 +++---- src/game.c | 2 +- src/rct2.c | 4 +-- src/scenario.c | 2 +- src/title.c | 6 ++-- src/window.c | 24 ------------- src/window.h | 21 +++-------- src/window_finances.c | 33 ++++++++++++++++++ src/window_ride_construction.c | 58 +++++++++++++++++++++++++++++++ src/window_staff.c | 39 +++++++++++++++++++++ 13 files changed, 161 insertions(+), 54 deletions(-) create mode 100644 src/window_finances.c create mode 100644 src/window_ride_construction.c create mode 100644 src/window_staff.c diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 3c13ff3f2b..8438e163f6 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -93,9 +93,12 @@ + + + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 00a17f947b..c11377bf77 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -281,6 +281,15 @@ Source Files + + Windows + + + Windows + + + Windows + diff --git a/src/addresses.h b/src/addresses.h index 2ec02b5edd..0917bbfe59 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -228,6 +228,8 @@ #define RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB 0x00F4390A +#define RCT2_ADDRESS_WINDOW_MAP_SELECTED_TAB 0x014209E4 + #define RCT2_ADDRESS_OS_TIME_MINUTE 0x01424654 #define RCT2_ADDRESS_OS_TIME_HOUR 0x01424656 #define RCT2_ADDRESS_OS_TIME_DAY 0x01424304 diff --git a/src/editor.c b/src/editor.c index 9f07f326af..57ec041be7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -58,11 +58,11 @@ void editor_load() finance_init(); date_reset(); window_guest_list_init_vars_b(); - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; + window_staff_init_vars(); 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_list_init_vars(); + window_ride_construction_init_vars(); RCT2_GLOBAL(0x0141F571, uint8) = 4; viewport_init_all(); news_item_init_queue(); @@ -107,10 +107,10 @@ void trackdesigner_load() finance_init(); date_reset(); window_guest_list_init_vars_b(); - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; + window_staff_init_vars(); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER; RCT2_GLOBAL(0x0141F570, uint8) = 0; - window_ride_list_init_vars(); + window_ride_construction_init_vars(); viewport_init_all(); news_item_init_queue(); RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create @@ -145,10 +145,10 @@ void trackmanager_load() finance_init(); date_reset(); window_guest_list_init_vars_b(); - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; + window_staff_init_vars(); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER; RCT2_GLOBAL(0x0141F570, uint8) = 0; - window_ride_list_init_vars(); + window_ride_construction_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 c734617582..9d7611bbc3 100644 --- a/src/game.c +++ b/src/game.c @@ -1298,7 +1298,7 @@ int game_load_save() RCT2_CALLPROC_EBPSAFE(0x0069E9A7); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_list_init_vars(); + window_ride_construction_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 be54cd7306..a16180c282 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -135,9 +135,9 @@ void rct2_init() date_reset(); climate_reset(CLIMATE_COOL_AND_WET); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_list_init_vars(); + window_ride_construction_init_vars(); window_guest_list_init_vars_b(); - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; + window_staff_init_vars(); title_load(); diff --git a/src/scenario.c b/src/scenario.c index 4d2b409bdb..0752ea39df 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_list_init_vars(); + window_ride_construction_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 fc6ef67aa5..e32641a20b 100644 --- a/src/title.c +++ b/src/title.c @@ -103,9 +103,9 @@ void title_load() date_reset(); RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); - window_ride_list_init_vars(); + window_ride_construction_init_vars(); window_guest_list_init_vars_b(); - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; + window_staff_init_vars(); RCT2_CALLPROC_EBPSAFE(0x0068AFFD); RCT2_CALLPROC_EBPSAFE(0x0069EBE4); viewport_init_all(); @@ -191,7 +191,7 @@ static void title_update_showcase() window_invalidate(w); RCT2_CALLPROC_EBPSAFE(0x0069E9A7); - window_ride_list_init_vars(); + window_ride_construction_init_vars(); RCT2_CALLPROC_EBPSAFE(0x00684AC3); RCT2_CALLPROC_EBPSAFE(0x006DFEE4); news_item_init_queue(); diff --git a/src/window.c b/src/window.c index a35da16b81..0a7f726040 100644 --- a/src/window.c +++ b/src/window.c @@ -1203,28 +1203,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; -} - -/** -* -* rct2: 0x006ACA58 -*/ -void window_ride_list_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_LIST_TAB_ROLLER_COASTER; - } - else { - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_LIST_TAB_TRANSPORT; - } - - for (short i = 0; i < 6; i++) { - /* - Reset what is highlighted in each tab. - Each 16bit number represents the item in its respective tab. - */ - RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[i] = 0xFFFF; - } - - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE, uint8) = 0; } \ No newline at end of file diff --git a/src/window.h b/src/window.h index 3b80f58142..956507fa1e 100644 --- a/src/window.h +++ b/src/window.h @@ -284,22 +284,6 @@ enum { WC_CHEATS = 110, } WINDOW_CLASS; -enum { - WINDOW_RIDE_LIST_TAB_TRANSPORT, - WINDOW_RIDE_LIST_TAB_GENTLE, - WINDOW_RIDE_LIST_TAB_ROLLER_COASTER, - WINDOW_RIDE_LIST_TAB_THRILL, - WINDOW_RIDE_LIST_TAB_WATER, - WINDOW_RIDE_LIST_TAB_SHOP, - WINDOW_RIDE_LIST_TAB_RESEARCH -} WINDOW_RIDE_LIST_TAB; - -enum { - WINDOW_STAFF_LIST_TAB_HANDYMEN, - WINDOW_STAFF_LIST_TAB_MECHANICS, - WINDOW_STAFF_LIST_TAB_SECURITY, - WINDOW_STAFF_LIST_TAB_ENTERTAINERS -} WINDOW_STAFF_LIST_TAB; void window_dispatch_update_all(); void window_update_all(); @@ -369,6 +353,9 @@ void window_cheats_open(); void window_guest_list_init_vars_a(); void window_guest_list_init_vars_b(); -void window_ride_list_init_vars(); + +void window_ride_construction_init_vars(); + +void window_staff_init_vars(); #endif diff --git a/src/window_finances.c b/src/window_finances.c new file mode 100644 index 0000000000..a2244518dd --- /dev/null +++ b/src/window_finances.c @@ -0,0 +1,33 @@ +/***************************************************************************** +* Copyright (c) 2014 Maciek Baron +* 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 "game.h" +#include "window.h" + +enum { + WINDOW_FINANCES_TAB_SUMMARY, + WINDOW_FINANCES_TAB_FINANCIAL_GRAPH, + WINDOW_FINANCES_TAB_VALUE_GRAPH, + WINDOW_FINANCES_TAB_PROFIT_GRAPH, + WINDOW_FINANCES_TAB_MARKETING, + WINDOW_FINANCES_TAB_RESEARCH +} WINDOW_FINANCIAL_TAB; \ No newline at end of file diff --git a/src/window_ride_construction.c b/src/window_ride_construction.c new file mode 100644 index 0000000000..35b813ac78 --- /dev/null +++ b/src/window_ride_construction.c @@ -0,0 +1,58 @@ +/***************************************************************************** +* Copyright (c) 2014 Maciek Baron +* 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 "game.h" +#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_RIDE_CONSTRUCTION_TAB; + +/** +* +* rct2: 0x006ACA58 +*/ +void window_ride_construction_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; + } + else { + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_CONSTRUCTION_TAB_TRANSPORT; + } + + for (short i = 0; i < 6; i++) { + /* + Reset what is highlighted in each tab. + Each 16bit number represents the item in its respective tab. + */ + RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[i] = 0xFFFF; + } + + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE, uint8) = 0; +} \ No newline at end of file diff --git a/src/window_staff.c b/src/window_staff.c new file mode 100644 index 0000000000..3652084e9d --- /dev/null +++ b/src/window_staff.c @@ -0,0 +1,39 @@ +/***************************************************************************** +* Copyright (c) 2014 Maciek Baron +* 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 "game.h" +#include "window.h" + +enum { + WINDOW_STAFF_LIST_TAB_HANDYMEN, + WINDOW_STAFF_LIST_TAB_MECHANICS, + WINDOW_STAFF_LIST_TAB_SECURITY, + WINDOW_STAFF_LIST_TAB_ENTERTAINERS +} WINDOW_STAFF_LIST_TAB; + + +/* +* rct2: 0x006BD39C +**/ +void window_staff_init_vars() { + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN; +} \ No newline at end of file