From d68e716cd8882ad7af59ce4b7c226eae0cef22fa Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 23 Jul 2014 18:07:38 +0100 Subject: [PATCH] Removed compile errors. Implemented changes to window.h --- src/game.c | 17 +++-- src/gfx.c | 2 +- src/peep.c | 2 +- src/scenario.c | 2 +- src/title.c | 2 +- src/viewport.c | 4 +- src/window.c | 15 +++- src/window.h | 15 ++-- src/window_cheats.c | 11 +-- src/window_finances.c | 8 +-- src/window_game_bottom_toolbar.c | 4 +- src/window_guest_list.c | 17 +++-- src/window_map.c | 6 +- src/window_park.c | 38 +++++----- src/window_peep.c | 36 +++++----- src/window_ride_list.c | 115 +++++++++++++------------------ src/window_tooltip.c | 2 +- 17 files changed, 145 insertions(+), 151 deletions(-) diff --git a/src/game.c b/src/game.c index ce110e6ed8..378b274cd0 100644 --- a/src/game.c +++ b/src/game.c @@ -110,7 +110,8 @@ void draw_rain_window(rct_window* original_w, short left, short right, short top for (; ; w++) { if (w >= newWindow) { // Loop ended, draw rain for original_w - return call_draw_rain_func(original_w, left, right, top, bottom, draw_rain_func); + call_draw_rain_func(original_w, left, right, top, bottom, draw_rain_func); + return; } if (right <= w->x || bottom <= w->y) { @@ -128,7 +129,8 @@ void draw_rain_window(rct_window* original_w, short left, short right, short top draw_rain_window(original_w, left, w->x, top, bottom, draw_rain_func); left = w->x; - return draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + return; } sint16 w_right = RCT_WINDOW_RIGHT(w); @@ -136,14 +138,16 @@ void draw_rain_window(rct_window* original_w, short left, short right, short top draw_rain_window(original_w, left, w_right, top, bottom, draw_rain_func); left = w_right; - return draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + return; } if (top < w->y) { draw_rain_window(original_w, left, right, top, w->y, draw_rain_func); top = w->y; - return draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + return; } sint16 w_bottom = RCT_WINDOW_BOTTOM(w); @@ -151,7 +155,8 @@ void draw_rain_window(rct_window* original_w, short left, short right, short top draw_rain_window(original_w, left, right, top, w_bottom, draw_rain_func); top = w_bottom; - return draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + draw_rain_window(original_w, left, right, top, bottom, draw_rain_func); + return; } } @@ -2146,7 +2151,7 @@ int game_load_save() game_create_windows(); mainWindow = window_get_main(); - mainWindow->var_4B0 = -1; + mainWindow->viewport_target_sprite = -1; mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16); mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16); uint8 _cl = (RCT2_GLOBAL(0x0138869E, sint16) & 0xFF) - mainWindow->viewport->zoom; diff --git a/src/gfx.c b/src/gfx.c index 3b9e330fe2..1881ebf816 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1971,7 +1971,7 @@ void colour_char_window(uint8 colour, uint16* current_font_flags,uint8* palette_ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y) { - int eax, ebx, ecx, ebp; + int eax, ebx, ebp; rct_g1_element* g1_element; // Maximum length/height of string diff --git a/src/peep.c b/src/peep.c index 00dd073ff1..78f46ccd99 100644 --- a/src/peep.c +++ b/src/peep.c @@ -345,7 +345,7 @@ void peep_update_crowd_noise() // Check if crowd noise is already playing if (RCT2_GLOBAL(0x009AF5FC, uint32) == 1) { // Load and play crowd noise - if (RCT2_CALLFUNC_3(0x0040194E, int, int, char*, int, 2, get_file_path(PATH_ID_CSS2), 0)) { + if (RCT2_CALLFUNC_3(0x0040194E, int, int, char*, int, 2, (char*)get_file_path(PATH_ID_CSS2), 0)) { RCT2_CALLPROC_5(0x00401999, int, int, int, int, int, 2, 1, volume, 0, 0); RCT2_GLOBAL(0x009AF5FC, uint32) = volume; } diff --git a/src/scenario.c b/src/scenario.c index 7ac5a2b486..255fe5855f 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -193,7 +193,7 @@ void scenario_load_and_play(const rct_scenario_basic *scenario) game_create_windows(); mainWindow = window_get_main(); - mainWindow->var_4B0 = -1; + mainWindow->viewport_target_sprite = -1; mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16); mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16); diff --git a/src/title.c b/src/title.c index bd318a3688..79a6aae429 100644 --- a/src/title.c +++ b/src/title.c @@ -170,7 +170,7 @@ static void title_update_showcase() scenario_load(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN)); w = window_get_main(); - w->var_4B0 = -1; + w->viewport_target_sprite = -1; w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16); w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16); diff --git a/src/viewport.c b/src/viewport.c index d967b86f88..51929d269c 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -155,7 +155,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo if (edx & (1 << 31)){ edx &= 0xFFFF; - w->var_4B0 = edx; + w->viewport_target_sprite = edx; rct_sprite* sprite = &g_sprite_list[edx]; center_x = sprite->unknown.x; center_y = sprite->unknown.y; @@ -165,7 +165,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo center_x = edx & 0xFFFF; center_y = edx >> 16; center_z = ecx >> 16; - w->var_4B0 = SPR_NONE; + w->viewport_target_sprite = SPR_NONE; } int view_x, view_y; diff --git a/src/window.c b/src/window.c index 8f20d76dc6..7708cf7add 100644 --- a/src/window.c +++ b/src/window.c @@ -399,8 +399,8 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han w->var_488 = 0; w->page = 0; w->var_48C = 0; - w->var_48E = 0; - w->var_490 = 0; + w->frame_no = 0; + w->list_information_type = 0; w->var_492 = 0; w->selected_tab = 0; w->var_4AE = 0; @@ -1281,3 +1281,14 @@ void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event) { RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, (int)w, 0, 0); } + +/** + * rct2: New function not from rct2 + * Bubbles an item one position up in the window list. + * This is done by swapping the two locations. + */ +void window_bubble_list_item(rct_window* w, int item_position){ + char swap = w->list_item_positions[item_position]; + w->list_item_positions[item_position] = w->list_item_positions[item_position + 1]; + w->list_item_positions[item_position + 1] = swap; +} \ No newline at end of file diff --git a/src/window.h b/src/window.h index 30071632ba..8049e3c6d2 100644 --- a/src/window.h +++ b/src/window.h @@ -116,10 +116,10 @@ typedef struct rct_window { rct_windownumber number; // 0x03C uint16 flags; // 0x03E rct_scroll scrolls[3]; // 0x040 - uint8 list_item_positions[1024]; // 0x076 - uint16 no_list_items; // 0x476 0 for no items + uint8 list_item_positions[1024];// 0x076 + uint16 no_list_items; // 0x476 0 for no items sint16 pad_478; - sint16 selected_list_item; // 0x47A -1 for none selected + sint16 selected_list_item; // 0x47A -1 for none selected sint16 pad_47C; sint16 pad_47E; sint16 var_480; @@ -127,16 +127,16 @@ typedef struct rct_window { sint16 var_484; // viewport target y sint16 var_486; // viewport target z sint16 var_488; // viewport rotation << 8 - sint16 page; // 0x48A + 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 + sint16 frame_no; // 0x48E updated every tic for motion in windows sprites + uint16 list_information_type; // 0x490 0 for none sint16 var_492; uint32 var_494; uint8 var_498[0x14]; sint16 selected_tab; // 0x4AC sint16 var_4AE; - sint16 viewport_target_sprite; // viewport target sprite? + sint16 viewport_target_sprite; // 0x4B0 viewport target sprite? sint16 saved_view_x; // 0x4B2 sint16 saved_view_y; // 0x4B4 rct_windowclass classification; // 0x4B6 @@ -374,6 +374,7 @@ void window_cheats_open(); 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_new_ride_init_vars(); diff --git a/src/window_cheats.c b/src/window_cheats.c index af04c840a8..45e3fb8db7 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -361,8 +361,6 @@ static void window_cheats_misc_mouseup() { short widgetIndex; rct_window *w; - int i; - rct_ride *ride; #ifdef _MSC_VER __asm mov widgetIndex, dx #else @@ -375,9 +373,6 @@ static void window_cheats_misc_mouseup() __asm__ ( "mov %[w], esi " : [w] "+m" (w) ); #endif - rct_peep* peep; - uint16 spriteIndex; - switch (widgetIndex) { case WIDX_CLOSE: window_close(w); @@ -417,7 +412,7 @@ static void window_cheats_update(rct_window *w) __asm__ ( "mov %[w2], esi " : [w2] "+m" (w2) ); #endif - w->var_48E++; + w->frame_no++; widget_invalidate(w->classification, w->number, WIDX_TAB_1+w->page); } @@ -512,7 +507,7 @@ static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_1))) { sprite_idx = 5261; if (w->page == WINDOW_CHEATS_PAGE_MONEY) - sprite_idx += (w->var_48E / 2) % 8; + sprite_idx += (w->frame_no / 2) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_1].left, w->y + w->widgets[WIDX_TAB_1].top); } @@ -520,7 +515,7 @@ static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_2))) { sprite_idx = 5568; if (w->page == WINDOW_CHEATS_PAGE_GUESTS) - sprite_idx += (w->var_48E / 3) % 8; + sprite_idx += (w->frame_no / 3) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_2].left, w->y + w->widgets[WIDX_TAB_2].top); } diff --git a/src/window_finances.c b/src/window_finances.c index 335635385e..6d5d146f61 100644 --- a/src/window_finances.c +++ b/src/window_finances.c @@ -291,7 +291,7 @@ void window_finances_open() w->enabled_widgets = 0x1BF4; w->number = 0; w->page = 0; - w->var_48E = 0; + w->frame_no = 0; w->disabled_widgets = 0; w->colours[0] = 1; w->colours[1] = 19; @@ -350,8 +350,8 @@ static void window_finances_summary_mouseup() static void window_finances_summary_update(rct_window *w) { // Tab animation - if (++w->var_48E >= window_finances_tab_animation_loops[w->page]) - w->var_48E = 0; + if (++w->frame_no >= window_finances_tab_animation_loops[w->page]) + w->frame_no = 0; widget_invalidate(w->classification, w->number, WIDX_TAB_1); } @@ -389,7 +389,7 @@ static void window_finances_summary_invalidate() static void window_finances_set_page(rct_window *w, int page) { w->page = page; - w->var_48E = 0; + w->frame_no = 0; if (w->viewport != NULL) { w->viewport->width = 0; w->viewport = NULL; diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index 79d2a2f83d..57479079c9 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -138,7 +138,7 @@ void window_game_bottom_toolbar_open() (1 << WIDX_RIGHT_OUTSET) | (1 << WIDX_DATE); - window->var_48E = 0; + window->frame_no = 0; window_init_scroll_widgets(window); window->colours[0] = 140; window->colours[1] = 140; @@ -653,7 +653,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc // y += 3; //_eax = *((int*)(0x00982708 + (peep->sprite_type * 8))); - //_ebx = w->var_48E & 0xFFFFFFFC; + //_ebx = w->frame_no & 0xFFFFFFFC; //_ebx += *((int*)_eax); //_ebx++; diff --git a/src/window_guest_list.c b/src/window_guest_list.c index e1a71208ab..8573386df3 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -164,7 +164,7 @@ void window_guest_list_open() window_init_scroll_widgets(window); _window_guest_list_highlighted_index = -1; - window->var_490 = 0; + window->list_information_type = 0; _window_guest_list_selected_tab = PAGE_INDIVIDUAL; _window_guest_list_selected_filter = -1; _window_guest_list_selected_page = 0; @@ -259,7 +259,7 @@ static void window_guest_list_mousedown(int widgetIndex, rct_window*w, rct_widge _window_guest_list_num_pages = 1; window_guest_list_widgets[WIDX_PAGE_DROPDOWN].type = WWT_EMPTY; window_guest_list_widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WWT_EMPTY; - w->var_490 = 0; + w->list_information_type = 0; _window_guest_list_selected_filter = -1; window_invalidate(w); w->scrolls[0].v_top = 0; @@ -358,9 +358,9 @@ static void window_guest_list_update(rct_window *w) { if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0) RCT2_GLOBAL(0x00F1AF20, uint16)--; - w->var_490++; - if (w->var_490 >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32)) - w->var_490 = 0; + w->list_information_type++; + if (w->list_information_type >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32)) + w->list_information_type = 0; widget_invalidate(WC_GUEST_LIST, 0, WIDX_TAB_1 + _window_guest_list_selected_tab); } @@ -602,7 +602,7 @@ static void window_guest_list_paint() // Widgets window_draw_widgets(w, dpi); // Tab 1 image - i = (_window_guest_list_selected_tab == 0 ? w->var_490 & 0x0FFFFFFFC : 0); + i = (_window_guest_list_selected_tab == 0 ? w->list_information_type & 0x0FFFFFFFC : 0); i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982708, int), int)[0] + 1; i |= 0xA1600000; gfx_draw_sprite( @@ -613,7 +613,7 @@ static void window_guest_list_paint() ); // Tab 2 image - i = (_window_guest_list_selected_tab == 1 ? w->var_490 / 4 : 0); + i = (_window_guest_list_selected_tab == 1 ? w->list_information_type / 4 : 0); gfx_draw_sprite( dpi, 5568 + i, @@ -653,7 +653,6 @@ static void window_guest_list_paint() */ static void window_guest_list_scrollpaint() { - int eax, ebx, ecx, edx, esi, edi, ebp; int spriteIndex, format, numGuests, i, j, y; rct_window *w; rct_drawpixelinfo *dpi; @@ -831,7 +830,7 @@ void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, ui if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 1){ rct_ride* ride = &g_ride_list[thought.item]; - esi = &(ride->var_04A); + esi = (int)(&(ride->var_04A)); } else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 2){ if (thought.item < 0x20){ diff --git a/src/window_map.c b/src/window_map.c index 84cfd99af1..d4e132f2c0 100644 --- a/src/window_map.c +++ b/src/window_map.c @@ -132,7 +132,7 @@ void window_map_open() w = window_bring_to_front_by_id(WC_MAP, 0); if (w != NULL) { w->selected_tab = 0; - w->var_490 = 0; + w->list_information_type = 0; return; } @@ -415,7 +415,7 @@ static void window_map_paint() // guest tab image (animated) image_id = SPR_TAB_GUESTS_0; if (w->selected_tab == 0) - image_id += w->var_490 / 4; + image_id += w->list_information_type / 4; gfx_draw_sprite(dpi, image_id, w->x + w->widgets[WIDX_PEOPLE_TAB].left, @@ -424,7 +424,7 @@ static void window_map_paint() // ride/stall tab image (animated) image_id = SPR_TAB_RIDE_0; if (w->selected_tab == 1) - image_id += w->var_490 / 4; + image_id += w->list_information_type / 4; gfx_draw_sprite(dpi, image_id, w->x + w->widgets[WIDX_RIDES_TAB].left, diff --git a/src/window_park.c b/src/window_park.c index 86a7b6b5e7..ed2f02e2e2 100644 --- a/src/window_park.c +++ b/src/window_park.c @@ -597,8 +597,8 @@ rct_window *window_park_open() w->number = 0; w->page = WINDOW_PARK_PAGE_ENTRANCE; w->var_482 = 0; - w->var_48E = 0; - w->var_490 = -1; + w->frame_no = 0; + w->list_information_type = -1; w->var_48C = -1; w->var_492 = 0; RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, (int)w, 0, 0); @@ -799,7 +799,7 @@ static void window_park_entrance_dropdown() */ static void window_park_entrance_update(rct_window *w) { - w->var_48E++; + w->frame_no++; window_invalidate_by_id(w->classification, 1179); } @@ -1289,7 +1289,7 @@ static void window_park_rating_resize() */ static void window_park_rating_update(rct_window *w) { - w->var_48E++; + w->frame_no++; widget_invalidate(w->classification, w->number, WIDX_TAB_2); } @@ -1457,7 +1457,7 @@ static void window_park_guests_resize() */ static void window_park_guests_update(rct_window *w) { - w->var_48E++; + w->frame_no++; w->var_492 = (w->var_492 + 1) % 24; widget_invalidate(w->classification, w->number, WIDX_TAB_3); } @@ -1629,7 +1629,7 @@ static void window_park_price_mousedown(int widgetIndex, rct_window*w, rct_widge */ static void window_park_price_update(rct_window *w) { - w->var_48E++; + w->frame_no++; widget_invalidate(w->classification, w->number, WIDX_TAB_4); } @@ -1769,13 +1769,13 @@ static void window_park_stats_update(rct_window *w) { int i; - w->var_48E++; + w->frame_no++; widget_invalidate(w->classification, w->number, WIDX_TAB_5); // Invalidate ride count if changed i = ride_get_count(); - if (w->var_490 != i) { - w->var_490 = i; + if (w->list_information_type != i) { + w->list_information_type = i; widget_invalidate(w->classification, w->number, WIDX_PAGE_BACKGROUND); } @@ -1859,8 +1859,8 @@ static void window_park_stats_paint() y += 10; // Draw number of rides / attractions - if (w->var_490 != -1) { - RCT2_GLOBAL(0x013CE952, uint32) = w->var_490; + if (w->list_information_type != -1) { + RCT2_GLOBAL(0x013CE952, uint32) = w->list_information_type; gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, (void*)0x013CE952, 0, x, y); } y += 10; @@ -1977,7 +1977,7 @@ static void window_park_objective_resize() */ static void window_park_objective_update(rct_window *w) { - w->var_48E++; + w->frame_no++; widget_invalidate(w->classification, w->number, WIDX_TAB_6); } @@ -2156,7 +2156,7 @@ static void window_park_awards_resize() */ static void window_park_awards_update(rct_window *w) { - w->var_48E++; + w->frame_no++; window_invalidate_by_id(w->classification, 1179); } @@ -2260,7 +2260,7 @@ static void window_park_set_page(rct_window *w, int page) listen++; w->page = page; - w->var_48E = 0; + w->frame_no = 0; w->var_492 = 0; if (w->viewport != NULL) { w->viewport->width = 0; @@ -2326,7 +2326,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_2))) { sprite_idx = SPR_TAB_GRAPH_0; if (w->page == WINDOW_PARK_PAGE_RATING) - sprite_idx += (w->var_48E / 8) % 8; + sprite_idx += (w->frame_no / 8) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_2].left, w->y + w->widgets[WIDX_TAB_2].top); gfx_draw_sprite(dpi, SPR_RATING_HIGH, w->x + w->widgets[WIDX_TAB_2].left + 7, w->y + w->widgets[WIDX_TAB_2].top + 1); gfx_draw_sprite(dpi, SPR_RATING_LOW, w->x + w->widgets[WIDX_TAB_2].left + 16, w->y + w->widgets[WIDX_TAB_2].top + 12); @@ -2336,7 +2336,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_3))) { sprite_idx = SPR_TAB_GRAPH_0; if (w->page == WINDOW_PARK_PAGE_GUESTS) - sprite_idx += (w->var_48E / 8) % 8; + sprite_idx += (w->frame_no / 8) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_3].left, w->y + w->widgets[WIDX_TAB_3].top); sprite_idx = *RCT2_GLOBAL(0x00982708, sint32*) + 1; @@ -2356,7 +2356,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_4))) { sprite_idx = SPR_TAB_ADMISSION_0; if (w->page == WINDOW_PARK_PAGE_PRICE) - sprite_idx += (w->var_48E / 2) % 8; + sprite_idx += (w->frame_no / 2) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_4].left, w->y + w->widgets[WIDX_TAB_4].top); } @@ -2364,7 +2364,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_5))) { sprite_idx = SPR_TAB_STATS_0; if (w->page == WINDOW_PARK_PAGE_STATS) - sprite_idx += (w->var_48E / 4) % 7; + sprite_idx += (w->frame_no / 4) % 7; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_5].left, w->y + w->widgets[WIDX_TAB_5].top); } @@ -2372,7 +2372,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w) if (!(w->disabled_widgets & (1 << WIDX_TAB_6))) { sprite_idx = SPR_TAB_OBJECTIVE_0; if (w->page == WINDOW_PARK_PAGE_OBJECTIVE) - sprite_idx += (w->var_48E / 4) % 16; + sprite_idx += (w->frame_no / 4) % 16; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_6].left, w->y + w->widgets[WIDX_TAB_6].top); } diff --git a/src/window_peep.c b/src/window_peep.c index daa92a38a3..fd589e8f09 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -78,34 +78,34 @@ rct_widget *window_peep_page_widgets[] = { }; static void* window_peep_overview_events[] = { - 0x696A75, - 0x696A06, - 0x696FBE, + (void*)0x696A75, + (void*)0x696A06, + (void*)0x696FBE, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, - 0x696F45, + (void*)0x696F45, window_peep_emptysub, window_peep_emptysub, - 0x696A5F, - 0x696A54, + (void*)0x696A5F, + (void*)0x696A54, window_peep_emptysub, window_peep_emptysub, - 0x696A49, + (void*)0x696A49, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, - 0x696A6A, - 0x697076, + (void*)0x696A6A, + (void*)0x697076, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, - 0x696749, //Invalidate - 0x696887, //Paint - 0x69707C + (void*)0x696749, //Invalidate + (void*)0x696887, //Paint + (void*)0x69707C }; void* window_peep_page_events[] = { @@ -142,8 +142,8 @@ void window_peep_open(rct_peep* peep){ window->number = peep->sprite_index; window->page = 0; window->var_482 = 0; - window->var_48E = 0; - window->var_490 = 0; + window->frame_no = 0; + window->list_information_type = 0; window->var_492 = 0; window->var_494 = 0; RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0); @@ -152,8 +152,8 @@ void window_peep_open(rct_peep* peep){ window->max_width = 500; window->max_height = 450; window->flags = 8; - window->var_476 = 0; - window->var_47A = -1; + window->no_list_items = 0; + window->selected_list_item = -1; window->colours[0] = 1; window->colours[1] = 15; window->colours[2] = 15; @@ -163,10 +163,10 @@ void window_peep_open(rct_peep* peep){ window->page = 0; RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)window, 0, 0); - window->widgets = RCT2_GLOBAL(0x981D0C, uint32); + window->widgets = RCT2_GLOBAL(0x981D0C, rct_widget*); window->enabled_widgets = RCT2_GLOBAL(0x981D3C,uint32); window->var_020 = RCT2_GLOBAL(0x981D54,uint32); - window->event_handlers = RCT2_GLOBAL(0x981D24,uint32); + window->event_handlers = RCT2_GLOBAL(0x981D24,uint32*); window->pressed_widgets = 0; RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0); diff --git a/src/window_ride_list.c b/src/window_ride_list.c index 2d437c1531..84902b4d02 100644 --- a/src/window_ride_list.c +++ b/src/window_ride_list.c @@ -153,9 +153,9 @@ void window_ride_list_open() (1 << WIDX_TAB_3); window_init_scroll_widgets(window); window->page = PAGE_RIDES; - window->var_476 = 0; - window->var_47A = -1; - window->var_48E = 0; + window->no_list_items = 0; + window->selected_list_item = -1; + window->frame_no = 0; window->min_width = 340; window->min_height = 240; window->max_width = 400; @@ -166,7 +166,7 @@ void window_ride_list_open() window->colours[2] = 26; } _window_ride_list_information_type = INFORMATION_TYPE_STATUS; - window->var_490 = 0; + window->list_information_type = 0; } /** @@ -196,17 +196,17 @@ static void window_ride_list_mouseup() window_close(w); break; case WIDX_SORT: - w->var_490 = _window_ride_list_information_type; - w->var_476 = 0; - w->var_47A = -1; + w->list_information_type = _window_ride_list_information_type; + w->no_list_items = 0; + w->selected_list_item = -1; break; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: if (w->page != widgetIndex - WIDX_TAB_1) { w->page = widgetIndex - WIDX_TAB_1; - w->var_476 = 0; - w->var_47A = -1; + w->no_list_items = 0; + w->selected_list_item = -1; if (w->page != PAGE_RIDES && _window_ride_list_information_type > INFORMATION_TYPE_PROFIT) _window_ride_list_information_type = INFORMATION_TYPE_PROFIT; window_invalidate(w); @@ -322,7 +322,7 @@ static void window_ride_list_dropdown() */ static void window_ride_list_update(rct_window *w) { - w->var_48E = (w->var_48E + 1) % 64; + w->frame_no = (w->frame_no + 1) % 64; widget_invalidate(w->classification, w->number, WIDX_TAB_1 + w->page); if (_window_ride_list_information_type != INFORMATION_TYPE_STATUS) window_invalidate(w); @@ -344,9 +344,9 @@ static void window_ride_list_scrollgetsize() #endif - height = w->var_476 * 10; - if (w->var_47A != -1) { - w->var_47A = -1; + height = w->no_list_items * 10; + if (w->selected_list_item != -1) { + w->selected_list_item = -1; window_invalidate(w); } @@ -396,11 +396,11 @@ static void window_ride_list_scrollmousedown() index = y / 10; - if (index >= w->var_476) + if (index >= w->no_list_items) return; // Open ride window - RCT2_CALLPROC_X(0x006ACC28, w->var_076[index], 0, 0, 0, 0, 0, 0); + RCT2_CALLPROC_X(0x006ACC28, w->list_item_positions[index], 0, 0, 0, 0, 0, 0); } /** @@ -427,10 +427,10 @@ static void window_ride_list_scrollmouseover() index = y / 10; - if (index >= w->var_476) + if (index >= w->no_list_items) return; - w->var_47A = index; + w->selected_list_item = index; window_invalidate(w); } @@ -547,17 +547,17 @@ static void window_ride_list_scrollpaint() gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height, RCT2_GLOBAL(0x0141FC48 + (w->colours[1] * 8), uint8)); y = 0; - for (i = 0; i < w->var_476; i++) { + for (i = 0; i < w->no_list_items; i++) { format = 1191; // Background highlight - if (i == w->var_47A) { + if (i == w->selected_list_item) { gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x02000031); format = 1193; } // Get ride - ride = &g_ride_list[w->var_076[i]]; + ride = &g_ride_list[w->list_item_positions[i]]; // Ride name gfx_draw_string_left_clipped(dpi, format, &ride->var_04A, 0, 0, y - 1, 159); @@ -566,7 +566,7 @@ static void window_ride_list_scrollpaint() formatSecondary = 0; switch (_window_ride_list_information_type) { case INFORMATION_TYPE_STATUS: - ride_get_status(w->var_076[i], &formatSecondary, &argument); + ride_get_status(w->list_item_positions[i], &formatSecondary, &argument); RCT2_GLOBAL(0x013CE952 + 2, sint32) = argument; break; case INFORMATION_TYPE_POPULARITY: @@ -646,22 +646,24 @@ static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window // Rides tab sprite_idx = SPR_TAB_RIDE_0; if (w->page == PAGE_RIDES) - sprite_idx += w->var_48E / 4; + sprite_idx += w->frame_no / 4; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_1].left, w->y + w->widgets[WIDX_TAB_1].top); // Shops and stalls tab sprite_idx = SPR_TAB_SHOPS_AND_STALLS_0; if (w->page == PAGE_SHOPS_AND_STALLS) - sprite_idx += w->var_48E / 4; + sprite_idx += w->frame_no / 4; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_2].left, w->y + w->widgets[WIDX_TAB_2].top); // Information kiosks and facilities tab sprite_idx = SPR_TAB_KIOSKS_AND_FACILITIES_0; if (w->page == PAGE_KIOSKS_AND_FACILITIES) - sprite_idx += (w->var_48E / 4) % 8; + sprite_idx += (w->frame_no / 4) % 8; gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_3].left, w->y + w->widgets[WIDX_TAB_3].top); } + + /** * * rct2: 0x006B39A8 @@ -669,7 +671,6 @@ static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window static void window_ride_list_refresh_list(rct_window *w) { int i, countA, countB; - uint8 swapper; rct_ride *ride, *otherRide; countA = countB = 0; @@ -687,119 +688,101 @@ static void window_ride_list_refresh_list(rct_window *w) if (countB != 0) window_invalidate(w); - if (countA == w->var_476) + if (countA == w->no_list_items) return; - w->var_476 = countA; + w->no_list_items = countA; int list_index = 0; FOR_ALL_RIDES(i, ride) { if (w->page != gRideClassifications[ride->type]) continue; - w->var_076[list_index] = i; + w->list_item_positions[list_index] = i; int current_list_position = list_index; - switch (w->var_490) { + switch (w->list_information_type) { case INFORMATION_TYPE_STATUS: RCT2_GLOBAL(0x013CE952, uint32) = ride->var_04C; RCT2_CALLPROC_X(0x006C2538, ride->var_04A, 0, 0x013CE952, 0, 0, RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 0); while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; RCT2_GLOBAL(0x013CE952, uint32) = otherRide->var_04C; RCT2_CALLPROC_X(0x006C2538, otherRide->var_04A, 0, 0x013CE952, 0, 0, 0x0141EF68, 0); if (strcmp((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68) >= 0) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_POPULARITY: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if ((ride->var_158 & 0xFF) * 4 <= (otherRide->var_158 & 0xFF) * 4) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_SATISFACTION: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if ((ride->var_14A & 0xFF) * 5 <= (otherRide->var_14A & 0xFF) * 5) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_PROFIT: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride->profit <= otherRide->profit) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_QUEUE_LENGTH: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride_get_total_queue_length(ride) <= ride_get_total_queue_length(otherRide)) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_QUEUE_TIME: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride_get_max_queue_time(ride) <= ride_get_max_queue_time(otherRide)) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_RELIABILITY: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride->var_196 >> 8 <= otherRide->var_196 >> 8) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_DOWN_TIME: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride->var_199 <= otherRide->var_199) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; case INFORMATION_TYPE_GUESTS_FAVOURITE: while (--current_list_position >= 0) { - otherRide = &g_ride_list[w->var_076[current_list_position]]; + otherRide = &g_ride_list[w->list_item_positions[current_list_position]]; if (ride->guests_favourite <= otherRide->guests_favourite) break; - swapper = w->var_076[current_list_position]; - w->var_076[current_list_position] = w->var_076[current_list_position + 1]; - w->var_076[current_list_position + 1] = swapper; + window_bubble_list_item(w, current_list_position); } break; } @@ -807,7 +790,7 @@ static void window_ride_list_refresh_list(rct_window *w) list_index++; } - w->var_47A = -1; + w->selected_list_item = -1; window_invalidate(w); } diff --git a/src/window_tooltip.c b/src/window_tooltip.c index ee5183b9a0..3002f798ce 100644 --- a/src/window_tooltip.c +++ b/src/window_tooltip.c @@ -122,7 +122,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y int tooltip_text_width = ecx, tooltip_text_height = 0; //gfx_get_string_width_new_lined - RCT2_CALLFUNC_X(0x006C23B1, &eax, &ebx, &tooltip_text_width, &edx, &buffer, &edi, &ebp); + RCT2_CALLFUNC_X(0x006C23B1, &eax, &ebx, &tooltip_text_width, &edx, (int*)(&buffer), &edi, &ebp); buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char); tooltip_text_width &= 0xFFFF; if (tooltip_text_width > 196)