From 851b0819b97288a87e4a190a7d7691d4b683cce6 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Tue, 31 Mar 2015 02:21:30 +0100 Subject: [PATCH] clean up many CALL_PROCs and implement a few functions --- src/editor.c | 18 ++++++------ src/game.c | 20 ++++++++----- src/game.h | 1 + src/interface/keyboard_shortcut.c | 47 ++++++++++++++++++++++++------ src/interface/window.c | 27 +++++++++++------ src/interface/window.h | 3 +- src/peep/peep.c | 5 ++-- src/scenario.c | 2 +- src/title.c | 12 ++++---- src/windows/finances.c | 4 +-- src/windows/guest.c | 10 +++---- src/windows/new_ride.c | 15 ++++++++-- src/windows/options.c | 6 ++-- src/windows/park.c | 2 +- src/windows/research.c | 4 +-- src/windows/ride.c | 31 ++++++++++---------- src/windows/staff.c | 11 ++++--- src/windows/title_scenarioselect.c | 4 +-- 18 files changed, 134 insertions(+), 88 deletions(-) diff --git a/src/editor.c b/src/editor.c index 4ac6935df8..e85b564fd7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -291,17 +291,17 @@ static void set_all_land_owned() } /** -* -* rct2: 0x006BD3A4 -*/ -void sub_6BD3A4() { - for (short i = 0; i < 200; i++) { + * + * rct2: 0x006BD3A4 + */ +void sub_6BD3A4() +{ + for (int i = 0; i < 200; i++) RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] = STAFF_MODE_NONE; - } - for (short i = 200; i < 204; i++) { + + for (int i = 200; i < 204; i++) RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] = STAFF_MODE_WALK; - } - //RCT2_CALLPROC_EBPSAFE(0x006C0C3F); + sub_6C0C3F(); } diff --git a/src/game.c b/src/game.c index 64d1330934..1b3f4a3a34 100644 --- a/src/game.c +++ b/src/game.c @@ -473,6 +473,15 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * return 0x80000000; } +void pause_toggle() +{ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) ^= 1; + window_invalidate_by_class(WC_TOP_TOOLBAR); + if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) & 1) + pause_sounds(); + else + unpause_sounds(); +} /** * @@ -480,14 +489,9 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * */ void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) { - if (*ebx & GAME_COMMAND_FLAG_APPLY) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) ^= 1; - window_invalidate_by_class(WC_TOP_TOOLBAR); - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) & 1) - pause_sounds(); - else - unpause_sounds(); - } + if (*ebx & GAME_COMMAND_FLAG_APPLY) + pause_toggle(); + *ebx = 0; } diff --git a/src/game.h b/src/game.h index 69015899b4..410b596d04 100644 --- a/src/game.h +++ b/src/game.h @@ -109,6 +109,7 @@ void game_reduce_game_speed(); void game_load_or_quit_no_save_prompt(); int game_load_save(const char *path); void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); +void pause_toggle(); char save_game(); void rct2_exit(); void rct2_exit_reason(rct_string_id title, rct_string_id body); diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index 943c028a11..9b30f354f1 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -25,6 +25,7 @@ #include "keyboard_shortcut.h" #include "viewport.h" #include "window.h" +#include "widget.h" typedef void (*shortcut_action)(); @@ -171,7 +172,38 @@ static void shortcut_rotate_view() static void shortcut_rotate_construction_object() { - RCT2_CALLPROC_EBPSAFE(0x006E4182); + rct_window *w; + + // Rotate scenery + w = window_find_by_class(WC_SCENERY); + if (w != NULL && !widget_is_disabled(w, 25) && w->widgets[25].type != WWT_EMPTY) { + window_event_mouse_up_call(w, 25); + return; + } + + // Rotate construction track piece + w = window_find_by_class(WC_RIDE_CONSTRUCTION); + if (w != NULL && !widget_is_disabled(w, 32) && w->widgets[32].type != WWT_EMPTY) { + // Check if building a maze... + if (w->widgets[32].tooltip != 1761) { + window_event_mouse_up_call(w, 32); + return; + } + } + + // Rotate track design preview + w = window_find_by_class(WC_TRACK_DESIGN_LIST); + if (w != NULL && !widget_is_disabled(w, 5) && w->widgets[5].type != WWT_EMPTY) { + window_event_mouse_up_call(w, 5); + return; + } + + // Rotate track design placement + w = window_find_by_class(WC_TRACK_DESIGN_PLACE); + if (w != NULL && !widget_is_disabled(w, 3) && w->widgets[3].type != WWT_EMPTY) { + window_event_mouse_up_call(w, 3); + return; + } } static void shortcut_underground_view_toggle() @@ -308,14 +340,11 @@ static void shortcut_show_financial_information() static void shortcut_show_research_information() { - rct_window *window; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - // Open new ride window - RCT2_CALLPROC_EBPSAFE(0x006B3CFF); - window = window_find_by_class(WC_CONSTRUCT_RIDE); - if (window != NULL) - window_event_mouse_up_call(window, 10); + if (gConfigInterface.toolbar_show_research) + window_research_open(); + else + window_new_ride_open_research(); } } @@ -386,7 +415,7 @@ static void shortcut_show_map() static void shortcut_screenshot() { - RCT2_CALLPROC_EBPSAFE(0x006E4034); // set screenshot countdown to 2 + RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) = 2; } static void shortcut_reduce_game_speed() diff --git a/src/interface/window.c b/src/interface/window.c index d99977d76e..4b04ba54f3 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -642,7 +642,7 @@ int window_find_widget_from_point(rct_window *w, int x, int y) int i, widget_index; // Invalidate the window - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); // Find the widget at point x, y widget_index = -1; @@ -1140,14 +1140,24 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z) } } +/** + * + * rct2: 0x00688956 + */ +void sub_688956() +{ + rct_window *w; + + for (w = RCT2_NEW_WINDOW - 1; w >= g_window_list; w--) + RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_14], 0, 0, 0, 0, (int)w, 0, 0); +} + /** * * rct2: 0x0068881A */ void window_rotate_camera(rct_window *w) { - //RCT2_CALLPROC_X(0x0068881A, 0, 0, 0, 0, (int)w, 0, 0); - rct_viewport *viewport = w->viewport; if (viewport == NULL) return; @@ -1186,8 +1196,7 @@ void window_rotate_camera(rct_window *w) window_invalidate(w); - RCT2_CALLPROC_EBPSAFE(0x00688956); - + sub_688956(); sub_69E9A7(); } @@ -1345,7 +1354,7 @@ void window_draw(rct_window *w, int left, int top, int right, int bottom) RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WINDOW_COLOUR_4, uint8) = v->colours[3] & 0x7F; // Invalidate the window - RCT2_CALLPROC_X(v->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)v, 0, 0); + window_event_invalidate_call(v); // Paint the window RCT2_CALLPROC_X(v->event_handlers[WE_PAINT], 0, 0, 0, 0, (int)v, (int)dpi, 0); @@ -1484,8 +1493,8 @@ void window_resize(rct_window *w, int dw, int dh) w->width = clamp(w->min_width, w->width + dw, w->max_width); w->height = clamp(w->min_height, w->height + dh, w->max_height); - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], w->width, w->height, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); + window_event_invalidate_call(w); // Update scroll widgets for (i = 0; i < 3; i++) { @@ -1906,7 +1915,7 @@ void sub_6EA73F() for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--) { window_update_scroll_widgets(w); window_invalidate_pressed_image_buttons(w); - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); } } diff --git a/src/interface/window.h b/src/interface/window.h index b586ea933c..37e953678d 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -540,7 +540,8 @@ void window_ride_construct(rct_window *w); void window_ride_list_open(); rct_window * window_construction_open(); void window_track_place_open(); -void window_new_ride_open(); +rct_window *window_new_ride_open(); +rct_window *window_new_ride_open_research(); void window_banner_open(rct_windownumber number); void window_sign_open(rct_windownumber number); void window_sign_small_open(rct_windownumber number); diff --git a/src/peep/peep.c b/src/peep/peep.c index c08deab8f9..cd44ff624d 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -530,9 +530,8 @@ void peep_update_sprite_type(rct_peep* peep){ void peep_window_state_update(rct_peep* peep){ rct_window* w = window_find_by_number(WC_PEEP, peep->sprite_index); - if (w){ - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); - } + if (w != NULL) + window_event_invalidate_call(w); if (peep->type == PEEP_TYPE_GUEST){ // Update action label diff --git a/src/scenario.c b/src/scenario.c index c5a69d7c11..effe8e12a9 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -1134,7 +1134,7 @@ int scenario_save(char *path, int flags) fclose(file); if (!(flags & 0x80000000)) - reset_loaded_objects();//RCT2_CALLPROC_EBPSAFE(0x006A9FC0); + reset_loaded_objects(); gfx_invalidate_screen(); RCT2_GLOBAL(0x009DEA66, uint16) = 0; diff --git a/src/title.c b/src/title.c index 7a7c8938b4..ec5f436bae 100644 --- a/src/title.c +++ b/src/title.c @@ -94,7 +94,7 @@ void title_load() log_verbose("loading title"); if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) & 1) - RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0);//Game pause toggle + pause_toggle(); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO; @@ -103,7 +103,7 @@ void title_load() reset_sprite_list(); ride_init_all(); window_guest_list_init_vars_a(); - sub_6BD3A4(); // RCT2_CALLPROC_EBPSAFE(0x006BD3A4); + sub_6BD3A4(); map_init(150); park_init(); date_reset(); @@ -112,8 +112,8 @@ void title_load() window_new_ride_init_vars(); window_guest_list_init_vars_b(); window_staff_list_init_vars(); - map_update_tile_pointers(); //RCT2_CALLPROC_EBPSAFE(0x0068AFFD); - reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4); + map_update_tile_pointers(); + reset_0x69EBE4(); viewport_init_all(); news_item_init_queue(); title_create_windows(); @@ -131,14 +131,12 @@ void title_load() */ static void title_create_windows() { - // RCT2_CALLPROC_EBPSAFE(0x0066B3E8); - window_main_open(); window_title_menu_open(); window_title_exit_open(); window_title_options_open(); window_title_logo_open(); - RCT2_CALLPROC_EBPSAFE(0x0066B905); + window_resize_gui(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)); } /** diff --git a/src/windows/finances.c b/src/windows/finances.c index be5720f211..ec42a904f5 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -1513,8 +1513,8 @@ static void window_finances_set_page(rct_window *w, int page) w->width = 530; w->height = 257; } - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); diff --git a/src/windows/guest.c b/src/windows/guest.c index d816d80bc9..754ea46e18 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -568,7 +568,7 @@ void window_guest_overview_resize(){ window_get_register(w); window_guest_disable_widgets(w); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_MARQUEE); @@ -676,10 +676,8 @@ void window_guest_set_page(rct_window* w, int page){ w->widgets = window_guest_page_widgets[page]; window_guest_disable_widgets(w); window_invalidate(w); - - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); - + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); @@ -768,7 +766,7 @@ void window_guest_viewport_init(rct_window* w){ viewport_flags |= VIEWPORT_FLAG_GRIDLINES; } - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); w->viewport_focus_coordinates.x = focus.coordinate.x; w->viewport_focus_coordinates.y = focus.coordinate.y; diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index e234a19fcb..22b5a659a7 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -382,13 +382,13 @@ static void window_new_ride_scroll_to_focused_ride(rct_window *w) * * rct2: 0x006B3CFF */ -void window_new_ride_open() +rct_window *window_new_ride_open() { rct_window *w; w = window_bring_to_front_by_class(WC_CONSTRUCT_RIDE); if (w != NULL) - return; + return w; // Not sure what these windows are window_close_by_class(WC_TRACK_DESIGN_LIST); @@ -427,6 +427,17 @@ void window_new_ride_open() w->width = 1; window_new_ride_refresh_widget_sizing(w); window_new_ride_scroll_to_focused_ride(w); + + return w; +} + +rct_window *window_new_ride_open_research() +{ + rct_window *w; + + w = window_new_ride_open(); + window_new_ride_set_page(w, WINDOW_NEW_RIDE_PAGE_RESEARCH); + return w; } /** diff --git a/src/windows/options.c b/src/windows/options.c index a7dac9f9f8..782939dbb5 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -888,10 +888,8 @@ static void window_options_set_page(rct_window *w, int page) w->frame_no = 0; window_invalidate(w); - - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); - + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); } diff --git a/src/windows/park.c b/src/windows/park.c index 1f3cba798f..2cc58b47d8 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -1018,7 +1018,7 @@ static void window_park_init_viewport(rct_window *w) } // Call invalidate event - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); w->viewport_focus_coordinates.x = x; w->viewport_focus_coordinates.y = y; diff --git a/src/windows/research.c b/src/windows/research.c index 0b2dd9d9bd..447d539788 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -620,8 +620,8 @@ static void window_research_set_page(rct_window *w, int page) w->width = 320; w->height = 207; } - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); diff --git a/src/windows/ride.c b/src/windows/ride.c index 5b16b8ea77..c3c6e9cc73 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1421,9 +1421,8 @@ static void window_ride_set_page(rct_window *w, int page) window_ride_disable_tabs(w); window_invalidate(w); - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); - + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); @@ -1535,7 +1534,7 @@ static void window_ride_init_viewport(rct_window *w) viewport_flags |= VIEWPORT_FLAG_GRIDLINES; } - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); w->viewport_focus_coordinates.x = focus.coordinate.x; w->viewport_focus_coordinates.y = focus.coordinate.y; @@ -1896,7 +1895,7 @@ static void window_ride_main_update(rct_window *w) // Update tab animation w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_1); // Update status @@ -2402,7 +2401,7 @@ static void window_ride_vehicle_dropdown() static void window_ride_vehicle_update(rct_window *w) { w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_2); } @@ -2946,7 +2945,7 @@ static void window_ride_operating_update(rct_window *w) rct_ride *ride; w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_3); ride = GET_RIDE(w->number); @@ -3356,7 +3355,7 @@ static void window_ride_maintenance_update(rct_window *w) rct_ride *ride; w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_4); ride = GET_RIDE(w->number); @@ -3844,7 +3843,7 @@ static void window_ride_colour_dropdown() static void window_ride_colour_update(rct_window *w) { w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_5); widget_invalidate(w, WIDX_VEHICLE_PREVIEW); } @@ -4369,7 +4368,7 @@ static void window_ride_music_dropdown() static void window_ride_music_update(rct_window *w) { w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_6); } @@ -4639,7 +4638,7 @@ static void window_ride_measurements_dropdown() static void window_ride_measurements_update(rct_window *w) { w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_7); } @@ -5011,9 +5010,9 @@ static void window_ride_graphs_update(rct_window *w) int x; w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_8); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_GRAPH); widget = &window_ride_graphs_widgets[WIDX_GRAPH]; @@ -5041,7 +5040,7 @@ static void window_ride_graphs_scrollgetheight() window_get_register(w); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); // Set minimum size width = window_ride_graphs_widgets[WIDX_GRAPH].right - window_ride_graphs_widgets[WIDX_GRAPH].left - 2; @@ -5447,7 +5446,7 @@ static void window_ride_income_update(rct_window *w) rct_ride *ride; w->frame_no++; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_9); ride = GET_RIDE(w->number); @@ -5731,7 +5730,7 @@ static void window_ride_customer_update(rct_window *w) if (w->var_492 >= 24) w->var_492 = 0; - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); widget_invalidate(w, WIDX_TAB_10); ride = GET_RIDE(w->number); diff --git a/src/windows/staff.c b/src/windows/staff.c index 4c9f71d0b8..6b3703417e 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -332,9 +332,8 @@ void window_staff_open(rct_peep* peep) window_staff_disable_widgets(w); window_init_scroll_widgets(w); window_staff_viewport_init(w); - if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) { - RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_UP], 0, 0, 0, 10, (int)w, 0, 0); - } + if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) + window_event_mouse_up_call(w, WIDX_CHECKBOX_3); } /** @@ -421,8 +420,8 @@ void window_staff_set_page(rct_window* w, int page) window_staff_disable_widgets(w); window_invalidate(w); - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); @@ -1279,7 +1278,7 @@ void window_staff_viewport_init(rct_window* w){ viewport_flags |= VIEWPORT_FLAG_GRIDLINES; } - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_invalidate_call(w); w->viewport_focus_sprite.sprite_id = focus.sprite_id; w->viewport_focus_sprite.type = focus.type; diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c index bb5c841920..c527d9950a 100644 --- a/src/windows/title_scenarioselect.c +++ b/src/windows/title_scenarioselect.c @@ -182,8 +182,8 @@ static void window_scenarioselect_mousedown(int widgetIndex, rct_window*w, rct_w w->selected_tab = widgetIndex - 4; w->var_494 = 0; window_invalidate(w); - RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); - RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + window_event_resize_call(w); + window_event_invalidate_call(w); window_init_scroll_widgets(w); window_invalidate(w); }