From 1abc4a1915b9a74c950a0f2ed0dae9be20badfdb Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 6 Aug 2016 01:52:03 +0100 Subject: [PATCH] Integrate and clean up rest of guest list window vars --- src/addresses.h | 8 +++---- src/interface/window.c | 26 --------------------- src/windows/guest_list.c | 49 +++++++++++++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 4fab850ac3..98b02c8d69 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -379,10 +379,6 @@ #define RCT2_ADDRESS_HINSTANCE 0x01423A08 -#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER 0x00F1EE06 -#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_TAB 0x00F1EE12 -#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_VIEW 0x00F1EE13 - #define RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE 0x00F43833 #define RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB 0x00F43824 #define RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM 0x00F43825 @@ -544,6 +540,10 @@ #define RCT2_ADDRESS_PEEP_PATHFINDING_SINGLE_CHOICE_SECTION 0x00F1AEDE #define RCT2_ADDRESS_PEEP_PATHFINDING_IS_STAFF 0x00F1AEDD +#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER 0x00F1EE06 +#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_TAB 0x00F1EE12 +#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_VIEW 0x00F1EE13 + #define RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS 0x00F3EF92 #define RCT2_ADDRESS_PROVISIONAL_PATH_X 0x00F3EF94 #define RCT2_ADDRESS_PROVISIONAL_PATH_Y 0x00F3EF96 diff --git a/src/interface/window.c b/src/interface/window.c index 8caaf977b1..b168518c0d 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -1875,32 +1875,6 @@ void tool_cancel() } } -/** -* -* rct2: 0x0068F083 -*/ -void window_guest_list_init_vars_a() -{ - gNextGuestNumber = 1; - RCT2_GLOBAL(0x00F1AF1C, uint32) = 0xFFFFFFFF; - RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF; - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF; -} - -/** -* -* rct2: 0x0068F050 -*/ -void window_guest_list_init_vars_b() -{ - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_TAB, uint8) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_VIEW, uint8) = 0; - RCT2_GLOBAL(0x00F1AF1C, uint32) = 0xFFFFFFFF; - RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF; - RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF; - RCT2_GLOBAL(0x00F1AF20, uint16) = 0; -} - void window_event_close_call(rct_window *w) { if (w->event_handlers->close != NULL) diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index f6da5856d0..4bf5edd027 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -134,6 +134,10 @@ static rct_window_event_list window_guest_list_events = { window_guest_list_scrollpaint }; +static uint32 _window_guest_list_last_find_groups_tick; +static uint32 _window_guest_list_last_find_groups_selected_view; +static uint32 _window_guest_list_last_find_groups_wait; + static int _window_guest_list_highlighted_index; // 0x00F1EE10 static int _window_guest_list_selected_tab; // 0x00F1EE12 static int _window_guest_list_selected_filter; // 0x00F1EE06 @@ -153,6 +157,30 @@ static void window_guest_list_find_groups(); static void get_arguments_from_peep(rct_peep *peep, uint32 *argument_1, uint32* argument_2); +/** +* +* rct2: 0x0068F083 +*/ +void window_guest_list_init_vars_a() +{ + gNextGuestNumber = 1; + _window_guest_list_last_find_groups_tick = 0xFFFFFFFF; + _window_guest_list_selected_filter = 0xFF; +} + +/** +* +* rct2: 0x0068F050 +*/ +void window_guest_list_init_vars_b() +{ + _window_guest_list_selected_tab = 0; + _window_guest_list_selected_view = 0; + _window_guest_list_last_find_groups_tick = 0xFFFFFFFF; + _window_guest_list_selected_filter = 0xFF; + _window_guest_list_last_find_groups_wait = 0; +} + /** * * rct2: 0x006992E3 @@ -421,8 +449,9 @@ static void window_guest_list_dropdown(rct_window *w, int widgetIndex, int dropd */ static void window_guest_list_update(rct_window *w) { - if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0) - RCT2_GLOBAL(0x00F1AF20, uint16)--; + if (_window_guest_list_last_find_groups_wait != 0) { + _window_guest_list_last_find_groups_wait--; + } w->list_information_type++; if (w->list_information_type >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32)) w->list_information_type = 0; @@ -860,14 +889,18 @@ static void window_guest_list_find_groups() int spriteIndex, spriteIndex2, groupIndex, faceIndex; rct_peep *peep, *peep2; - int eax = gScenarioTicks & 0xFFFFFF00; - if (_window_guest_list_selected_view == RCT2_GLOBAL(0x00F1EE02, uint32)) - if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0 || eax == RCT2_GLOBAL(0x00F1AF1C, uint32)) + int tick256 = floor2(gScenarioTicks, 256); + if (_window_guest_list_selected_view == _window_guest_list_last_find_groups_selected_view) { + if (_window_guest_list_last_find_groups_wait != 0 || + _window_guest_list_last_find_groups_tick == tick256 + ) { return; + } + } - RCT2_GLOBAL(0x00F1AF1C, uint32) = eax; - RCT2_GLOBAL(0x00F1EE02, uint32) = _window_guest_list_selected_view; - RCT2_GLOBAL(0x00F1AF20, uint16) = 320; + _window_guest_list_last_find_groups_tick = tick256; + _window_guest_list_last_find_groups_selected_view = _window_guest_list_selected_view; + _window_guest_list_last_find_groups_wait = 320; _window_guest_list_num_groups = 0; // Set all guests to unassigned