From 40ba6a3efa495284e9e9a9fa3ea3a62de170bfd2 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Mon, 29 Jun 2015 17:22:01 +0100 Subject: [PATCH] remove various callprocs --- src/interface/window.h | 1 + src/ride/ride.c | 13 ++++++- src/ride/ride.h | 2 + src/ride/track.c | 2 +- src/windows/guest.c | 6 +-- src/windows/maze_construction.c | 33 +++++++++++++++++ src/windows/staff.c | 6 +-- src/world/map.c | 2 +- src/world/map_animation.c | 2 +- src/world/sprite.c | 66 ++++++++++++++++++++++++++++++--- src/world/sprite.h | 1 + 11 files changed, 113 insertions(+), 21 deletions(-) diff --git a/src/interface/window.h b/src/interface/window.h index e571e2f312..5e02e69147 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -566,6 +566,7 @@ void window_ride_construct(rct_window *w); void window_ride_list_open(); rct_window *window_ride_construction_open(); rct_window *window_maze_construction_open(); +void window_maze_construction_update_pressed_widgets(); void window_track_place_open(); rct_window *window_new_ride_open(); rct_window *window_new_ride_open_research(); diff --git a/src/ride/ride.c b/src/ride/ride.c index 64b8e3d5a7..f6648495da 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -1285,7 +1285,7 @@ int ride_modify_maze(rct_map_element *mapElement, int x, int y) _currentTrackBeginZ = mapElement->base_height * 8; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - RCT2_CALLPROC_X(0x006CD887, 0, 0, 0, 0, 0, 0, 0); + window_maze_construction_update_pressed_widgets(); return 1; } @@ -4398,7 +4398,7 @@ void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi ride_stop_peeps_queuing(ride_id); *ebx = ride_get_refund_price(ride_id); - RCT2_CALLPROC_X(0x006CB945, 0, 0, 0, ride_id, 0, 0, 0); + sub_6CB945(ride_id); news_item_disable_news(NEWS_ITEM_RIDE, ride_id); for(int i = 0; i < MAX_BANNERS; i++){ @@ -5354,3 +5354,12 @@ void game_command_set_ride_vehicles(int *eax, int *ebx, int *ecx, int *edx, int } *ebx = 0; } + +/** + * + * rct2: 0x006CB945 + */ +void sub_6CB945(int rideIndex) +{ + RCT2_CALLPROC_X(0x006CB945, 0, 0, 0, rideIndex, 0, 0, 0); +} diff --git a/src/ride/ride.h b/src/ride/ride.h index 441290907c..6733468af2 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -952,4 +952,6 @@ void ride_set_num_vehicles(int rideIndex, int numVehicles); void ride_set_num_cars_per_vehicle(int rideIndex, int numCarsPerVehicle); void game_command_set_ride_vehicles(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); +void sub_6CB945(int rideIndex); + #endif diff --git a/src/ride/track.c b/src/ride/track.c index 46e91b162a..4c71ba126a 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -1856,7 +1856,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac } if (RCT2_GLOBAL(0x00F440D4, uint8) == 6){ - RCT2_CALLPROC_X(0x006CB945, 0, 0, 0, RCT2_GLOBAL(0x00F440A7, uint8), 0, 0, 0); + sub_6CB945(RCT2_GLOBAL(0x00F440A7, uint8)); rct_ride* ride = GET_RIDE(RCT2_GLOBAL(0x00F440A7, uint8)); user_string_free(ride->name); ride->type = RIDE_TYPE_NULL; diff --git a/src/windows/guest.c b/src/windows/guest.c index d5b9467b55..ffbfaae46c 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1213,11 +1213,7 @@ void window_guest_overview_tool_down(){ return; } - int _edx; - _edx = (dest_z / 8) | (((dest_z / 8) + 1) << 8); - int flags = RCT2_CALLPROC_X(0x68B93A, tile_x, 0xF, tile_y, _edx, (int)w, 0, 0); - - if (flags & 0x100){ + if (!map_can_construct_at(tile_x, tile_y, dest_z / 8, (dest_z / 8) + 1, 15)){ if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5 ){ if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){ window_error_open(0x785, -1); diff --git a/src/windows/maze_construction.c b/src/windows/maze_construction.c index 0a659f63b2..0c0ec22bc7 100644 --- a/src/windows/maze_construction.c +++ b/src/windows/maze_construction.c @@ -209,3 +209,36 @@ static void window_maze_construction_paint() window_draw_widgets(w, dpi); } + +/** + * + * rct2: 0x006CD887 + */ +void window_maze_construction_update_pressed_widgets() +{ + rct_window *w; + + w = window_find_by_class(WC_RIDE_CONSTRUCTION); + if (w == NULL) + return; + + uint64 pressedWidgets = w->pressed_widgets; + pressedWidgets &= ~(1ULL << WIDX_MAZE_BUILD_MODE); + pressedWidgets &= ~(1ULL << WIDX_MAZE_MOVE_MODE); + pressedWidgets &= ~(1ULL << WIDX_MAZE_FILL_MODE); + + switch (_rideConstructionState) { + case RIDE_CONSTRUCTION_STATE_6: + pressedWidgets |= (1ULL << WIDX_MAZE_BUILD_MODE); + break; + case RIDE_CONSTRUCTION_STATE_7: + pressedWidgets |= (1ULL << WIDX_MAZE_MOVE_MODE); + break; + case RIDE_CONSTRUCTION_STATE_8: + pressedWidgets |= (1ULL << WIDX_MAZE_FILL_MODE); + break; + } + + w->pressed_widgets = pressedWidgets; + window_invalidate(w); +} diff --git a/src/windows/staff.c b/src/windows/staff.c index 117d41d9ee..7e0fec7fb5 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -1139,11 +1139,7 @@ void window_staff_overview_tool_down(){ return; } - int _edx; - _edx = (dest_z / 8) | (((dest_z / 8) + 1) << 8); - int flags = RCT2_CALLPROC_X(0x68B93A, tile_x, 0xF, tile_y, _edx, (int)w, 0, 0); - - if (flags & 0x100){ + if (!map_can_construct_at(tile_x, tile_y, dest_z / 8, (dest_z / 8) + 1, 15)){ if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5){ if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){ window_error_open(0x785, -1); diff --git a/src/world/map.c b/src/world/map.c index 17412bae0c..b4faaf0096 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -1387,7 +1387,7 @@ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surfaceSt mapElement->type |= (surfaceStyle >> 3) & MAP_ELEMENT_DIRECTION_MASK; map_invalidate_tile_full(x, y); - RCT2_CALLPROC_X(0x00673883, x, 0, y, map_element_height(x, y), 0, 0, 0); + footpath_remove_litter(x, y, map_element_height(x, y)); } } } diff --git a/src/world/map_animation.c b/src/world/map_animation.c index 3a31fe5d82..62f879448d 100644 --- a/src/world/map_animation.c +++ b/src/world/map_animation.c @@ -212,7 +212,7 @@ static bool map_animation_invalidate_small_scenery(int x, int y, int baseZ) peep->action_frame = 0; peep->action_sprite_image_offset = 0; sub_693B58(peep); - RCT2_CALLPROC_X(0x006EC53F, 0, 0, 0, 0, (int)peep, 0, 0); + sub_6EC53F((rct_sprite*)peep); break; } } diff --git a/src/world/sprite.c b/src/world/sprite.c index 1127ec59da..9334aec0ee 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -764,6 +764,51 @@ void move_sprite_to_list(rct_sprite *sprite, uint8 cl) ++(RCT2_GLOBAL(0x13573C8 + cl, uint16)); } +/** + * + * rct: 0x00673200 + */ +static void sub_673200(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x00673200, 0, 0, 0, 0, (int)sprite, 0, 0); +} + +/** + * + * rct: 0x00673298 + */ +static void sub_673298(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x00673298, 0, 0, 0, 0, (int)sprite, 0, 0); +} + +/** + * + * rct: 0x00673385 + */ +static void sub_673385(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x00673385, 0, 0, 0, 0, (int)sprite, 0, 0); +} + +/** + * + * rct: 0x0067339D + */ +static void sub_67339D(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x0067339D, 0, 0, 0, 0, (int)sprite, 0, 0); +} + +/** + * + * rct: 0x006733B4 + */ +static void sub_6733B4(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x006733B4, 0, 0, 0, 0, (int)sprite, 0, 0); +} + /** * * rct: 0x006731CD @@ -772,22 +817,22 @@ void sprite_misc_update(rct_sprite *sprite) { switch (sprite->unknown.misc_identifier) { case SPRITE_MISC_0: - RCT2_CALLPROC_X(0x00673200, 0, 0, 0, 0, (int)sprite, 0, 0); + sub_673200(sprite); break; case SPRITE_MISC_MONEY_EFFECT: money_effect_update(&sprite->money_effect); break; case SPRITE_MISC_2: - RCT2_CALLPROC_X(0x00673298, 0, 0, 0, 0, (int)sprite, 0, 0); + sub_673298(sprite); break; case SPRITE_MISC_3: - RCT2_CALLPROC_X(0x00673385, 0, 0, 0, 0, (int)sprite, 0, 0); + sub_673385(sprite); break; case SPRITE_MISC_4: - RCT2_CALLPROC_X(0x0067339D, 0, 0, 0, 0, (int)sprite, 0, 0); + sub_67339D(sprite); break; case SPRITE_MISC_5: - RCT2_CALLPROC_X(0x006733B4, 0, 0, 0, 0, (int)sprite, 0, 0); + sub_6733B4(sprite); break; case SPRITE_MISC_JUMPING_FOUNTAIN_WATER: case SPRITE_MISC_JUMPING_FOUNTAIN_SNOW: @@ -975,4 +1020,13 @@ void litter_create(int x, int y, int z, int direction, int type) sprite_move(x, y, z, (rct_sprite*)litter); sub_6EC60B((rct_sprite*)litter); litter->creationTick = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32); -} \ No newline at end of file +} + +/** + * + * rct2: 0x006EC53F + */ +void sub_6EC53F(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x006EC53F, 0, 0, 0, 0, (int)sprite, 0, 0); +} diff --git a/src/world/sprite.h b/src/world/sprite.h index 4dbdebae6a..1d8be65694 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -257,5 +257,6 @@ void invalidate_sprite(rct_sprite *sprite); void sub_6EC60B(rct_sprite* sprite); void sprite_remove(rct_sprite *sprite); void litter_create(int x, int y, int z, int direction, int type); +void sub_6EC53F(rct_sprite *sprite); #endif