From 7f10024b8ede17c239d6d3b73d9ed0ef2b54fa91 Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Tue, 3 Mar 2015 22:52:30 +0100 Subject: [PATCH 1/3] Decompiled window_guest_list_open_with_filter --- src/interface/window.h | 1 + src/management/news_item.c | 2 +- src/windows/guest_list.c | 110 ++++++++++++++++++++++++++++++++++--- src/windows/ride.c | 6 +- 4 files changed, 108 insertions(+), 11 deletions(-) diff --git a/src/interface/window.h b/src/interface/window.h index 7c8c3c07fa..811241fda9 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -515,6 +515,7 @@ void window_land_open(); void window_water_open(); void window_staff_list_open(); void window_guest_list_open(); +void window_guest_list_open_with_filter(int type, int ebx); void window_map_open(); void window_options_open(); void window_shortcut_keys_open(); diff --git a/src/management/news_item.c b/src/management/news_item.c index 093d657ea1..f62b67c31e 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -333,7 +333,7 @@ void news_item_open_subject(int type, int subject) break; case NEWS_ITEM_PEEPS: // Open guest list to right tab - RCT2_CALLPROC_X(0x006993BA, 3, subject, 0, 0, 0, 0, 0); + window_guest_list_open_with_filter(3, subject);; break; case NEWS_ITEM_AWARD: window_park_awards_open(); diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index 7e4229bea5..5304f5af00 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -115,13 +115,13 @@ static void* window_guest_list_events[] = { window_guest_list_scrollpaint }; -static int _window_guest_list_highlighted_index; -static int _window_guest_list_selected_tab; -static int _window_guest_list_selected_filter; -static int _window_guest_list_selected_page; -static int _window_guest_list_selected_view; -static int _window_guest_list_num_pages; -static int _window_guest_list_num_groups; +static int _window_guest_list_highlighted_index; // 0x00F1EE10 +static int _window_guest_list_selected_tab; // 0x00F1EE12 +static int _window_guest_list_selected_filter; // 0x00F1EE06 +static int _window_guest_list_selected_page; // 0x00F1EE07 +static int _window_guest_list_selected_view; // 0x00F1EE13 +static int _window_guest_list_num_pages; // 0x00F1EE08 +static int _window_guest_list_num_groups; // 0x00F1AF22 static uint16 _window_guest_list_groups_num_guests[240]; static uint32 _window_guest_list_groups_argument_1[240]; @@ -178,6 +178,102 @@ void window_guest_list_open() window->colours[2] = 15; } +/** +* type == 0 -> guests on ride +* type == 1 -> guests in queue +* type == 2 -> guests thinking about ride +* type == 3 -> guests thinking X, opened from news item +* ebx is number of the ride or index of the thought +* values of eax and edx probably determine the filter name string +* +* rct2: 0x006993BA +*/ +void window_guest_list_open_with_filter(int type, int ebx) +{ + //RCT2_CALLPROC_X(0x006993BA, type, ebx, 0, 0, 0, 0, 0); + + uint32 eax, edx, ebp; + + window_guest_list_open(); + + _window_guest_list_selected_page = 0; + _window_guest_list_num_pages = 1; + + RCT2_GLOBAL(0x009AC7E0, uint8) = 0; + RCT2_GLOBAL(0x009AC7F0, uint8) = 0; + + switch(type) + { + case 0: + _window_guest_list_selected_filter = 0; + + ebp = ebx & 0x000000FF; + + eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); + edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); + + eax = (eax << 16) + 1435; + + int ride_type = g_ride_list[ebp].type; + if ((RCT2_ADDRESS(0x97CF40, uint32)[ride_type * 8] & 0x400000) != 0) + eax++; + + RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; + RCT2_GLOBAL(0x00F1EDFA, uint32) = edx; + + _window_guest_list_highlighted_index = 0xFFFF; + _window_guest_list_selected_tab = 0; + _window_guest_list_selected_view = 0; + break; + case 1: + _window_guest_list_selected_filter = 0; + + ebp = ebx & 0x000000FF; + + eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); + edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); + + eax = (eax << 16) + 1433; + + RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; + RCT2_GLOBAL(0x00F1EDFA, uint32) = edx; + + _window_guest_list_highlighted_index = 0xFFFF; + _window_guest_list_selected_tab = 0; + _window_guest_list_selected_view = 0; + break; + case 2: + _window_guest_list_selected_filter = 1; + + ebp = ebx & 0x000000FF; + + eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); + edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); + + eax = (eax << 16) + 0xFFFF; + + RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; + RCT2_GLOBAL(0x00F1EDFA, uint32) = edx; + + _window_guest_list_highlighted_index = 0xFFFF; + _window_guest_list_selected_tab = 0; + _window_guest_list_selected_view = 1; + break; + case 3: + _window_guest_list_selected_filter = 1; + + ebx = (ebx & 0x000000FF) + 1480; + + RCT2_GLOBAL(0x00F1EDF6, uint32) = ebx; + RCT2_GLOBAL(0x00F1EDFA, uint32) = 0; + + _window_guest_list_highlighted_index = 0xFFFF; + _window_guest_list_selected_tab = 0; + _window_guest_list_selected_view = 1; + break; + } +} + /** * * rct2: 0x00699AAF diff --git a/src/windows/ride.c b/src/windows/ride.c index b56c721930..26ab94276b 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -5649,13 +5649,13 @@ static void window_ride_customer_mouseup() window_ride_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_SHOW_GUESTS_THOUGHTS: - RCT2_CALLPROC_X(0x006993BA, 2, w->number, 0, 0, 0, 0, 0); + window_guest_list_open_with_filter(2, w->number); break; case WIDX_SHOW_GUESTS_ON_RIDE: - RCT2_CALLPROC_X(0x006993BA, 0, w->number, 0, 0, 0, 0, 0); + window_guest_list_open_with_filter(0, w->number); break; case WIDX_SHOW_GUESTS_QUEUING: - RCT2_CALLPROC_X(0x006993BA, 1, w->number, 0, 0, 0, 0, 0); + window_guest_list_open_with_filter(1, w->number); break; } } From 5a7d0a506ef7939fc02302146a39810ad49c3713 Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Wed, 4 Mar 2015 21:07:16 +0100 Subject: [PATCH 2/3] Fixed "thinking about" guest list filter not working --- src/windows/guest_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index 5304f5af00..4eff8ad1d4 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -815,7 +815,7 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep) _window_guest_list_selected_view = temp; - if (((RCT2_GLOBAL(0x00F1EDF6, uint32) >> 16) & 0xFFFF) == 0xFFFF && _window_guest_list_selected_filter == 1) + if (RCT2_GLOBAL(0x00F1EDF6, uint16) == 0xFFFF && _window_guest_list_selected_filter == 1) argument1 |= 0xFFFF; if (argument1 == RCT2_GLOBAL(0x00F1EDF6, uint32) && argument2 == RCT2_GLOBAL(0x00F1EDFA, uint32)) From 21b55888ec944d12f7dbb4e558e2a24a455cb79b Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Wed, 4 Mar 2015 21:24:05 +0100 Subject: [PATCH 3/3] Clean up guest_list_open_with_filter a bit --- src/interface/window.h | 2 +- src/windows/guest_list.c | 37 ++++++++++++++----------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/interface/window.h b/src/interface/window.h index 811241fda9..a8f5320061 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -515,7 +515,7 @@ void window_land_open(); void window_water_open(); void window_staff_list_open(); void window_guest_list_open(); -void window_guest_list_open_with_filter(int type, int ebx); +void window_guest_list_open_with_filter(int type, int index); void window_map_open(); void window_options_open(); void window_shortcut_keys_open(); diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index 4eff8ad1d4..856a8d59c4 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -183,39 +183,40 @@ void window_guest_list_open() * type == 1 -> guests in queue * type == 2 -> guests thinking about ride * type == 3 -> guests thinking X, opened from news item -* ebx is number of the ride or index of the thought +* index is number of the ride or index of the thought * values of eax and edx probably determine the filter name string * * rct2: 0x006993BA */ -void window_guest_list_open_with_filter(int type, int ebx) +void window_guest_list_open_with_filter(int type, int index) { //RCT2_CALLPROC_X(0x006993BA, type, ebx, 0, 0, 0, 0, 0); - uint32 eax, edx, ebp; + uint32 eax, edx; window_guest_list_open(); _window_guest_list_selected_page = 0; _window_guest_list_num_pages = 1; - + RCT2_GLOBAL(0x009AC7E0, uint8) = 0; RCT2_GLOBAL(0x009AC7F0, uint8) = 0; + rct_ride *ride; + if (type != 3) { // common for cases 0, 1, 2 + ride = GET_RIDE(index & 0x000000FF); + eax = ride->name; + edx = ride->name_arguments; + } + switch(type) { case 0: _window_guest_list_selected_filter = 0; - ebp = ebx & 0x000000FF; - - eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); - edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); - eax = (eax << 16) + 1435; - int ride_type = g_ride_list[ebp].type; - if ((RCT2_ADDRESS(0x97CF40, uint32)[ride_type * 8] & 0x400000) != 0) + if ((RCT2_GLOBAL(0x97CF40 + ride->type * 8, uint32) & 0x400000) != 0) eax++; RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; @@ -228,11 +229,6 @@ void window_guest_list_open_with_filter(int type, int ebx) case 1: _window_guest_list_selected_filter = 0; - ebp = ebx & 0x000000FF; - - eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); - edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); - eax = (eax << 16) + 1433; RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; @@ -245,11 +241,6 @@ void window_guest_list_open_with_filter(int type, int ebx) case 2: _window_guest_list_selected_filter = 1; - ebp = ebx & 0x000000FF; - - eax = RCT2_GLOBAL(0x1362942 + ebp * sizeof(rct_ride), uint16); - edx = RCT2_GLOBAL(0x1362942 + 2 + ebp * sizeof(rct_ride), uint32); - eax = (eax << 16) + 0xFFFF; RCT2_GLOBAL(0x00F1EDF6, uint32) = eax; @@ -262,9 +253,9 @@ void window_guest_list_open_with_filter(int type, int ebx) case 3: _window_guest_list_selected_filter = 1; - ebx = (ebx & 0x000000FF) + 1480; + index = (index & 0x000000FF) + 1480; - RCT2_GLOBAL(0x00F1EDF6, uint32) = ebx; + RCT2_GLOBAL(0x00F1EDF6, uint32) = index; RCT2_GLOBAL(0x00F1EDFA, uint32) = 0; _window_guest_list_highlighted_index = 0xFFFF;