From 2a41c031ac400915523739e5e0906d1d746e2e8e Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 25 Aug 2014 12:58:59 +0100 Subject: [PATCH 01/17] Added window_peep_event arrays. --- src/window_peep.c | 167 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 161 insertions(+), 6 deletions(-) diff --git a/src/window_peep.c b/src/window_peep.c index 8c7ef1601a..5906b1fb70 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -134,14 +134,169 @@ static void* window_peep_overview_events[] = { (void*)0x69707C }; +static void* window_peep_stats_events[] = { + window_peep_emptysub, + (void*) 0x0069744F, //mouse_up + (void*) 0x00697488, //resize + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x006974ED, + (void*) 0x0069746A, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x0069707D, //invalidate + (void*) 0x0069711D, //paint + window_peep_emptysub +}; + +static void* window_peep_rides_events[] = { + window_peep_emptysub, + (void*) 0x00697795, //mouse_up + (void*) 0x006978F4, //resize + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697959, + (void*) 0x006977B0, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x0069784E, + (void*) 0x006978CC, + window_peep_emptysub, + (void*) 0x0069789C, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697844, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x0069757A, //invalidate + (void*) 0x00697637, //paint + (void*) 0x006976FC +}; + +static void* window_peep_finance_events[] = { + window_peep_emptysub, + (void*) 0x00697BDD, //mouse_up + (void*) 0x00697C16, //resize + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697C7B, + (void*) 0x00697BF8, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697968, //invalidate + (void*) 0x00697A08, //paint + window_peep_emptysub +}; + +static void* window_peep_thoughts_events[] = { + window_peep_emptysub, + (void*) 0x00697E18, //mouse_up + (void*) 0x00697E33, //resize + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697ED2, + (void*) 0x00697EB4, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697C8A, //invalidate + (void*) 0x00697D2A, //paint + window_peep_emptysub +}; + +static void* window_peep_inventory_events[] = { + window_peep_emptysub, + (void*) 0x00698279, //mouse_up + (void*) 0x00698294, //resize + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00698333, + (void*) 0x00698315, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + window_peep_emptysub, + (void*) 0x00697EE1, //invalidate + (void*) 0x00697F81, //paint + window_peep_emptysub +}; + //0x981D24 void* window_peep_page_events[] = { window_peep_overview_events, - (void*)0x982468, - (void*)0x9824d8, - (void*)0x982548, - (void*)0x9825b8, - (void*)0x982628 + window_peep_stats_events, + window_peep_rides_events, + window_peep_finance_events, + window_peep_thoughts_events, + window_peep_inventory_events }; //0x981D3C @@ -537,4 +692,4 @@ void window_peep_overview_paint(){ if (w->viewport){ window_draw_viewport(dpi, w); } -} \ No newline at end of file +} From edd1651b4d87cd019f484600a9f8f914a669003e Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 25 Aug 2014 16:47:01 +0100 Subject: [PATCH 02/17] Added peep_stats_widgets --- src/window_peep.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/window_peep.c b/src/window_peep.c index 5906b1fb70..b393240a81 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -84,10 +84,24 @@ rct_widget window_peep_overview_widgets[] = { { WIDGETS_END }, }; +rct_widget window_peep_stats_widgets[] = { + {WWT_FRAME, 0, 0,191,0,156,-1,-1}, + {WWT_CAPTION, 0, 1,190,1,14,865,829}, + {WWT_CLOSEBOX, 0, 179,189,2,13,824,828}, + {WWT_RESIZE, 1, 0,191,43,156,-1,-1}, + {WWT_TAB, 1, 3,33,17,43,0x2000144E,1938}, + {WWT_TAB, 1, 34,64,17,43,0x2000144E,1940}, + {WWT_TAB, 1, 65,95,17,43,0x2000144E,1941}, + {WWT_TAB, 1, 96,126,17,43,0x2000144E,1942}, + {WWT_TAB, 1, 127,157,17,43,0x2000144E,1943}, + {WWT_TAB, 1, 158,188,17,43,0x2000144E,1944}, + {WIDGETS_END}, +} + //0x981D0C rct_widget *window_peep_page_widgets[] = { window_peep_overview_widgets, - (rct_widget *)0x9AC45C, + window_peep_stats_widgets, (rct_widget *)0x9ac500, (rct_widget *)0x9ac5b4, (rct_widget *)0x9ac658, From dffd689ee6a3479aa48f5aec3e971eb38b939c4a Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 25 Aug 2014 19:31:53 +0100 Subject: [PATCH 03/17] Added more to window_peep overview paint Moved get_arguments_from_thought to peep.c and added to peep.h Fixed possible crash in viewport_update_position Fixed compile error --- src/peep.c | 38 ++++++++++++++++++++ src/peep.h | 1 + src/viewport.c | 2 +- src/window.h | 2 +- src/window_guest_list.c | 40 +-------------------- src/window_peep.c | 77 ++++++++++++++++++++++++++++++++++------- 6 files changed, 106 insertions(+), 54 deletions(-) diff --git a/src/peep.c b/src/peep.c index caf4016fde..ea85a117e4 100644 --- a/src/peep.c +++ b/src/peep.c @@ -542,6 +542,44 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum } +/** +* rct2: 0x00698342 +* thought.item (eax) +* thought.type (ebx) +* argument_1 (esi & ebx) +* argument_2 (esi+2) +*/ +void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, uint32* argument_2){ + int esi = 0x9AC86C; + + if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 1){ + rct_ride* ride = &g_ride_list[thought.item]; + esi = (int)(&(ride->var_04A)); + } + else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 2){ + if (thought.item < 0x20){ + RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM_START; + } + else{ + RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM2_START; + } + } + else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 4){ + if (thought.item < 0x20){ + RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM_SINGULAR_START; + } + else + { + RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM2_SINGULAR_START; + } + } + else{ + esi = 0x9AC864; //No thought? + } + *argument_1 = ((thought.type + STR_THOUGHT_START) & 0xFFFF) | (*((uint16*)esi) << 16); + *argument_2 = *((uint32*)(esi + 2)); //Always 0 apart from on rides? +} + /** * rct2: 0x00698827 * returns 1 on pickup (CF not set) diff --git a/src/peep.h b/src/peep.h index 0ee2dc1d6d..3f18e5d587 100644 --- a/src/peep.h +++ b/src/peep.h @@ -444,5 +444,6 @@ void peep_update_crowd_noise(); void peep_applause(); rct_peep *peep_generate(int x, int y, int z); void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argument_2); +void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, uint32* argument_2); #endif diff --git a/src/viewport.c b/src/viewport.c index b5de1c435e..4697b57df3 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -280,7 +280,7 @@ void viewport_update_position(rct_window *window) if (window->viewport_target_sprite != -1){ rct_sprite* sprite = &g_sprite_list[window->viewport_target_sprite]; - int height = map_element_height(sprite->unknown.x, sprite->unknown.y) - 16; + int height = map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) - 16; int underground = sprite->unknown.z < height; RCT2_CALLPROC_X(0x6E7A15, sprite->unknown.x, sprite->unknown.y, sprite->unknown.z, underground, (int)window, (int)viewport, 0); diff --git a/src/window.h b/src/window.h index f2adce2696..d4a9cbb0af 100644 --- a/src/window.h +++ b/src/window.h @@ -203,7 +203,7 @@ typedef struct rct_window { sint16 page; // 0x48A sint16 var_48C; sint16 frame_no; // 0x48E updated every tic for motion in windows sprites - uint16 list_information_type; // 0x490 0 for none + uint16 list_information_type; // 0x490 0 for none, Used as current position of marquee in window_peep sint16 var_492; uint32 var_494; uint8 var_498[0x14]; diff --git a/src/window_guest_list.c b/src/window_guest_list.c index a5953114be..217e7ebb26 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -135,7 +135,7 @@ static void window_guest_list_find_groups(); static int get_guest_face_sprite_small(rct_peep *peep); static int get_guest_face_sprite_large(rct_peep *peep); static void get_arguments_from_peep(rct_peep *peep, uint32 *argument_1, uint32* argument_2); -void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, uint32* argument_2); + /** * * rct2: 0x006992E3 @@ -730,44 +730,6 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep) return 1; } -/** - * rct2: 0x00698342 - * thought.item (eax) - * thought.type (ebx) - * argument_1 (esi & ebx) - * argument_2 (esi+2) - */ -void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, uint32* argument_2){ - int esi = 0x9AC86C; - - if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 1){ - rct_ride* ride = &g_ride_list[thought.item]; - esi = (int)(&(ride->var_04A)); - } - else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 2){ - if (thought.item < 0x20){ - RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM_START; - } - else{ - RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM2_START; - } - } - else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 4){ - if (thought.item < 0x20){ - RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM_SINGULAR_START; - } - else - { - RCT2_GLOBAL(0x9AC86C, uint16) = thought.item + STR_ITEM2_SINGULAR_START; - } - } - else{ - esi = 0x9AC864; //No thought? - } - *argument_1 = ((thought.type + STR_THOUGHT_START) & 0xFFFF) | (*((uint16*)esi) << 16); - *argument_2 = *((uint32*)(esi+2)); //Always 0 apart from on rides? -} - /** * rct2:0x0069B7EA * Calculates a hash value (arguments) for comparing peep actions/thoughts diff --git a/src/window_peep.c b/src/window_peep.c index b393240a81..e6be343114 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -85,18 +85,18 @@ rct_widget window_peep_overview_widgets[] = { }; rct_widget window_peep_stats_widgets[] = { - {WWT_FRAME, 0, 0,191,0,156,-1,-1}, - {WWT_CAPTION, 0, 1,190,1,14,865,829}, - {WWT_CLOSEBOX, 0, 179,189,2,13,824,828}, - {WWT_RESIZE, 1, 0,191,43,156,-1,-1}, - {WWT_TAB, 1, 3,33,17,43,0x2000144E,1938}, - {WWT_TAB, 1, 34,64,17,43,0x2000144E,1940}, - {WWT_TAB, 1, 65,95,17,43,0x2000144E,1941}, - {WWT_TAB, 1, 96,126,17,43,0x2000144E,1942}, - {WWT_TAB, 1, 127,157,17,43,0x2000144E,1943}, - {WWT_TAB, 1, 158,188,17,43,0x2000144E,1944}, + {WWT_FRAME, 0, 0, 191, 0, 156, -1, STR_NONE}, + {WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP}, + {WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP}, + {WWT_RESIZE, 1, 0, 191, 43, 156, -1, STR_NONE}, + {WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938}, + {WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1940}, + {WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, + {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, + {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, + {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, {WIDGETS_END}, -} +}; //0x981D0C rct_widget *window_peep_page_widgets[] = { @@ -693,8 +693,8 @@ void window_peep_overview_paint(){ //rct_widget *labelWidget; window_paint_get_registers(w, dpi); - RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0); - return; + //RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0); + //return; window_draw_widgets(w, dpi); //6983dd @@ -703,7 +703,58 @@ void window_peep_overview_paint(){ //69861f //69869b //698661 + + // Draw the viewport no sound sprite if (w->viewport){ window_draw_viewport(dpi, w); + rct_viewport* viewport = w->viewport; + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON){ + gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->x + 2, w->y + 2, 0); + } } + + // Draw the centered label + uint32 argument1, argument2; + rct_peep* peep = GET_PEEP(w->number); + get_arguments_from_action(peep, &argument1, &argument2); + RCT2_GLOBAL(0x13CE952, uint32) = argument1; + RCT2_GLOBAL(0x13CE952 + 4, uint32) = argument2; + rct_widget* widget = &w->widgets[WIDX_ACTION_LBL]; + int x = (widget->left + widget->right) / 2 + w->x; + int y = w->y + widget->top - 1; + int width = widget->right - widget->left; + gfx_draw_string_centred_clipped(dpi, 1191, (void*)0x13CE952, 0, x, y, width); + + // Draw the marquee thought + widget = &w->widgets[WIDX_MARQUEE]; + width = widget->right - widget->left - 3; + int left = widget->left + 2 + w->x; + int top = widget->top + w->y; + int height = widget->bottom - widget->top; + rct_drawpixelinfo* dpi_marquee = clip_drawpixelinfo(dpi, left, width, top, height); + + if (!dpi_marquee)return; + int i = 0; + for (; i < PEEP_MAX_THOUGHTS; ++i){ + if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE){ + w->list_information_type = 0; + return; + } + if (peep->thoughts[i].var_2 == 1){ // If a fresh thought + break; + } + } + if (i == PEEP_MAX_THOUGHTS){ + w->list_information_type = 0; + return; + } + + get_arguments_from_thought(peep->thoughts[i], &argument1, &argument2); + + RCT2_GLOBAL(0x13CE952, uint32) = argument1; + RCT2_GLOBAL(0x13CE952 + 4, uint32) = argument2; + RCT2_GLOBAL(0x13CE952 + 8, uint16) = 0; + + x = widget->right - widget->left - w->list_information_type; + gfx_draw_string_left(dpi_marquee, 1193, (void*)0x13CE952, 0, x, 0); } From 217b5c12815195c7e747bca3b44b950a67b6d2b8 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 26 Aug 2014 12:30:06 +0100 Subject: [PATCH 04/17] Added remaining window_peep widgets. --- src/window_peep.c | 73 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/src/window_peep.c b/src/window_peep.c index e6be343114..b8c59ed308 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -58,7 +58,9 @@ enum WINDOW_PEEP_WIDGET_IDX { WIDX_PICKUP, WIDX_RENAME, WIDX_LOCATE, - WIDX_TRACK + WIDX_TRACK, + + WIDX_RIDE_SCROLL = 10 }; void window_peep_emptysub(){}; @@ -98,14 +100,71 @@ rct_widget window_peep_stats_widgets[] = { {WIDGETS_END}, }; +rct_widget window_peep_rides_widgets[] = { + {WWT_FRAME, 0, 0, 191, 0, 156, -1, STR_NONE}, + {WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP}, + {WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP}, + {WWT_RESIZE, 1, 0, 191, 43, 156, -1, STR_NONE}, + {WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938}, + {WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1940}, + {WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, + {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, + {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, + {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, + {WWT_SCROLL, 1, 3, 188, 57, 143, 2, STR_NONE}, + {WIDGETS_END}, +}; + +rct_widget window_peep_finance_widgets[] = { + {WWT_FRAME, 0, 0, 191, 0, 156, -1, STR_NONE}, + {WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP}, + {WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP}, + {WWT_RESIZE, 1, 0, 191, 43, 156, -1, STR_NONE}, + {WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938}, + {WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1940}, + {WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, + {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, + {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, + {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, + {WIDGETS_END}, +}; + +rct_widget window_peep_thoughts_widgets[] = { + {WWT_FRAME, 0, 0, 191, 0, 156, -1, STR_NONE}, + {WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP}, + {WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP}, + {WWT_RESIZE, 1, 0, 191, 43, 156, -1, STR_NONE}, + {WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938}, + {WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1940}, + {WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, + {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, + {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, + {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, + {WIDGETS_END}, +}; + +rct_widget window_peep_inventory_widgets[] = { + {WWT_FRAME, 0, 0, 191, 0, 156, -1, STR_NONE}, + {WWT_CAPTION, 0, 1, 190, 1, 14, 865, STR_WINDOW_TITLE_TIP}, + {WWT_CLOSEBOX, 0, 179, 189, 2, 13, 824, STR_CLOSE_WINDOW_TIP}, + {WWT_RESIZE, 1, 0, 191, 43, 156, -1, STR_NONE}, + {WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1938}, + {WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1940}, + {WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 1941}, + {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, + {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, + {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, + {WIDGETS_END}, +}; + //0x981D0C rct_widget *window_peep_page_widgets[] = { window_peep_overview_widgets, window_peep_stats_widgets, - (rct_widget *)0x9ac500, - (rct_widget *)0x9ac5b4, - (rct_widget *)0x9ac658, - (rct_widget *)0x9ac6FC + window_peep_rides_widgets, + window_peep_finance_widgets, + window_peep_thoughts_widgets, + window_peep_inventory_widgets }; void window_peep_set_page(rct_window* w, int page); @@ -341,8 +400,8 @@ uint32 window_peep_page_enabled_widgets[] = { (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_TAB_5) | - (1 << WIDX_TAB_6), //| - //(1 << WIDX_?), + (1 << WIDX_TAB_6) | + (1 << WIDX_RIDE_SCROLL), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | From 28056baf8d1d9fff66d089f58aae94fa11dfeb02 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 26 Aug 2014 13:10:36 +0100 Subject: [PATCH 05/17] Added window_peep_invalidate Not tested. --- src/window_peep.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/window_peep.c b/src/window_peep.c index b8c59ed308..4c1430c0ee 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -817,3 +817,62 @@ void window_peep_overview_paint(){ x = widget->right - widget->left - w->list_information_type; gfx_draw_string_left(dpi_marquee, 1193, (void*)0x13CE952, 0, x, 0); } + +/* rct2: 0x696749*/ +void window_peep_overview_invalidate(){ + rct_window* w; + window_invalidate_get_registers(w); + + if (window_peep_page_widgets[w->page] != w->widgets){ + w->widgets = window_peep_page_widgets[w->page]; + //call 6eaeb8 + } + + w->pressed_widgets &= ~(WIDX_TAB_1 | WIDX_TAB_2 |WIDX_TAB_3 |WIDX_TAB_4 |WIDX_TAB_5 |WIDX_TAB_6); + w->pressed_widgets |= 1 << (w->page + WIDX_TAB_1); + + rct_peep* peep = GET_PEEP(w->number); + RCT2_GLOBAL(0x13CE952,uint16) = peep->name_string_idx; + RCT2_GLOBAL(0x13CE954,uint32) = peep->id; + + w->pressed_widgets &= ~(1<flags & 0x8){ + w->pressed_widgets |= (1<width - 1; + cx = w->height - 1; + window_peep_overview_widgets[WIDX_BACKGROUND].right = ax; + window_peep_overview_widgets[WIDX_BACKGROUND].bottom = cx; + window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].right =ax; + window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].bottom = cx; + ax = w->width - 2; + window_peep_overview_widgets[WIDX_TITLE].right = ax; + ax = w->width - 13; + window_peep_overview_widgets[WIDX_CLOSE].left = ax; + ax = w->width - 3; + window_peep_overview_widgets[WIDX_CLOSE].rigth = ax; + ax = w->width - 26; + cx = w->height - 14; + window_peep_overview_widgets[WIDX_VIEWPORT].right = ax; + window_peep_overview_widgets[WIDX_VIEWPORT].bottom = cx; + cx = w->height - 12; + window_peep_overview_widgets[WIDX_ACTION_LBL].top = cx; + cx = w->height - 3; + window_peep_overview_widgets[WIDX_ACTION_LBL].bottom = cx; + ax = w->width - 24; + window_peep_overview_widgets[WIDX_ACTION_LBL].right = ax; + window_peep_overview_widgets[WIDX_MARQUEE].right = ax; + ax = w->width - 2; + window_peep_overview_widgets[WIDX_PICKUP].right = ax; + window_peep_overview_widgets[WIDX_RENAME].right = ax; + window_peep_overview_widgets[WIDX_LOCATE].right = ax; + window_peep_overview_widgets[WIDX_TRACK].right = ax; + ax = w->width - 25; + window_peep_overview_widgets[WIDX_PICKUP].left = ax; + window_peep_overview_widgets[WIDX_RENAME].left = ax; + window_peep_overview_widgets[WIDX_LOCATE].left = ax; + window_peep_overview_widgets[WIDX_TRACK].left = ax; + + //call 6987ed +} From 92279becc9f7cf3120d2510595e4c75c4581f3a6 Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 26 Aug 2014 16:09:38 +0100 Subject: [PATCH 06/17] Added missing call procs in peep invalidate. --- src/window_peep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window_peep.c b/src/window_peep.c index 4c1430c0ee..d1032e2668 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -825,7 +825,7 @@ void window_peep_overview_invalidate(){ if (window_peep_page_widgets[w->page] != w->widgets){ w->widgets = window_peep_page_widgets[w->page]; - //call 6eaeb8 + window_init_scroll_widgets(w); } w->pressed_widgets &= ~(WIDX_TAB_1 | WIDX_TAB_2 |WIDX_TAB_3 |WIDX_TAB_4 |WIDX_TAB_5 |WIDX_TAB_6); @@ -874,5 +874,5 @@ void window_peep_overview_invalidate(){ window_peep_overview_widgets[WIDX_LOCATE].left = ax; window_peep_overview_widgets[WIDX_TRACK].left = ax; - //call 6987ed + RCT2_CALLPROC_X(0x6987ED, 0, 0, 0, 0, (int)w, 0, 0); } From d3455b8f2239befcfdeda28444f26d4ef2a13bdf Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:14:52 +0100 Subject: [PATCH 07/17] cleaned up peep invalidate --- src/window_peep.c | 62 ++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/src/window_peep.c b/src/window_peep.c index d1032e2668..580edec207 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -840,39 +840,35 @@ void window_peep_overview_invalidate(){ w->pressed_widgets |= (1<width - 1; - cx = w->height - 1; - window_peep_overview_widgets[WIDX_BACKGROUND].right = ax; - window_peep_overview_widgets[WIDX_BACKGROUND].bottom = cx; - window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].right =ax; - window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].bottom = cx; - ax = w->width - 2; - window_peep_overview_widgets[WIDX_TITLE].right = ax; - ax = w->width - 13; - window_peep_overview_widgets[WIDX_CLOSE].left = ax; - ax = w->width - 3; - window_peep_overview_widgets[WIDX_CLOSE].rigth = ax; - ax = w->width - 26; - cx = w->height - 14; - window_peep_overview_widgets[WIDX_VIEWPORT].right = ax; - window_peep_overview_widgets[WIDX_VIEWPORT].bottom = cx; - cx = w->height - 12; - window_peep_overview_widgets[WIDX_ACTION_LBL].top = cx; - cx = w->height - 3; - window_peep_overview_widgets[WIDX_ACTION_LBL].bottom = cx; - ax = w->width - 24; - window_peep_overview_widgets[WIDX_ACTION_LBL].right = ax; - window_peep_overview_widgets[WIDX_MARQUEE].right = ax; - ax = w->width - 2; - window_peep_overview_widgets[WIDX_PICKUP].right = ax; - window_peep_overview_widgets[WIDX_RENAME].right = ax; - window_peep_overview_widgets[WIDX_LOCATE].right = ax; - window_peep_overview_widgets[WIDX_TRACK].right = ax; - ax = w->width - 25; - window_peep_overview_widgets[WIDX_PICKUP].left = ax; - window_peep_overview_widgets[WIDX_RENAME].left = ax; - window_peep_overview_widgets[WIDX_LOCATE].left = ax; - window_peep_overview_widgets[WIDX_TRACK].left = ax; + window_peep_overview_widgets[WIDX_BACKGROUND].right = w->width - 1; + window_peep_overview_widgets[WIDX_BACKGROUND].bottom = w->height - 1; + + window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].right =w->width - 1; + window_peep_overview_widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1; + + window_peep_overview_widgets[WIDX_TITLE].right = w->width - 2; + + window_peep_overview_widgets[WIDX_CLOSE].left = w->width - 13; + window_peep_overview_widgets[WIDX_CLOSE].rigth = w->width - 3; + + window_peep_overview_widgets[WIDX_VIEWPORT].right = w->width - 26; + window_peep_overview_widgets[WIDX_VIEWPORT].bottom = w->height - 14; + + window_peep_overview_widgets[WIDX_ACTION_LBL].top = w->height - 12; + window_peep_overview_widgets[WIDX_ACTION_LBL].bottom = w->height - 3; + window_peep_overview_widgets[WIDX_ACTION_LBL].right = w->width - 24; + + window_peep_overview_widgets[WIDX_MARQUEE].right = w->width - 24; + + window_peep_overview_widgets[WIDX_PICKUP].right = w->width - 2; + window_peep_overview_widgets[WIDX_RENAME].right = w->width - 2; + window_peep_overview_widgets[WIDX_LOCATE].right = w->width - 2; + window_peep_overview_widgets[WIDX_TRACK].right = w->width - 2; + + window_peep_overview_widgets[WIDX_PICKUP].left = w->width - 25; + window_peep_overview_widgets[WIDX_RENAME].left = w->width - 25; + window_peep_overview_widgets[WIDX_LOCATE].left = w->width - 25; + window_peep_overview_widgets[WIDX_TRACK].left = w->width - 25; RCT2_CALLPROC_X(0x6987ED, 0, 0, 0, 0, (int)w, 0, 0); } From 5bdff85db12f0f0ee3e351b9cfe22069cd29582a Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:34:47 +0100 Subject: [PATCH 08/17] Added window_align_tabs New cross window compatible version. For window_park and window_peep. --- src/window.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index da0de66626..8599f34975 100644 --- a/src/window.c +++ b/src/window.c @@ -1495,4 +1495,18 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rc " :[address] "+m" (address), [w] "+m" (w), [widget] "+m" (widget), [widgetIndex] "+m" (widgetIndex): : "eax", "esi", "edx", "edi" ); #endif -} \ No newline at end of file +} + +/* Based on rct2: 0x6987ED and another version from window_park */ +void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id ) + int x = w->widgets[start_tab_id].left; + int tab_width = w->widgets[start_tab_id].right - w->widgets[start_tab_id].left; + + for (int i = start_tab_id; i < end_tab_id; ++i){ + if ( !(w->disabled_widgets & (1LL << i)) ){ + w->widgets[i].left = x; + w->widgets[i].right = x + tab_width; + x += tab_width + 1; + } + } +} From b1a50459625b603aeab3bfeddfcc933e9a1def72 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:35:44 +0100 Subject: [PATCH 09/17] Added window_align_tabs --- src/window.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/window.h b/src/window.h index d4a9cbb0af..eda9d5e0e1 100644 --- a/src/window.h +++ b/src/window.h @@ -460,6 +460,8 @@ void window_guest_list_init_vars_a(); void window_guest_list_init_vars_b(); void window_bubble_list_item(rct_window* w, int item_position); +void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id ); + void window_new_ride_init_vars(); void window_staff_init_vars(); From 71090c4c6eecceff585760f8dacdaba76707959a Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:37:01 +0100 Subject: [PATCH 10/17] Now uses window_align_tabs --- src/window_peep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window_peep.c b/src/window_peep.c index 580edec207..b5d667a3be 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -870,5 +870,5 @@ void window_peep_overview_invalidate(){ window_peep_overview_widgets[WIDX_LOCATE].left = w->width - 25; window_peep_overview_widgets[WIDX_TRACK].left = w->width - 25; - RCT2_CALLPROC_X(0x6987ED, 0, 0, 0, 0, (int)w, 0, 0); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_6); } From e84a9606e302fbf199fb3cc53bd7b8df7da34b93 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:40:49 +0100 Subject: [PATCH 11/17] Added correct events to peep overview --- src/window_peep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/window_peep.c b/src/window_peep.c index b5d667a3be..c932526332 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -175,6 +175,7 @@ void window_peep_close(); void window_peep_resize(); void window_peep_overview_mouse_up(); void window_peep_overview_paint(); +void window_peep_overview_invalidate(); static void* window_peep_overview_events[] = { window_peep_close, @@ -202,9 +203,9 @@ static void* window_peep_overview_events[] = { window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, - (void*)0x696749, //Invalidate + window_peep_overview_invalidate, //Invalidate window_peep_overview_paint, //Paint - (void*)0x69707C + window_peep_emptysub }; static void* window_peep_stats_events[] = { From ba2e8f4942e7ab6edbe8d92d06b5fdb8ef1ea671 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 12:48:29 +0100 Subject: [PATCH 12/17] Added viewport_init_wrapper for event --- src/window_peep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/window_peep.c b/src/window_peep.c index c932526332..4ff895b367 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -176,6 +176,7 @@ void window_peep_resize(); void window_peep_overview_mouse_up(); void window_peep_overview_paint(); void window_peep_overview_invalidate(); +void window_peep_overview_viewport_init_wrapper(); static void* window_peep_overview_events[] = { window_peep_close, @@ -198,7 +199,7 @@ static void* window_peep_overview_events[] = { window_peep_emptysub, window_peep_emptysub, (void*)0x696A6A, - (void*)0x697076, + window_peep_overview_viewport_init_wrapper, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, @@ -644,6 +645,13 @@ void window_peep_set_page(rct_window* w, int page){ if (listen && w->viewport) w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } +void window_peep_overview_viewport_init_wrapper(){ + rct_window* w; + window_get_register(w); + + window_peep_viewport_init(w); +} + /* rct2: 0x0069883C */ void window_peep_viewport_init(rct_window* w){ if (w->page != WINDOW_PEEP_OVERVIEW) return; From 6573dbba4e9f6a8abdcae55a8f6d0eeb9d5c1e71 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 27 Aug 2014 16:49:31 +0100 Subject: [PATCH 13/17] Added start of window_peep_overview_tab_paint Will not compile at present. --- src/window_peep.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/window_peep.c b/src/window_peep.c index 4ff895b367..ab9a1b8823 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -881,3 +881,46 @@ void window_peep_overview_invalidate(){ window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_6); } + +void window_peep_overview_tab_paint( rct_window* w, rct_drawpixelinfo* dpi){ + + if ( w->disabled_widgets & (1ULL<widgets[WIDX_TAB_1].left + 1 + w->x; + //cx + int y = w->widgets[WIDX_TAB_1].top + 1 + w->y; + //bx + int width = w->widgets[WIDX_TAB_1].right - 1 - w->widgets[WIDX_TAB_1].left; + //dx + int height = w->widgets[WIDX_TAB_1].bottom - 1 - w->widgets[WIDX_TAB_1].top; + + if (w->page == WINDOW_PEEP_OVERVIEW){ + height++; + } + + rct_drawpixelinfo* cliped_dpi = clip_drawpixelinfo( dpi, x, width, y, height ); + + if (!cliped_dpi) return; + + int cx = 14; + int dx = 20; + + //ebp + rct_peep* peep = GET_PEEP(w->number); + + + if (peep->type == 1 && peep->staff_type == 3) + dx++; + eax = RCT2_GLOBAL(peep->sprite_type*8 + 0x982708, uint32); + ebx = *eax; + ebx++; + eax = 0; + + if (w->page == WINDOW_PEEP_OVERVIEW){ + ax = w->var_496; + ax &= ~((1<<0)|(1<<1)); + } + ebx += eax; + //698474 +} From 03d75b51b2b99fae7d02576af95cf9bdec1d4532 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Thu, 28 Aug 2014 06:58:57 +0100 Subject: [PATCH 14/17] fix compile mistakes --- src/gfx.c | 4 ++-- src/window.c | 1 + src/window_peep.c | 24 +++++++++++------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/gfx.c b/src/gfx.c index 6e771560a4..fae14f1a7e 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -2276,7 +2276,7 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt } int stickOutWidth = newDrawPixelInfo->x + newDrawPixelInfo->width - right; - if (stickOutWidth < 0) { + if (stickOutWidth > 0) { newDrawPixelInfo->width -= stickOutWidth; newDrawPixelInfo->pitch += stickOutWidth; } @@ -2290,7 +2290,7 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt } int bp = newDrawPixelInfo->y + newDrawPixelInfo->height - bottom; - if (bp < 0) { + if (bp > 0) { newDrawPixelInfo->height -= bp; } diff --git a/src/window.c b/src/window.c index 8599f34975..27429674d7 100644 --- a/src/window.c +++ b/src/window.c @@ -1499,6 +1499,7 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rc /* Based on rct2: 0x6987ED and another version from window_park */ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id ) +{ int x = w->widgets[start_tab_id].left; int tab_width = w->widgets[start_tab_id].right - w->widgets[start_tab_id].left; diff --git a/src/window_peep.c b/src/window_peep.c index ab9a1b8823..8d154f4e74 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -79,8 +79,8 @@ rct_widget window_peep_overview_widgets[] = { { WWT_12, 1, 3, 166, 45, 56, 0x0FFFFFFFF, STR_NONE}, // Label Thought marquee { WWT_VIEWPORT, 1, 3, 166, 57, 143, 0x0FFFFFFFF, STR_NONE }, // Viewport { WWT_12, 1, 3, 166, 144, 154, 0x0FFFFFFFF, STR_NONE}, // Label Action - { WWT_FLATBTN, 1, 167, 190, 45, 68, SPR_RENAME, 1706}, // Pickup Button - { WWT_FLATBTN, 1, 167, 190, 69, 92, 0x1430, 1055}, // Rename Button + { WWT_FLATBTN, 1, 167, 190, 45, 68, 0x1436, 1706}, // Pickup Button + { WWT_FLATBTN, 1, 167, 190, 69, 92, SPR_RENAME, 1055}, // Rename Button { WWT_FLATBTN, 1, 167, 190, 93, 116, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP},// Locate Button { WWT_FLATBTN, 1, 167, 190, 117, 140, SPR_TRACK_PEEP, 1930}, // Track Button { WIDGETS_END }, @@ -111,7 +111,7 @@ rct_widget window_peep_rides_widgets[] = { {WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 1942}, {WWT_TAB, 1, 127, 157, 17, 43, 0x2000144E, 1943}, {WWT_TAB, 1, 158, 188, 17, 43, 0x2000144E, 1944}, - {WWT_SCROLL, 1, 3, 188, 57, 143, 2, STR_NONE}, + {WWT_SCROLL, 1, 3, 188, 57, 143, 2, STR_NONE}, {WIDGETS_END}, }; @@ -570,7 +570,6 @@ void window_peep_overview_mouse_up(){ window_peep_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_PICKUP: - //696ba6 if (!peep_can_be_picked_up(peep)) { return; } @@ -590,7 +589,6 @@ void window_peep_overview_mouse_up(){ RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); break; case WIDX_RENAME: - //696e4d window_show_textinput(w, (int)widgetIndex, 0x5AC, 0x5AD, peep->name_string_idx); break; case WIDX_LOCATE: @@ -761,8 +759,8 @@ void window_peep_overview_paint(){ //rct_widget *labelWidget; window_paint_get_registers(w, dpi); - //RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0); - //return; + RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0); + return; window_draw_widgets(w, dpi); //6983dd @@ -830,7 +828,7 @@ void window_peep_overview_paint(){ /* rct2: 0x696749*/ void window_peep_overview_invalidate(){ rct_window* w; - window_invalidate_get_registers(w); + window_get_register(w); if (window_peep_page_widgets[w->page] != w->widgets){ w->widgets = window_peep_page_widgets[w->page]; @@ -838,7 +836,7 @@ void window_peep_overview_invalidate(){ } w->pressed_widgets &= ~(WIDX_TAB_1 | WIDX_TAB_2 |WIDX_TAB_3 |WIDX_TAB_4 |WIDX_TAB_5 |WIDX_TAB_6); - w->pressed_widgets |= 1 << (w->page + WIDX_TAB_1); + w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); rct_peep* peep = GET_PEEP(w->number); RCT2_GLOBAL(0x13CE952,uint16) = peep->name_string_idx; @@ -858,7 +856,7 @@ void window_peep_overview_invalidate(){ window_peep_overview_widgets[WIDX_TITLE].right = w->width - 2; window_peep_overview_widgets[WIDX_CLOSE].left = w->width - 13; - window_peep_overview_widgets[WIDX_CLOSE].rigth = w->width - 3; + window_peep_overview_widgets[WIDX_CLOSE].right = w->width - 3; window_peep_overview_widgets[WIDX_VIEWPORT].right = w->width - 26; window_peep_overview_widgets[WIDX_VIEWPORT].bottom = w->height - 14; @@ -912,13 +910,13 @@ void window_peep_overview_tab_paint( rct_window* w, rct_drawpixelinfo* dpi){ if (peep->type == 1 && peep->staff_type == 3) dx++; - eax = RCT2_GLOBAL(peep->sprite_type*8 + 0x982708, uint32); - ebx = *eax; + int eax = RCT2_GLOBAL(peep->sprite_type*8 + 0x982708, uint32); + int ebx = *(uint32*)eax; ebx++; eax = 0; if (w->page == WINDOW_PEEP_OVERVIEW){ - ax = w->var_496; + int ax = *((uint16*)w + 496 / 2); ax &= ~((1<<0)|(1<<1)); } ebx += eax; From 6f14e48a330ccff726fcc88d1ae8e62a70c87e02 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Thu, 28 Aug 2014 07:04:02 +0100 Subject: [PATCH 15/17] Switched window_park_align tabs to new window version --- src/window_park.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/window_park.c b/src/window_park.c index 39b982ae1b..58929e5366 100644 --- a/src/window_park.c +++ b/src/window_park.c @@ -576,7 +576,6 @@ static uint32 window_park_page_enabled_widgets[] = { static void window_park_init_viewport(rct_window *w); static void window_park_set_page(rct_window *w, int page); static void window_park_anchor_border_widgets(rct_window *w); -static void window_park_align_tabs(rct_window *w); static void window_park_set_pressed_tab(rct_window *w); static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); @@ -916,7 +915,7 @@ static void window_park_entrance_invalidate() if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_GUESTS_AND_RATING) w->disabled_widgets |= (1 << WIDX_OPEN_OR_CLOSE); - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); // Anchor entrance page specific widgets @@ -1149,7 +1148,7 @@ static void window_park_rating_invalidate() RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16); RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32); - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1284,7 +1283,7 @@ static void window_park_guests_invalidate() RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16); RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32); - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1434,7 +1433,7 @@ static void window_park_price_invalidate() RCT2_GLOBAL(0x013CE952 + 6, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16); window_park_price_widgets[WIDX_PRICE].image = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) == 0 ? STR_FREE : 1429; - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1543,7 +1542,7 @@ static void window_park_stats_invalidate() RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16); RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32); - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1705,7 +1704,7 @@ static void window_park_objective_invalidate() else window_park_objective_widgets[WIDX_ENTER_NAME].type = WWT_EMPTY; - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1852,7 +1851,7 @@ static void window_park_awards_invalidate() RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16); RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32); - window_park_align_tabs(w); + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); } @@ -1945,21 +1944,6 @@ static void window_park_anchor_border_widgets(rct_window *w) w->widgets[WIDX_CLOSE].right = w->width - 3; } -static void window_park_align_tabs(rct_window *w) -{ - int i, x, tab_width; - - x = w->widgets[WIDX_TAB_1].left; - tab_width = w->widgets[WIDX_TAB_1].right - w->widgets[WIDX_TAB_1].left; - for (i = 0; i < 7; i++) { - if (w->disabled_widgets & (1LL << (WIDX_TAB_1 + i))) - continue; - w->widgets[WIDX_TAB_1 + i].left = x; - w->widgets[WIDX_TAB_1 + i].right = x + tab_width; - x += tab_width + 1; - } -} - static void window_park_set_pressed_tab(rct_window *w) { int i; From b6f98167c4b97a4b32bf1dcf6100be1ea318c05f Mon Sep 17 00:00:00 2001 From: adrian17 Date: Thu, 28 Aug 2014 17:27:48 +0200 Subject: [PATCH 16/17] Use macros from addresses.h --- src/audio.c | 4 ++-- src/park.c | 2 +- src/scenario.c | 2 +- src/window_new_campaign.c | 2 +- src/window_new_ride.c | 16 ++++++++-------- src/window_research.c | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/audio.c b/src/audio.c index 6fe7726f63..470862fc9a 100644 --- a/src/audio.c +++ b/src/audio.c @@ -282,7 +282,7 @@ int dsound_create_primary_buffer(int a, int device, int channels, int samples, i } WAVEFORMATEX waveformat1, waveformat2; RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->GetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &waveformat1, sizeof(WAVEFORMATEX), 0); - RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->SetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &RCT2_GLOBAL(0x01425B40, WAVEFORMATEX)); + RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->SetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &RCT2_GLOBAL(RCT2_ADDRESS_AUDIO_INFO, WAVEFORMATEX)); RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->GetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &waveformat2, sizeof(WAVEFORMATEX), 0); return 1; } @@ -683,7 +683,7 @@ int sound_play_panned(int sound_id, int x) } RCT2_GLOBAL(0x014241BC, uint32) = 1; - sound_prepare(sound_id, &other_sound->sound, 1, RCT2_GLOBAL(0x009AAC6E, uint32)); + sound_prepare(sound_id, &other_sound->sound, 1, RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint32)); RCT2_GLOBAL(0x014241BC, uint32) = 0; RCT2_GLOBAL(0x014241BC, uint32) = 1; result = sound_play(&other_sound->sound, 0, volume, pan, 0); diff --git a/src/park.c b/src/park.c index 1779458712..159017c392 100644 --- a/src/park.c +++ b/src/park.c @@ -90,7 +90,7 @@ void park_init() RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) = -1; RCT2_GLOBAL(0x013573F8, sint16) = -1; - RCT2_GLOBAL(0x01357CF2, uint16) = 127; + RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per guest (average) diff --git a/src/scenario.c b/src/scenario.c index a2884a39d0..406179dbaa 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -139,7 +139,7 @@ void scenario_load(const char *path) sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_CURRENT_PARK_RATING); // Read ? - sawyercoding_read_chunk(file, (uint8*)0x01357CF2); + sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES); // Read ? sawyercoding_read_chunk(file, (uint8*)0x0135832C); diff --git a/src/window_new_campaign.c b/src/window_new_campaign.c index 16cd807000..efe6ad5afd 100644 --- a/src/window_new_campaign.c +++ b/src/window_new_campaign.c @@ -174,7 +174,7 @@ void window_new_campaign_open(sint16 campaignType) numApplicableRides = 0; window_new_campaign_rides[0] = 255; FOR_ALL_RIDES(i, ride) { - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x03820000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x03820000)) window_new_campaign_rides[numApplicableRides++] = i; } window_new_campaign_rides[numApplicableRides] = 255; diff --git a/src/window_new_ride.c b/src/window_new_ride.c index 296aea59ce..f744a63c24 100644 --- a/src/window_new_ride.c +++ b/src/window_new_ride.c @@ -29,7 +29,7 @@ #include "widget.h" #include "window.h" -#define _window_new_ride_current_tab RCT2_GLOBAL(0x00F43824, uint8) +#define _window_new_ride_current_tab RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) typedef struct { uint8 type; @@ -374,7 +374,7 @@ static void window_new_ride_scroll_to_focused_ride(rct_window *w) // Find row index of the focused ride type rct_widget *listWidget = &window_new_ride_widgets[WIDX_RIDE_LIST]; - int focusRideType = RCT2_ADDRESS(0x00F43825, uint16)[_window_new_ride_current_tab]; + int focusRideType = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[_window_new_ride_current_tab]; int count = 0, row = 0; ride_list_item *listItem = (ride_list_item*)0x00F43523; while (listItem->type != 255 || listItem->entry_index != 255) { @@ -436,7 +436,7 @@ void window_new_ride_open() window_new_ride_populate_list(); - w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[_window_new_ride_current_tab]; + w->new_ride.highlighted_ride_id = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, sint16)[_window_new_ride_current_tab]; if (w->new_ride.highlighted_ride_id == -1) w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16); @@ -579,7 +579,7 @@ static void window_new_ride_mousedown(int widgetIndex, rct_window *w, rct_widget w->new_ride.selected_ride_countdown = -1; window_new_ride_populate_list(); if (page < WINDOW_NEW_RIDE_PAGE_RESEARCH) { - w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[page]; + w->new_ride.highlighted_ride_id = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, sint16)[page]; if (w->new_ride.highlighted_ride_id == -1) w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16); } @@ -654,7 +654,7 @@ static void window_new_ride_scrollmousedown() if (item.type == 255 && item.entry_index == 255) return; - RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item; + RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item; w->new_ride.selected_ride_id = *((sint16*)&item); sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2)); @@ -683,7 +683,7 @@ static void window_new_ride_scrollmouseover() return; w->new_ride.highlighted_ride_id = *((sint16*)&item); - RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item; + RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item; window_invalidate(w); } @@ -715,7 +715,7 @@ static void window_new_ride_invalidate() if (_window_new_ride_current_tab == WINDOW_NEW_RIDE_PAGE_RESEARCH) { window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_EMPTY; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_FLATBTN; window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].image = typeId >= 0x10000 ? 5189 : 5191; @@ -790,7 +790,7 @@ static void window_new_ride_paint() x = w->x + 10; y = w->y + window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_GROUP].top + 12; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*); diff --git a/src/window_research.c b/src/window_research.c index 0417db1afa..b65fc7dba4 100644 --- a/src/window_research.c +++ b/src/window_research.c @@ -310,7 +310,7 @@ static void window_research_development_invalidate() window_research_set_pressed_tab(w); window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_EMPTY; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_FLATBTN; window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].image = typeId >= 0x10000 ? 5189 : 5191; @@ -377,7 +377,7 @@ static void window_research_development_paint() x = w->x + 10; y = w->y + window_research_development_widgets[WIDX_LAST_DEVELOPMENT_GROUP].top + 12; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); int lastDevelopmentFormat; if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { From 563e0ca3dcee57ec297f69883bd567473bff640b Mon Sep 17 00:00:00 2001 From: adrian17 Date: Thu, 28 Aug 2014 20:14:00 +0200 Subject: [PATCH 17/17] Fix wrong condition in audio.c --- src/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio.c b/src/audio.c index 470862fc9a..678938e21c 100644 --- a/src/audio.c +++ b/src/audio.c @@ -435,7 +435,7 @@ void audio_init2(int device) } } } - if (!RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4)) { RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint32) = RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B78, uint32) || RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B7C, uint32); RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= 1 << 4; config_save();