From 4893521beaace7ade9e267de393ecd77e29bed0a Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 21:48:05 +0100 Subject: [PATCH 01/38] Name sub_6C84CE() --- src/openrct2/ride/ride.h | 2 +- src/openrct2/windows/ride_construction.c | 120 +++++++++++------------ 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index 6a0b3cec35..61081ada3b 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -1105,7 +1105,7 @@ bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 ri bool track_block_get_previous(sint32 x, sint32 y, rct_map_element *mapElement, track_begin_end *outTrackBeginEnd); bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8 direction, track_begin_end *outTrackBeginEnd); -void sub_6C84CE(); +void window_ride_construction_update_active_elements(); void sub_6C96C0(); money32 ride_entrance_exit_place_ghost(sint32 rideIndex, sint32 x, sint32 y, sint32 direction, sint32 placeType, sint32 stationNum); void ride_get_entrance_or_exit_position_from_screen_position(sint32 x, sint32 y, sint32 *outX, sint32 *outY, sint32 *outDirection); diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index aff48638ed..92fb0a9bb2 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -1312,49 +1312,49 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ sub_6C9627(); _currentTrackCurve = TRACK_CURVE_LEFT; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_RIGHT; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_SMALL: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_LEFT_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_SMALL: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_RIGHT_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_VERY_SMALL: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_LEFT_VERY_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_VERY_SMALL: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_RIGHT_VERY_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_LARGE: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_LEFT_LARGE; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_LARGE: sub_6C9627(); _currentTrackCurve = TRACK_CURVE_RIGHT_LARGE; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_STRAIGHT: sub_6C9627(); @@ -1362,7 +1362,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ _currentTrackBankEnd = TRACK_BANK_NONE; _currentTrackCurve = TRACK_CURVE_NONE; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_SLOPE_DOWN_STEEP: sub_6C9627(); @@ -1370,22 +1370,22 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_LARGE | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_LARGE | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_SMALL | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_SMALL | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1393,12 +1393,12 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_QUARTER_BANKED_HELIX_LARGE_DOWN | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_QUARTER_BANKED_HELIX_LARGE_DOWN | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1407,12 +1407,12 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_QUARTER_HELIX_LARGE_DOWN | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_QUARTER_HELIX_LARGE_DOWN | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1455,7 +1455,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER || ride->type == RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER) { if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT && _currentTrackCurve == TRACK_CURVE_NONE) { _currentTrackCurve = TRACK_ELEM_REVERSE_FREEFALL_SLOPE | 0x100; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } else { loc_6C7502(2); @@ -1467,22 +1467,22 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_LARGE | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_LARGE | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_SMALL | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_SMALL | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1490,12 +1490,12 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_QUARTER_BANKED_HELIX_LARGE_UP | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_QUARTER_BANKED_HELIX_LARGE_UP | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1504,12 +1504,12 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentTrackCurve == TRACK_CURVE_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_QUARTER_HELIX_LARGE_UP | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } else if (_currentTrackCurve == TRACK_CURVE_RIGHT) { _currentTrackCurve = TRACK_ELEM_RIGHT_QUARTER_HELIX_LARGE_UP | 0x100; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; } } @@ -1527,14 +1527,14 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; } _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_BANK_LEFT: sub_6C9627(); if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_LEFT; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } break; case WIDX_BANK_STRAIGHT: @@ -1542,7 +1542,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_NONE; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } else { uint8 *brakesSpeedPtr = &_currentBrakeSpeed2; uint8 maxBrakesSpeed = 30; @@ -1556,7 +1556,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ ride_construction_set_brakes_speed(brakesSpeed); } else { *brakesSpeedPtr = brakesSpeed; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1566,7 +1566,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_RIGHT; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } else { uint8 *brakesSpeedPtr = &_currentBrakeSpeed2; if (_currentlyShowingBrakeSpeed != 1) { @@ -1578,7 +1578,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ ride_construction_set_brakes_speed(brakesSpeed); } else { *brakesSpeedPtr = brakesSpeed; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1590,14 +1590,14 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ sub_6C9627(); _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_O_TRACK: sub_6C9627(); _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; _currentTrackLiftHill &= ~1; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); break; case WIDX_SEAT_ROTATION_ANGLE_SPINNER_UP: if (_currentSeatRotationAngle < 15) { @@ -1605,7 +1605,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ ride_selected_track_set_seat_rotation(_currentSeatRotationAngle + 1); } else { _currentSeatRotationAngle++; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } break; @@ -1615,7 +1615,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ ride_selected_track_set_seat_rotation(_currentSeatRotationAngle - 1); } else { _currentSeatRotationAngle--; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } break; @@ -1649,7 +1649,7 @@ static void window_ride_construction_dropdown(rct_window *w, rct_widgetindex wid break; } _currentTrackCurve = trackPiece | 0x100; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -1665,7 +1665,7 @@ static void window_ride_construction_construct(rct_window *w) _trackPlaceCost = MONEY32_UNDEFINED; sub_6C9627(); if (sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, &x, &y, &z, &properties)) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1691,7 +1691,7 @@ static void window_ride_construction_construct(rct_window *w) if (_trackPlaceCost == MONEY32_UNDEFINED) { if (network_get_mode() == NETWORK_MODE_CLIENT) game_command_callback = 0; // don't do callback if we can't afford the track piece - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1767,7 +1767,7 @@ static void window_ride_construction_construct(rct_window *w) if (network_get_mode() == NETWORK_MODE_CLIENT) return; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -1789,13 +1789,13 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) _rideConstructionState2 = RIDE_CONSTRUCTION_STATE_SELECTED; if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT) { if (!ride_select_backwards_from_front()) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } _rideConstructionState2 = RIDE_CONSTRUCTION_STATE_FRONT; } else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK) { if (!ride_select_forwards_from_back()) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } _rideConstructionState2 = RIDE_CONSTRUCTION_STATE_BACK; @@ -1808,7 +1808,7 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) direction = _currentTrackPieceDirection; type = _currentTrackPieceType; if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &mapElement, 0)) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1838,7 +1838,7 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) type = _currentTrackPieceType; if (sub_6C683D(&x, &y, &z, direction, type, 0, &mapElement, 0)) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1856,7 +1856,7 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) GAME_COMMAND_FLAG_APPLY ); if (cost == MONEY32_UNDEFINED) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1890,7 +1890,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si sint32 b5 = _currentTrackAlternative; sint32 b4 = _currentTrackLiftHill; ride_construction_set_default_next_piece(); - sub_6C84CE(); + window_ride_construction_update_active_elements(); if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { sub_6CC3FB(_currentRideIndex); _currentTrackPieceDirection = direction; @@ -1902,7 +1902,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si _currentTrackBankEnd = bankStart; _currentTrackAlternative = b5; _currentTrackLiftHill = b4; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1937,7 +1937,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si else if (_rideConstructionState2 == RIDE_CONSTRUCTION_STATE_BACK) { ride_select_previous_section(); } - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } @@ -1950,7 +1950,7 @@ static void window_ride_construction_rotate(rct_window *w) _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; sub_6C9627(); _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -1973,7 +1973,7 @@ static void window_ride_construction_entrance_click(rct_window *w) gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; _rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT; } - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } @@ -1997,7 +1997,7 @@ static void window_ride_construction_exit_click(rct_window *w) gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; _rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT; } - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } @@ -2035,7 +2035,7 @@ static void window_ride_construction_update(rct_window *w) if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) { if (!widget_is_active_tool(w, WIDX_ENTRANCE) && !widget_is_active_tool(w, WIDX_EXIT)) { _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } @@ -2469,7 +2469,7 @@ static void sub_6CBCE2( * * rct2: 0x006C84CE */ -void sub_6C84CE() +void window_ride_construction_update_active_elements() { rct_window *w; rct_map_element *mapElement; @@ -2819,7 +2819,7 @@ void sub_6C94D8() sub_6C96C0(); } else { _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } _rideConstructionArrowPulseTime--; @@ -3587,7 +3587,7 @@ static void ride_selected_track_set_seat_rotation(sint32 seatRotation) y = _currentTrackBeginY; z = _currentTrackBeginZ; sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, seatRotation, NULL, (1 << 5)); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -3603,7 +3603,7 @@ static void loc_6C7502(sint32 al) _currentTrackLiftHill &= ~1; } } - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -3629,7 +3629,7 @@ static void ride_construction_set_brakes_speed(sint32 brakesSpeed) 0 ); } - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** @@ -3769,7 +3769,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) _currentTrackBeginZ += 16; } - sub_6C84CE(); + window_ride_construction_update_active_elements(); map_invalidate_map_selection_tiles(); } @@ -3817,7 +3817,7 @@ void ride_construction_toolupdate_entrance_exit(sint32 screenX, sint32 screenY) _currentTrackPrice = ride_entrance_exit_place_ghost( _currentRideIndex, x, y, direction, gRideEntranceExitPlaceType, stationNum ); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } @@ -3956,7 +3956,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) _currentTrackBeginZ = z; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w == NULL) break; From 881c0c2537bb84e50e7038b9f1216a758595a54b Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 21:56:42 +0100 Subject: [PATCH 02/38] Name sub_65E72D() --- src/openrct2/ride/ride_ratings.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/ride/ride_ratings.c b/src/openrct2/ride/ride_ratings.c index 6b6a09f382..12113e17be 100644 --- a/src/openrct2/ride/ride_ratings.c +++ b/src/openrct2/ride/ride_ratings.c @@ -939,7 +939,7 @@ static uint32 ride_ratings_get_proximity_score() * Seems to calculate how much of the track is sheltered in eighths. * rct2: 0x0065E72D */ -static sint32 sub_65E72D(rct_ride *ride) +static sint32 get_num_of_sheltered_eighths(rct_ride *ride) { sint32 totalLength = ride_get_total_length(ride); sint32 shelteredLength = ride->sheltered_length; @@ -1731,7 +1731,7 @@ static void ride_ratings_calculate_miniature_railway(rct_ride *ride) ride->upkeep_cost = ride_compute_upkeep(ride); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); if (((edx >> 8) & 0xFF) >= 4) ride->excitement /= 4; @@ -1767,7 +1767,7 @@ static void ride_ratings_calculate_monorail(rct_ride *ride) ride->upkeep_cost = ride_compute_upkeep(ride); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); if (((edx >> 8) & 0xFF) >= 4) ride->excitement /= 4; @@ -2083,7 +2083,7 @@ static void ride_ratings_calculate_observation_tower(rct_ride *ride) ride->inversions &= 0x1F; ride->inversions |= 7 << 5; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); if (((edx >> 8) & 0xFF) >= 5) ride->excitement /= 4; } @@ -2248,7 +2248,7 @@ static void ride_ratings_calculate_chairlift(rct_ride *ride) ride->upkeep_cost = ride_compute_upkeep(ride); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); if (((edx >> 8) & 0xFF) >= 4) ride->excitement /= 4; @@ -2403,7 +2403,7 @@ static void ride_ratings_calculate_go_karts(rct_ride *ride) ride->upkeep_cost = ride_compute_upkeep(ride); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); ride->inversions &= 0x1F; ride->inversions |= edx << 5; @@ -2856,7 +2856,7 @@ static void ride_ratings_calculate_lift(rct_ride *ride) ride->inversions &= 0x1F; ride->inversions |= 7 << 5; - if ((sub_65E72D(ride) >> 8) >= 5) + if ((get_num_of_sheltered_eighths(ride) >> 8) >= 5) ride->excitement /= 4; } @@ -3182,7 +3182,7 @@ static void ride_ratings_calculate_suspended_monorail(rct_ride *ride) ride->upkeep_cost = ride_compute_upkeep(ride); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - sint32 edx = sub_65E72D(ride); + sint32 edx = get_num_of_sheltered_eighths(ride); if (((edx >> 8) & 0xFF) >= 4) ride->excitement /= 4; From 6efc781186c0ce32a68d95776efd895fe628568c Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 21:57:52 +0100 Subject: [PATCH 03/38] Fix comment for get_num_of_sheltered_eighths() [ci skip] --- src/openrct2/ride/ride_ratings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/ride/ride_ratings.c b/src/openrct2/ride/ride_ratings.c index 12113e17be..12209f4069 100644 --- a/src/openrct2/ride/ride_ratings.c +++ b/src/openrct2/ride/ride_ratings.c @@ -936,7 +936,7 @@ static uint32 ride_ratings_get_proximity_score() } /** - * Seems to calculate how much of the track is sheltered in eighths. + * Calculates how much of the track is sheltered in eighths. * rct2: 0x0065E72D */ static sint32 get_num_of_sheltered_eighths(rct_ride *ride) From 7a4511e11a9b566e3ddc2df305b79498e21f48cf Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 22:09:33 +0100 Subject: [PATCH 04/38] Name some sub_hex instances that Xcode missed --- src/openrct2/ride/ride.c | 32 +++++------ src/openrct2/ride/ride_ratings.c | 92 ++++++++++++++++---------------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index e82eb6fe0a..665eeddc55 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1337,7 +1337,7 @@ void ride_restore_provisional_track_piece() sub_6C96C0(); } else { _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1619,7 +1619,7 @@ void ride_select_next_section() rct_map_element *mapElement; if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &mapElement, 0)) { _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } rct_xy_element inputElement, outputElement; @@ -1640,7 +1640,7 @@ void ride_select_next_section() _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; ride_construction_set_default_next_piece(); - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } @@ -1651,10 +1651,10 @@ void ride_select_next_section() _currentTrackPieceType = mapElement->properties.track.type; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK) { if (ride_select_forwards_from_back()) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1675,7 +1675,7 @@ void ride_select_previous_section() rct_map_element *mapElement; if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &mapElement, 0)) { _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); return; } track_begin_end trackBeginEnd; @@ -1687,7 +1687,7 @@ void ride_select_previous_section() _currentTrackPieceType = trackBeginEnd.begin_element->properties.track.type; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); } else { _rideConstructionState = RIDE_CONSTRUCTION_STATE_BACK; _currentTrackBeginX = trackBeginEnd.end_x; @@ -1698,11 +1698,11 @@ void ride_select_previous_section() _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; ride_construction_set_default_next_piece(); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } else if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT) { if (ride_select_backwards_from_front()) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); } } } @@ -1752,7 +1752,7 @@ static sint32 ride_modify_entrance_or_exit(rct_map_element *mapElement, sint32 x _rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT; } - sub_6C84CE(); + window_ride_construction_update_active_elements(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; } else { // Remove entrance / exit @@ -1848,13 +1848,13 @@ sint32 ride_modify(rct_xy_element *input) _rideConstructionArrowPulseTime = 0; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_NO_TRACK)) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return 1; } ride_select_next_section(); if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT) { - sub_6C84CE(); + window_ride_construction_update_active_elements(); return 1; } @@ -1880,7 +1880,7 @@ sint32 ride_modify(rct_xy_element *input) _rideConstructionArrowPulseTime = 0; } - sub_6C84CE(); + window_ride_construction_update_active_elements(); return 1; } @@ -1926,7 +1926,7 @@ sint32 sub_6CC3FB(sint32 rideIndex) _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - sub_6C84CE(); + window_ride_construction_update_active_elements(); return 1; } @@ -6215,7 +6215,7 @@ void game_command_callback_ride_construct_placed_back(sint32 eax, sint32 ebx, si } window_ride_construction_do_station_check(); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } void game_command_callback_ride_construct_placed_front(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp) @@ -6249,7 +6249,7 @@ void game_command_callback_ride_construct_placed_front(sint32 eax, sint32 ebx, s window_ride_construction_do_station_check(); window_ride_construction_do_entrance_exit_check(); - sub_6C84CE(); + window_ride_construction_update_active_elements(); } /** diff --git a/src/openrct2/ride/ride_ratings.c b/src/openrct2/ride/ride_ratings.c index 12209f4069..326039034f 100644 --- a/src/openrct2/ride/ride_ratings.c +++ b/src/openrct2/ride/ride_ratings.c @@ -1537,7 +1537,7 @@ static void ride_ratings_calculate_spiral_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_stand_up_roller_coaster(rct_ride *ride) @@ -1576,7 +1576,7 @@ static void ride_ratings_calculate_stand_up_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_suspended_swinging_coaster(rct_ride *ride) @@ -1617,7 +1617,7 @@ static void ride_ratings_calculate_suspended_swinging_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_inverted_roller_coaster(rct_ride *ride) @@ -1661,7 +1661,7 @@ static void ride_ratings_calculate_inverted_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_junior_roller_coaster(rct_ride *ride) @@ -1700,7 +1700,7 @@ static void ride_ratings_calculate_junior_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_miniature_railway(rct_ride *ride) @@ -1736,7 +1736,7 @@ static void ride_ratings_calculate_miniature_railway(rct_ride *ride) ride->excitement /= 4; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_monorail(rct_ride *ride) @@ -1772,7 +1772,7 @@ static void ride_ratings_calculate_monorail(rct_ride *ride) ride->excitement /= 4; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mini_suspended_coaster(rct_ride *ride) @@ -1812,7 +1812,7 @@ static void ride_ratings_calculate_mini_suspended_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_boat_ride(rct_ride *ride) @@ -1886,7 +1886,7 @@ static void ride_ratings_calculate_wooden_wild_mouse(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_steeplechase(rct_ride *ride) @@ -1927,7 +1927,7 @@ static void ride_ratings_calculate_steeplechase(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_car_ride(rct_ride *ride) @@ -1962,7 +1962,7 @@ static void ride_ratings_calculate_car_ride(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_launched_freefall(rct_ride *ride) @@ -2013,7 +2013,7 @@ static void ride_ratings_calculate_launched_freefall(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_bobsleigh_coaster(rct_ride *ride) @@ -2052,7 +2052,7 @@ static void ride_ratings_calculate_bobsleigh_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_observation_tower(rct_ride *ride) @@ -2131,7 +2131,7 @@ static void ride_ratings_calculate_looping_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_dinghy_slide(rct_ride *ride) @@ -2170,7 +2170,7 @@ static void ride_ratings_calculate_dinghy_slide(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mine_train_coaster(rct_ride *ride) @@ -2211,7 +2211,7 @@ static void ride_ratings_calculate_mine_train_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_chairlift(rct_ride *ride) @@ -2299,7 +2299,7 @@ static void ride_ratings_calculate_corkscrew_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_maze(rct_ride *ride) @@ -2442,7 +2442,7 @@ static void ride_ratings_calculate_log_flume(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_river_rapids(rct_ride *ride) @@ -2476,7 +2476,7 @@ static void ride_ratings_calculate_river_rapids(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_dodgems(rct_ride *ride) @@ -2820,7 +2820,7 @@ static void ride_ratings_calculate_reverse_freefall_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_lift(rct_ride *ride) @@ -2896,7 +2896,7 @@ static void ride_ratings_calculate_vertical_drop_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_cash_machine(rct_ride *ride) @@ -2996,7 +2996,7 @@ static void ride_ratings_calculate_flying_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_virginia_reel(rct_ride *ride) @@ -3034,7 +3034,7 @@ static void ride_ratings_calculate_virginia_reel(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_splash_boats(rct_ride *ride) @@ -3067,7 +3067,7 @@ static void ride_ratings_calculate_splash_boats(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mini_helicopters(rct_ride *ride) @@ -3151,7 +3151,7 @@ static void ride_ratings_calculate_lay_down_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_suspended_monorail(rct_ride *ride) @@ -3238,7 +3238,7 @@ static void ride_ratings_calculate_reverser_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_heartline_twister_coaster(rct_ride *ride) @@ -3279,7 +3279,7 @@ static void ride_ratings_calculate_heartline_twister_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mini_golf(rct_ride *ride) @@ -3320,7 +3320,7 @@ static void ride_ratings_calculate_mini_golf(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_first_aid(rct_ride *ride) @@ -3385,7 +3385,7 @@ static void ride_ratings_calculate_ghost_train(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_twister_roller_coaster(rct_ride *ride) @@ -3431,7 +3431,7 @@ static void ride_ratings_calculate_twister_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_wooden_roller_coaster(rct_ride *ride) @@ -3472,7 +3472,7 @@ static void ride_ratings_calculate_wooden_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_side_friction_roller_coaster(rct_ride *ride) @@ -3512,7 +3512,7 @@ static void ride_ratings_calculate_side_friction_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_wild_mouse(rct_ride *ride) @@ -3553,7 +3553,7 @@ static void ride_ratings_calculate_wild_mouse(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_multi_dimension_roller_coaster(rct_ride *ride) @@ -3599,7 +3599,7 @@ static void ride_ratings_calculate_multi_dimension_roller_coaster(rct_ride *ride ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_giga_coaster(rct_ride *ride) @@ -3645,7 +3645,7 @@ static void ride_ratings_calculate_giga_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_roto_drop(rct_ride *ride) @@ -3677,7 +3677,7 @@ static void ride_ratings_calculate_roto_drop(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_flying_saucers(rct_ride *ride) @@ -3783,7 +3783,7 @@ static void ride_ratings_calculate_monorail_cycles(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_compact_inverted_coaster(rct_ride *ride) @@ -3827,7 +3827,7 @@ static void ride_ratings_calculate_compact_inverted_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_water_coaster(rct_ride *ride) @@ -3869,7 +3869,7 @@ static void ride_ratings_calculate_water_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_air_powered_vertical_coaster(rct_ride *ride) @@ -3901,7 +3901,7 @@ static void ride_ratings_calculate_air_powered_vertical_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_inverted_hairpin_coaster(rct_ride *ride) @@ -3943,7 +3943,7 @@ static void ride_ratings_calculate_inverted_hairpin_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_magic_carpet(rct_ride *ride) @@ -4028,7 +4028,7 @@ static void ride_ratings_calculate_river_rafts(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_enterprise(rct_ride *ride) @@ -4099,7 +4099,7 @@ static void ride_ratings_calculate_inverted_impulse_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mini_roller_coaster(rct_ride *ride) @@ -4139,7 +4139,7 @@ static void ride_ratings_calculate_mini_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_mine_ride(rct_ride *ride) @@ -4176,7 +4176,7 @@ static void ride_ratings_calculate_mine_ride(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } static void ride_ratings_calculate_lim_launched_roller_coaster(rct_ride *ride) @@ -4222,7 +4222,7 @@ static void ride_ratings_calculate_lim_launched_roller_coaster(rct_ride *ride) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; ride->inversions &= 0x1F; - ride->inversions |= sub_65E72D(ride) << 5; + ride->inversions |= get_num_of_sheltered_eighths(ride) << 5; } #pragma endregion From d191aaa1eff19ffbf85b1e732c5f19f079f7f824 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 22:36:33 +0100 Subject: [PATCH 05/38] Name sub_6C9627() --- src/openrct2/ride/ride.c | 28 +++++----- src/openrct2/ride/ride.h | 2 +- src/openrct2/windows/maze_construction.c | 8 +-- src/openrct2/windows/ride_construction.c | 66 ++++++++++++------------ 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 665eeddc55..723de7f557 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -776,7 +776,7 @@ sint32 ride_find_track_gap(rct_xy_element *input, rct_xy_element *output) w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex) - sub_6C9627(); + ride_construction_invalidate_current_track(); bool counter = true; track_circuit_iterator_begin(&it, *input); @@ -972,7 +972,7 @@ static rct_window *ride_create_or_find_construction_window(sint32 rideIndex) _currentRideIndex = rideIndex; w = window_ride_construction_open(); } else { - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentRideIndex = rideIndex; } @@ -1401,7 +1401,7 @@ void sub_6C96C0() } } -void sub_6C9627() +void ride_construction_invalidate_current_track() { sint32 x, y, z; @@ -1610,7 +1610,7 @@ void ride_construction_set_default_next_piece() void ride_select_next_section() { if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) { - sub_6C9627(); + ride_construction_invalidate_current_track(); sint32 x = _currentTrackBeginX; sint32 y = _currentTrackBeginY; sint32 z = _currentTrackBeginZ; @@ -1666,7 +1666,7 @@ void ride_select_next_section() void ride_select_previous_section() { if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) { - sub_6C9627(); + ride_construction_invalidate_current_track(); sint32 x = _currentTrackBeginX; sint32 y = _currentTrackBeginY; sint32 z = _currentTrackBeginZ; @@ -1735,7 +1735,7 @@ static sint32 ride_modify_entrance_or_exit(rct_map_element *mapElement, sint32 x return 0; } - sub_6C9627(); + ride_construction_invalidate_current_track(); if ( _rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) || @@ -4099,7 +4099,7 @@ static sint32 ride_check_block_brakes(rct_xy_element *input, rct_xy_element *out rideIndex = input->element->properties.track.ride_index; w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex) - sub_6C9627(); + ride_construction_invalidate_current_track(); track_circuit_iterator_begin(&it, *input); while (track_circuit_iterator_next(&it)) { @@ -4148,7 +4148,7 @@ static bool ride_check_track_contains_inversions(rct_xy_element *input, rct_xy_e rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex) { - sub_6C9627(); + ride_construction_invalidate_current_track(); } track_circuit_iterator it; @@ -4179,7 +4179,7 @@ static bool ride_check_track_contains_banked(rct_xy_element *input, rct_xy_eleme rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex) { - sub_6C9627(); + ride_construction_invalidate_current_track(); } track_circuit_iterator it; @@ -4204,7 +4204,7 @@ static sint32 ride_check_station_length(rct_xy_element *input, rct_xy_element *o if (w != 0 && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == input->element->properties.track.ride_index){ - sub_6C9627(); + ride_construction_invalidate_current_track(); } output->x = input->x; @@ -4259,7 +4259,7 @@ static bool ride_check_start_and_end_is_station(rct_xy_element *input, rct_xy_el w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex) { - sub_6C9627(); + ride_construction_invalidate_current_track(); } // Check back of the track @@ -7196,7 +7196,7 @@ bool ride_select_backwards_from_front() { track_begin_end trackBeginEnd; - sub_6C9627(); + ride_construction_invalidate_current_track(); if (track_block_get_previous_from_zero(_currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ, _currentRideIndex, _currentTrackPieceDirection, &trackBeginEnd)) { _rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED; _currentTrackBeginX = trackBeginEnd.begin_x; @@ -7216,7 +7216,7 @@ bool ride_select_forwards_from_back() { sint32 x, y, z, direction; - sub_6C9627(); + ride_construction_invalidate_current_track(); x = _currentTrackBeginX; y = _currentTrackBeginY; @@ -7488,7 +7488,7 @@ foundTrack: w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex) { - sub_6C9627(); + ride_construction_invalidate_current_track(); } result = 0; diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index 61081ada3b..e65597203a 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -1037,7 +1037,7 @@ rct_ride_measurement *ride_get_measurement(sint32 rideIndex, rct_string_id *mess void ride_breakdown_add_news_item(sint32 rideIndex); rct_peep *ride_find_closest_mechanic(rct_ride *ride, sint32 forInspection); sint32 sub_6CC3FB(sint32 rideIndex); -void sub_6C9627(); +void ride_construction_invalidate_current_track(); sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type, uint16 extra_params, rct_map_element** output_element, uint16 flags); void ride_set_map_tooltip(rct_map_element *mapElement); sint32 ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint16 sampleRate, uint32 position, uint8 *tuneId); diff --git a/src/openrct2/windows/maze_construction.c b/src/openrct2/windows/maze_construction.c index 5a2043d20f..6b5eff43dd 100644 --- a/src/openrct2/windows/maze_construction.c +++ b/src/openrct2/windows/maze_construction.c @@ -166,7 +166,7 @@ rct_window *window_maze_construction_open() */ static void window_maze_construction_close(rct_window *w) { - sub_6C9627(); + ride_construction_invalidate_current_track(); viewport_set_visibility(0); map_invalidate_map_selection_tiles(); @@ -199,7 +199,7 @@ static void window_maze_construction_entrance_mouseup(rct_window *w, rct_widgeti gRideEntranceExitPlaceStationIndex = 0; input_set_flag(INPUT_FLAG_6, true); - sub_6C9627(); + ride_construction_invalidate_current_track(); // ??? uint8 old_state = _rideConstructionState; @@ -352,7 +352,7 @@ static void window_maze_construction_toolupdate(rct_window* w, rct_widgetindex w * rct2: 0x006C825F */ static void window_maze_construction_entrance_tooldown(sint32 x, sint32 y, rct_window* w){ - sub_6C9627(); + ride_construction_invalidate_current_track(); map_invalidate_selection_rect(); @@ -484,7 +484,7 @@ static void window_maze_construction_construct(sint32 direction) { sint32 x, y, z, flags, mode; - sub_6C9627(); + ride_construction_invalidate_current_track(); x = _currentTrackBeginX + (TileDirectionDelta[direction].x / 2); y = _currentTrackBeginY + (TileDirectionDelta[direction].y / 2); diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index 92fb0a9bb2..503405188e 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -642,7 +642,7 @@ rct_window *window_ride_construction_open() */ static void window_ride_construction_close(rct_window *w) { - sub_6C9627(); + ride_construction_invalidate_current_track(); viewport_set_visibility(0); map_invalidate_map_selection_tiles(); @@ -1309,55 +1309,55 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ window_ride_construction_update_enabled_track_pieces(); switch (widgetIndex) { case WIDX_LEFT_CURVE: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_LEFT; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_RIGHT; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_SMALL: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_LEFT_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_SMALL: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_RIGHT_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_VERY_SMALL: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_LEFT_VERY_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_VERY_SMALL: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_RIGHT_VERY_SMALL; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_LEFT_CURVE_LARGE: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_LEFT_LARGE; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_RIGHT_CURVE_LARGE: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackCurve = TRACK_CURVE_RIGHT_LARGE; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_STRAIGHT: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_currentTrackCurve != TRACK_CURVE_NONE) _currentTrackBankEnd = TRACK_BANK_NONE; _currentTrackCurve = TRACK_CURVE_NONE; @@ -1365,7 +1365,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ window_ride_construction_update_active_elements(); break; case WIDX_SLOPE_DOWN_STEEP: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (is_track_enabled(TRACK_HELIX_SMALL)) { if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_LARGE | 0x100; @@ -1424,14 +1424,14 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ } break; case WIDX_SLOPE_DOWN: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_rideConstructionState == 2 && _currentTrackBankEnd != TRACK_BANK_NONE) { _currentTrackBankEnd = TRACK_BANK_NONE; } loc_6C7502(6); break; case WIDX_LEVEL: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_FRONT && _previousTrackSlopeEnd == 6) { if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL) { _currentTrackBankEnd = TRACK_BANK_LEFT; @@ -1448,7 +1448,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ loc_6C7502(0); break; case WIDX_SLOPE_UP: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_rideConstructionState == 1 && _currentTrackBankEnd != TRACK_BANK_NONE) { _currentTrackBankEnd = TRACK_BANK_NONE; } @@ -1462,7 +1462,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ } break; case WIDX_SLOPE_UP_STEEP: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (is_track_enabled(TRACK_HELIX_SMALL)) { if (_currentTrackCurve == TRACK_CURVE_LEFT && _currentTrackBankEnd == TRACK_BANK_LEFT) { _currentTrackCurve = TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_LARGE | 0x100; @@ -1521,7 +1521,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ } break; case WIDX_CHAIN_LIFT: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackLiftHill ^= 1; if (_currentTrackLiftHill & 1) { _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; @@ -1530,7 +1530,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ window_ride_construction_update_active_elements(); break; case WIDX_BANK_LEFT: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_LEFT; _currentTrackPrice = MONEY32_UNDEFINED; @@ -1538,7 +1538,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ } break; case WIDX_BANK_STRAIGHT: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_NONE; _currentTrackPrice = MONEY32_UNDEFINED; @@ -1562,7 +1562,7 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ } break; case WIDX_BANK_RIGHT: - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_currentlyShowingBrakeSpeed == 0) { _currentTrackBankEnd = TRACK_BANK_RIGHT; _currentTrackPrice = MONEY32_UNDEFINED; @@ -1587,13 +1587,13 @@ static void window_ride_construction_mousedown(rct_widgetindex widgetIndex, rct_ window_ride_construction_show_special_track_dropdown(w, widget); break; case WIDX_U_TRACK: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackAlternative &= ~RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); break; case WIDX_O_TRACK: - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_PIECES; _currentTrackLiftHill &= ~1; _currentTrackPrice = MONEY32_UNDEFINED; @@ -1633,7 +1633,7 @@ static void window_ride_construction_dropdown(rct_window *w, rct_widgetindex wid if (dropdownIndex == -1) return; - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackPrice = MONEY32_UNDEFINED; sint32 trackPiece = _currentPossibleRideConfigurations[dropdownIndex]; switch (trackPiece) { @@ -1663,7 +1663,7 @@ static void window_ride_construction_construct(rct_window *w) _currentTrackPrice = MONEY32_UNDEFINED; _trackPlaceCost = MONEY32_UNDEFINED; - sub_6C9627(); + ride_construction_invalidate_current_track(); if (sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, &x, &y, &z, &properties)) { window_ride_construction_update_active_elements(); return; @@ -1783,7 +1783,7 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) //bool gotoStartPlacementMode; _currentTrackPrice = MONEY32_UNDEFINED; - sub_6C9627(); + ride_construction_invalidate_current_track(); // Select the track element that is to be deleted _rideConstructionState2 = RIDE_CONSTRUCTION_STATE_SELECTED; @@ -1948,7 +1948,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si static void window_ride_construction_rotate(rct_window *w) { _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackPrice = MONEY32_UNDEFINED; window_ride_construction_update_active_elements(); } @@ -1968,7 +1968,7 @@ static void window_ride_construction_entrance_click(rct_window *w) gRideEntranceExitPlaceRideIndex = w->number & 0xFF; gRideEntranceExitPlaceStationIndex = 0; input_set_flag(INPUT_FLAG_6, true); - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; _rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT; @@ -1992,7 +1992,7 @@ static void window_ride_construction_exit_click(rct_window *w) gRideEntranceExitPlaceRideIndex = w->number & 0xFF; gRideEntranceExitPlaceStationIndex = 0; input_set_flag(INPUT_FLAG_6, true); - sub_6C9627(); + ride_construction_invalidate_current_track(); if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; _rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT; @@ -2807,7 +2807,7 @@ void sub_6C94D8() // Recheck if area is fine for new track. // Set by footpath placement if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_RECHECK) { - sub_6C9627(); + ride_construction_invalidate_current_track(); _currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_RECHECK; } @@ -3647,7 +3647,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; if (!ride_get_place_position_from_screen_position(screenX, screenY, &x, &y)) { - sub_6C9627(); + ride_construction_invalidate_current_track(); map_invalidate_map_selection_tiles(); return; } @@ -3670,7 +3670,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) sint32 trackType, trackDirection, rideIndex, edxRS16; if (sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, NULL, NULL, NULL, NULL)) { - sub_6C9627(); + ride_construction_invalidate_current_track(); map_invalidate_map_selection_tiles(); return; } @@ -3789,7 +3789,7 @@ void ride_construction_toolupdate_entrance_exit(sint32 screenX, sint32 screenY) gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; ride_get_entrance_or_exit_position_from_screen_position(screenX, screenY, &x, &y, &direction); if (gRideEntranceExitPlaceDirection == 255) { - sub_6C9627(); + ride_construction_invalidate_current_track(); return; } gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; @@ -3832,7 +3832,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) rct_window *w; map_invalidate_map_selection_tiles(); - sub_6C9627(); + ride_construction_invalidate_current_track(); if (sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, &x, &y, &z, &properties)) return; @@ -4028,7 +4028,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) */ static void ride_construction_tooldown_entrance_exit(sint32 screenX, sint32 screenY) { - sub_6C9627(); + ride_construction_invalidate_current_track(); map_invalidate_selection_rect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; From 7a3bc1e5fdf5af7cb01c153a7d9387abbb0557b4 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 22:40:33 +0100 Subject: [PATCH 06/38] Rename rct_ride->undercover_portion to sheltered_eighths. --- src/openrct2/peep/peep.c | 2 +- src/openrct2/ride/ride.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index dd0c19a46d..81edc3cfe6 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -11775,7 +11775,7 @@ static bool peep_should_go_on_ride(rct_peep *peep, sint32 rideIndex, sint32 entr // Peeps won't go on rides that aren't sufficiently undercover while it's raining. // The threshold is fairly low and only requires about 10-15% of the ride to be undercover. - if (gClimateCurrentRainLevel != 0 && (ride->undercover_portion >> 5) < 3) { + if (gClimateCurrentRainLevel != 0 && (ride->sheltered_eighths >> 5) < 3) { if (peepAtRide) { peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_NOT_WHILE_RAINING, rideIndex); if (peep->happiness_growth_rate >= 64) { diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index e65597203a..2059ee339d 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -220,9 +220,9 @@ typedef struct rct_ride { union { uint8 inversions; // 0x114 (???X XXXX) uint8 holes; // 0x114 (???X XXXX) - // The undercover portion is a very rough approximation of how much of the ride is undercover. + // This a very rough approximation of how much of the ride is undercover. // It reaches the maximum value of 7 at about 50% undercover and doesn't increase beyond that. - uint8 undercover_portion; // 0x114 (XXX?-????) + uint8 sheltered_eighths; // 0x114 (XXX?-????) }; // Y is number of powered lifts, X is drops uint8 drops; // 0x115 (YYXX XXXX) From 954124738c85cf1421d502f6a92c9bd6344257ec Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Thu, 1 Jun 2017 22:46:02 +0100 Subject: [PATCH 07/38] Name sub_693B58(), and minor formatting tweak to it --- src/openrct2/peep/peep.c | 82 +++++++++++++++--------------- src/openrct2/peep/peep.h | 2 +- src/openrct2/peep/staff.c | 4 +- src/openrct2/world/footpath.c | 2 +- src/openrct2/world/map_animation.c | 2 +- 5 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 81edc3cfe6..e3b7b6f8ef 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -909,7 +909,7 @@ static void sub_68F41A(rct_peep *peep, sint32 index) } peep->action_sprite_type = 0xFF; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); return; } @@ -1219,7 +1219,7 @@ static void sub_68F41A(rct_peep *peep, sint32 index) peep->action = PEEP_ACTION_THROW_UP; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -1392,12 +1392,14 @@ static uint8 peep_get_action_sprite_type(rct_peep* peep) } } -void sub_693B58(rct_peep* peep){ +void peep_update_current_action_sprite_type(rct_peep* peep){ if (peep->sprite_type >= countof(g_peep_animation_entries)) { return; } uint8 action_sprite_type = peep_get_action_sprite_type(peep); - if (action_sprite_type == peep->action_sprite_type)return; + if (action_sprite_type == peep->action_sprite_type) { + return; + } invalidate_sprite_2((rct_sprite*)peep); peep->action_sprite_type = action_sprite_type; @@ -1420,7 +1422,7 @@ void sub_693BE5(rct_peep* peep, uint8 al){ if (peep->action >= PEEP_ACTION_NONE_1){ peep->action_sprite_image_offset = 0; } - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); } /** @@ -1587,7 +1589,7 @@ static sint32 peep_update_action(sint16* x, sint16* y, sint16* xy_distance, rct_ if (peep->action_frame >= peepAnimation[peep->action_sprite_type].num_frames){ peep->action_sprite_image_offset = 0; peep->action = 0xFF; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); *x = peep->x; *y = peep->y; @@ -1658,7 +1660,7 @@ static void set_sprite_type(rct_peep* peep, uint8 type){ } peep->action_sprite_type = 0xFF; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); if (peep->state == PEEP_STATE_SITTING){ peep->action = PEEP_ACTION_NONE_1; @@ -1924,7 +1926,7 @@ bool peep_pickup_place(rct_peep* peep, sint32 x, sint32 y, sint32 z, bool apply) if (peep->type == PEEP_TYPE_GUEST) { peep->action_sprite_type = 0xFF; peep->happiness_growth_rate = max(peep->happiness_growth_rate - 10, 0); - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); } network_set_pickup_peep(game_command_playerid, 0); @@ -2113,7 +2115,7 @@ static void peep_update_falling(rct_peep* peep){ peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); peep_window_state_update(peep); return; @@ -2178,7 +2180,7 @@ static void peep_try_get_up_from_sitting(rct_peep* peep){ peep->destination_x = (peep->x & 0xFFE0) + 16; peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerence = 5; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); } /** rct2: 0x00981F2C, 0x00981F2E */ @@ -2244,7 +2246,7 @@ static void peep_update_sitting(rct_peep* peep){ peep->destination_x = (peep->x & 0xFFE0) + 16; peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerence = 5; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); return; } @@ -2261,7 +2263,7 @@ static void peep_update_sitting(rct_peep* peep){ peep->action = PEEP_ACTION_SITTING_EAT_FOOD; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -2286,7 +2288,7 @@ static void peep_update_sitting(rct_peep* peep){ } peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -3840,7 +3842,7 @@ static void peep_update_ride_sub_state_17(rct_peep* peep){ peep->action = PEEP_ACTION_JUMP; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -4378,7 +4380,7 @@ static bool peep_update_fixing_sub_state_2345(bool firstRun, rct_peep *peep, rct peep->action = (scenario_rand() & 1) ? PEEP_ACTION_STAFF_FIX_2 : PEEP_ACTION_STAFF_FIX; peep->action_sprite_image_offset = 0; peep->action_frame = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4415,7 +4417,7 @@ static bool peep_update_fixing_sub_state_6(bool firstRun, rct_peep *peep, rct_ri peep->action_sprite_image_offset = 0; peep->action_frame = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4513,7 +4515,7 @@ static bool peep_update_fixing_sub_state_8(bool firstRun, rct_peep *peep) { peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4618,7 +4620,7 @@ static bool peep_update_fixing_sub_state_10(bool firstRun, rct_peep *peep, rct_r peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4644,7 +4646,7 @@ static bool peep_update_fixing_sub_state_11(bool firstRun, rct_peep *peep, rct_r peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4736,7 +4738,7 @@ static bool peep_update_fixing_sub_state_13(bool firstRun, sint32 steps, rct_pee peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite *) peep); } @@ -4876,7 +4878,7 @@ static void peep_update_queuing(rct_peep* peep){ peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } if (peep->time_in_queue >= 3500 && (0xFFFF & scenario_rand()) <= 93) @@ -4914,7 +4916,7 @@ static void peep_update_queuing(rct_peep* peep){ peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); break; } @@ -5007,7 +5009,7 @@ static void peep_update_watering(rct_peep* peep){ peep->action = PEEP_ACTION_STAFF_WATERING; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); peep->sub_state = 1; @@ -5063,7 +5065,7 @@ static void peep_update_emptying_bin(rct_peep* peep){ peep->action = PEEP_ACTION_STAFF_EMPTY_BIN; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); peep->sub_state = 1; @@ -5146,7 +5148,7 @@ static void peep_update_sweeping(rct_peep* peep){ peep->action = PEEP_ACTION_STAFF_SWEEP; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -5263,7 +5265,7 @@ static void peep_update_watching(rct_peep* peep){ peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -5273,7 +5275,7 @@ static void peep_update_watching(rct_peep* peep){ peep->action = PEEP_ACTION_TAKE_PHOTO; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -5283,7 +5285,7 @@ static void peep_update_watching(rct_peep* peep){ peep->action = PEEP_ACTION_WAVE; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); return; } @@ -5304,7 +5306,7 @@ static void peep_update_watching(rct_peep* peep){ peep->destination_x = (peep->x & 0xFFE0) + 16; peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerence = 5; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); } } @@ -5613,7 +5615,7 @@ static void peep_update_buying(rct_peep* peep) peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); ride->no_primary_items_sold++; @@ -5976,7 +5978,7 @@ static void peep_update_answering(rct_peep* peep){ peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); peep->sub_state = 1; @@ -6369,7 +6371,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -6384,7 +6386,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -6399,7 +6401,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -7002,7 +7004,7 @@ void peep_applause() peep->action = PEEP_ACTION_CLAP; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -7742,7 +7744,7 @@ void peep_insert_new_thought(rct_peep *peep, uint8 thought_type, uint8 thought_a peep->action = action; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } @@ -11255,7 +11257,7 @@ static void peep_give_passing_peeps_pizza(rct_peep *peep, rct_peep *otherPeep) otherPeep->action = PEEP_ACTION_WAVE_2; otherPeep->action_frame = 0; otherPeep->action_sprite_image_offset = 0; - sub_693B58(otherPeep); + peep_update_current_action_sprite_type(otherPeep); invalidate_sprite_2((rct_sprite*)otherPeep); } } @@ -11273,7 +11275,7 @@ static void peep_make_passing_peeps_sick(rct_peep *peep, rct_peep *otherPeep) otherPeep->action = PEEP_ACTION_THROW_UP; otherPeep->action_frame = 0; otherPeep->action_sprite_image_offset = 0; - sub_693B58(otherPeep); + peep_update_current_action_sprite_type(otherPeep); invalidate_sprite_2((rct_sprite*)otherPeep); } } @@ -11313,7 +11315,7 @@ static void peep_easter_egg_peep_interactions(rct_peep *peep) peep->action = PEEP_ACTION_JOY; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } @@ -12544,7 +12546,7 @@ static void peep_read_map(rct_peep *peep) peep->action = PEEP_ACTION_READ_MAP; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); } } diff --git a/src/openrct2/peep/peep.h b/src/openrct2/peep/peep.h index 55c651849a..b2b7730716 100644 --- a/src/openrct2/peep/peep.h +++ b/src/openrct2/peep/peep.h @@ -751,7 +751,7 @@ void peep_decrement_num_riders(rct_peep* peep); void peep_insert_new_thought(rct_peep *peep, uint8 thought_type, uint8 thought_arguments); void peep_set_map_tooltip(rct_peep *peep); -void sub_693B58(rct_peep* peep); +void peep_update_current_action_sprite_type(rct_peep* peep); void remove_peep_from_ride(rct_peep* peep); void remove_peep_from_queue(rct_peep* peep); diff --git a/src/openrct2/peep/staff.c b/src/openrct2/peep/staff.c index faf194f3df..878d2b2ea1 100644 --- a/src/openrct2/peep/staff.c +++ b/src/openrct2/peep/staff.c @@ -434,7 +434,7 @@ void game_command_set_staff_order(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 peep->peep_flags |= PEEP_FLAGS_SLOW_WALK; } peep->action_frame = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); window_invalidate_by_number(WC_PEEP, sprite_id); window_invalidate_by_class(WC_STAFF_LIST); @@ -1346,7 +1346,7 @@ static sint32 staff_path_finding_entertainer(rct_peep* peep) { peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_2((rct_sprite*)peep); staff_entertainer_update_nearby_peeps(peep); } diff --git a/src/openrct2/world/footpath.c b/src/openrct2/world/footpath.c index 27916681f7..4b2b74c705 100644 --- a/src/openrct2/world/footpath.c +++ b/src/openrct2/world/footpath.c @@ -842,7 +842,7 @@ void footpath_interrupt_peeps(sint32 x, sint32 y, sint32 z) peep->destination_x = (peep->x & 0xFFE0) + 16; peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerence = 5; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); } } } diff --git a/src/openrct2/world/map_animation.c b/src/openrct2/world/map_animation.c index 11d02a1db7..61c8e58fce 100644 --- a/src/openrct2/world/map_animation.c +++ b/src/openrct2/world/map_animation.c @@ -213,7 +213,7 @@ static bool map_animation_invalidate_small_scenery(sint32 x, sint32 y, sint32 ba peep->action = PEEP_ACTION_CHECK_TIME; peep->action_frame = 0; peep->action_sprite_image_offset = 0; - sub_693B58(peep); + peep_update_current_action_sprite_type(peep); invalidate_sprite_1((rct_sprite*)peep); break; } From 322a2432bbf88ad910ad8b2051b1d7fa80c77c04 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 00:04:18 +0100 Subject: [PATCH 08/38] Name sub_693C9E() --- src/openrct2/peep/peep.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index e3b7b6f8ef..dcbee12a0a 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -131,7 +131,7 @@ static sint32 peep_empty_container_extra_flag(rct_peep* peep); static sint32 peep_should_find_bench(rct_peep* peep); static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type); static void sub_693BAB(rct_peep* peep); -static sint32 sub_693C9E(rct_peep *peep); +static sint32 peep_perform_next_action(rct_peep *peep); static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32 amount); static void peep_set_has_ridden(rct_peep *peep, sint32 rideIndex); static bool peep_has_ridden(rct_peep *peep, sint32 rideIndex); @@ -2204,7 +2204,7 @@ static void peep_update_sitting(rct_peep* peep){ if (!checkForPath(peep))return; //691541 - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; sint32 ebx = peep->var_37 & 0x7; @@ -4870,7 +4870,7 @@ static void peep_update_queuing(rct_peep* peep){ return; } - sub_693C9E(peep); + peep_perform_next_action(peep); if (peep->action < 0xFE)return; if (peep->sprite_type == PEEP_SPRITE_TYPE_NORMAL) { if (peep->time_in_queue >= 2000 && (0xFFFF & scenario_rand()) <= 119){ @@ -5002,7 +5002,7 @@ static void peep_update_watering(rct_peep* peep){ if (peep->sub_state == 0){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; peep->sprite_direction = (peep->var_37 & 3) << 3; @@ -5058,7 +5058,7 @@ static void peep_update_emptying_bin(rct_peep* peep){ if (peep->sub_state == 0){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; peep->sprite_direction = (peep->var_37 & 3) << 3; @@ -5196,7 +5196,7 @@ static void peep_update_picked(rct_peep* peep){ */ static void peep_update_leaving_park(rct_peep* peep){ if (peep->var_37 != 0){ - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_OUTSIDE_PARK)) return; peep_sprite_remove(peep); return; @@ -5218,7 +5218,7 @@ static void peep_update_leaving_park(rct_peep* peep){ window_invalidate_by_class(WC_GUEST_LIST); - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_OUTSIDE_PARK)) return; peep_sprite_remove(peep); } @@ -5231,7 +5231,7 @@ static void peep_update_watching(rct_peep* peep){ if (peep->sub_state == 0){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; peep->destination_x = peep->x; @@ -5315,7 +5315,7 @@ static void peep_update_watching(rct_peep* peep){ */ static void peep_update_entering_park(rct_peep* peep){ if (peep->var_37 != 1){ - sub_693C9E(peep); + peep_perform_next_action(peep); if ((_unk_F1EE18 & F1EE18_OUTSIDE_PARK)) { decrement_guests_heading_for_park(); peep_sprite_remove(peep); @@ -5721,7 +5721,7 @@ static void peep_update_using_bin(rct_peep* peep){ if (peep->sub_state == 0){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; peep->sub_state = 1; @@ -5895,7 +5895,7 @@ static void peep_update_heading_to_inspect(rct_peep* peep){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_RIDE_EXIT) && !(_unk_F1EE18 & F1EE18_RIDE_ENTRANCE) @@ -6012,7 +6012,7 @@ static void peep_update_answering(rct_peep* peep){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_RIDE_EXIT) && !(_unk_F1EE18 & F1EE18_RIDE_ENTRANCE) @@ -6286,7 +6286,7 @@ static void peep_update_patrolling(rct_peep* peep){ if (!checkForPath(peep))return; - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; if ((peep->next_var_29 & 0x18) == 8){ @@ -6461,7 +6461,7 @@ static void peep_update_walking(rct_peep* peep){ } } - sub_693C9E(peep); + peep_perform_next_action(peep); if (!(_unk_F1EE18 & F1EE18_DESTINATION_REACHED)) return; if ((peep->next_var_29 & 0x18) == 8){ @@ -10437,7 +10437,7 @@ static sint32 guest_path_finding(rct_peep* peep) * * rct2: 0x00693C9E */ -static sint32 sub_693C9E(rct_peep *peep) +static sint32 peep_perform_next_action(rct_peep *peep) { _unk_F1EE18 = 0; uint8 previousAction = peep->action; From 5c28e66aa2a5e4fcbac7535833b44f7ffbd4ff1d Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 00:09:49 +0100 Subject: [PATCH 09/38] Name sub_6D01B3() --- src/openrct2/ride/track_design.c | 12 ++++++------ src/openrct2/ride/track_design.h | 2 +- src/openrct2/ride/track_design_save.c | 4 ++-- src/openrct2/windows/track_place.c | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/openrct2/ride/track_design.c b/src/openrct2/ride/track_design.c index 18187435d6..49cde38aa6 100644 --- a/src/openrct2/ride/track_design.c +++ b/src/openrct2/ride/track_design.c @@ -1268,7 +1268,7 @@ static bool track_design_place_ride(rct_track_td6 *td6, sint16 x, sint16 y, sint * bl == 6, Clear white outlined track. * rct2: 0x006D01B3 */ -sint32 sub_6D01B3(rct_track_td6 *td6, uint8 bl, uint8 rideIndex, sint32 x, sint32 y, sint32 z) +sint32 place_virtual_track(rct_track_td6 *td6, uint8 bl, uint8 rideIndex, sint32 x, sint32 y, sint32 z) { byte_F4414E = (bl & PTD_OPERATION_DONT_PLACE_SCENERY) ? BYTE_F4414E_DONT_PLACE_SCENERY : 0; _trackDesignPlaceOperation = bl & 0x7F; @@ -1361,7 +1361,7 @@ static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 * sint32 mapSize = gMapSize << 4; _currentTrackPieceDirection = 0; - sint32 z = sub_6D01B3(td6, PTD_OPERATION_GET_PLACE_Z, 0, mapSize, mapSize, 16); + sint32 z = place_virtual_track(td6, PTD_OPERATION_GET_PLACE_Z, 0, mapSize, mapSize, 16); if (byte_F4414E & BYTE_F4414E_HAS_SCENERY) { *flags |= TRACK_DESIGN_FLAG_HAS_SCENERY; @@ -1375,7 +1375,7 @@ static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 * *flags |= TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE; } - money32 resultCost = sub_6D01B3(td6, operation, rideIndex, mapSize, mapSize, z); + money32 resultCost = place_virtual_track(td6, operation, rideIndex, mapSize, mapSize, z); gParkFlags = backup_park_flags; if (resultCost != MONEY32_UNDEFINED) { @@ -1441,10 +1441,10 @@ static money32 place_track_design(sint16 x, sint16 y, sint16 z, uint8 flags, uin money32 cost = 0; if (!(flags & GAME_COMMAND_FLAG_APPLY)) { _trackDesignDontPlaceScenery = false; - cost = sub_6D01B3(td6, PTD_OPERATION_1, rideIndex, x, y, z); + cost = place_virtual_track(td6, PTD_OPERATION_1, rideIndex, x, y, z); if (byte_F4414E & BYTE_F4414E_SCENERY_UNAVAILABLE) { _trackDesignDontPlaceScenery = true; - cost = sub_6D01B3(td6, PTD_OPERATION_DONT_PLACE_SCENERY | PTD_OPERATION_1, rideIndex, x, y, z); + cost = place_virtual_track(td6, PTD_OPERATION_DONT_PLACE_SCENERY | PTD_OPERATION_1, rideIndex, x, y, z); } } else { uint8 operation; @@ -1456,7 +1456,7 @@ static money32 place_track_design(sint16 x, sint16 y, sint16 z, uint8 flags, uin if (_trackDesignDontPlaceScenery) operation |= PTD_OPERATION_DONT_PLACE_SCENERY; - cost = sub_6D01B3(td6, operation, rideIndex, x, y, z); + cost = place_virtual_track(td6, operation, rideIndex, x, y, z); } if (cost == MONEY32_UNDEFINED || !(flags & GAME_COMMAND_FLAG_APPLY)) { diff --git a/src/openrct2/ride/track_design.h b/src/openrct2/ride/track_design.h index 67862c7ac1..a9cb3cb73a 100644 --- a/src/openrct2/ride/track_design.h +++ b/src/openrct2/ride/track_design.h @@ -215,7 +215,7 @@ void track_design_dispose(rct_track_td6 *td6); void track_design_mirror(rct_track_td6 *td6); -sint32 sub_6D01B3(rct_track_td6 *td6, uint8 bl, uint8 rideIndex, sint32 x, sint32 y, sint32 z); +sint32 place_virtual_track(rct_track_td6 *td6, uint8 bl, uint8 rideIndex, sint32 x, sint32 y, sint32 z); void game_command_place_track_design(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp); void game_command_place_maze_design(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp); diff --git a/src/openrct2/ride/track_design_save.c b/src/openrct2/ride/track_design_save.c index 47a5a18654..d5afe05c3a 100644 --- a/src/openrct2/ride/track_design_save.c +++ b/src/openrct2/ride/track_design_save.c @@ -927,7 +927,7 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td // Save global vars as they are still used by scenery sint16 startZ = gTrackPreviewOrigin.z; - sub_6D01B3(td6, PTD_OPERATION_DRAW_OUTLINES, 0, 4096, 4096, 0); + place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, 0, 4096, 4096, 0); gTrackPreviewOrigin = (rct_xyz16) { startX, startY, startZ }; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; @@ -1107,7 +1107,7 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track td6->entrance_elements = realloc(td6->entrance_elements, numEntranceElements * sizeof(rct_td6_entrance_element) + 1); *((uint8*)&td6->entrance_elements[numEntranceElements]) = 0xFF; - sub_6D01B3(td6, PTD_OPERATION_DRAW_OUTLINES, 0, 4096, 4096, 0); + place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, 0, 4096, 4096, 0); // Resave global vars for scenery reasons. gTrackPreviewOrigin = (rct_xyz16) { start_x, start_y, start_z }; diff --git a/src/openrct2/windows/track_place.c b/src/openrct2/windows/track_place.c index 3a5a625261..2543212f3f 100644 --- a/src/openrct2/windows/track_place.c +++ b/src/openrct2/windows/track_place.c @@ -262,7 +262,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI // Check if tool map position has changed since last update if (mapX == _window_track_place_last_x && mapY == _window_track_place_last_y) { - sub_6D01B3(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, 0, mapX, mapY, 0); + place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, 0, mapX, mapY, 0); return; } @@ -296,7 +296,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI widget_invalidate(w, WIDX_PRICE); } - sub_6D01B3(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, 0, mapX, mapY, mapZ); + place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, 0, mapX, mapY, mapZ); } /** @@ -384,7 +384,7 @@ static void window_track_place_invalidate(rct_window *w) static void window_track_place_clear_provisional() { if (_window_track_place_last_was_valid) { - sub_6D01B3( + place_virtual_track( _trackDesign, PTD_OPERATION_CLEAR_OUTLINES, _window_track_place_ride_index, @@ -421,7 +421,7 @@ static sint32 window_track_place_get_base_z(sint32 x, sint32 y) if (mapElement->properties.surface.terrain & 0x1F) z = max(z, (mapElement->properties.surface.terrain & 0x1F) << 4); - return z + sub_6D01B3(_trackDesign, PTD_OPERATION_GET_PLACE_Z, 0, x, y, z); + return z + place_virtual_track(_trackDesign, PTD_OPERATION_GET_PLACE_Z, 0, x, y, z); } static void window_track_place_attempt_placement(rct_track_td6 *td6, sint32 x, sint32 y, sint32 z, sint32 bl, money32 *cost, uint8 *rideIndex) From 1d2ced2ad73accb81d7bdeaa9c53f7387f21e2c3 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 00:19:59 +0100 Subject: [PATCH 10/38] Name sub_6CC3FB() --- src/openrct2/ride/ride.c | 6 +++--- src/openrct2/ride/ride.h | 2 +- src/openrct2/windows/ride_construction.c | 8 ++++---- src/openrct2/windows/track_place.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 723de7f557..f117264797 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1021,7 +1021,7 @@ void ride_construct(sint32 rideIndex) if (w != NULL && ride_modify(&trackElement)) window_scroll_to_location(w, trackElement.x, trackElement.y, trackElement.element->base_height * 8); } else { - sub_6CC3FB(rideIndex); + ride_initialise_construction_window(rideIndex); } } @@ -1727,7 +1727,7 @@ static sint32 ride_modify_entrance_or_exit(rct_map_element *mapElement, sint32 x // Get or create construction window for ride constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION); if (constructionWindow == NULL) { - if (!sub_6CC3FB(rideIndex)) + if (!ride_initialise_construction_window(rideIndex)) return 0; constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION); @@ -1888,7 +1888,7 @@ sint32 ride_modify(rct_xy_element *input) * * rct2: 0x006CC3FB */ -sint32 sub_6CC3FB(sint32 rideIndex) +sint32 ride_initialise_construction_window(sint32 rideIndex) { rct_ride *ride; rct_window *w; diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index 2059ee339d..e041a781d5 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -1036,7 +1036,7 @@ void ride_measurements_update(); rct_ride_measurement *ride_get_measurement(sint32 rideIndex, rct_string_id *message); void ride_breakdown_add_news_item(sint32 rideIndex); rct_peep *ride_find_closest_mechanic(rct_ride *ride, sint32 forInspection); -sint32 sub_6CC3FB(sint32 rideIndex); +sint32 ride_initialise_construction_window(sint32 rideIndex); void ride_construction_invalidate_current_track(); sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type, uint16 extra_params, rct_map_element** output_element, uint16 flags); void ride_set_map_tooltip(rct_map_element *mapElement); diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index 503405188e..ea70ec44f0 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -1892,7 +1892,7 @@ void window_ride_construction_mouseup_demolish_next_piece(sint32 x, sint32 y, si ride_construction_set_default_next_piece(); window_ride_construction_update_active_elements(); if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { - sub_6CC3FB(_currentRideIndex); + ride_initialise_construction_window(_currentRideIndex); _currentTrackPieceDirection = direction; if (!(slope & 0x100)) { _currentTrackCurve = slope; @@ -1961,7 +1961,7 @@ static void window_ride_construction_entrance_click(rct_window *w) { if (tool_set(w, WIDX_ENTRANCE, TOOL_CROSSHAIR)) { if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { - sub_6CC3FB(_currentRideIndex); + ride_initialise_construction_window(_currentRideIndex); } } else { gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE; @@ -1985,7 +1985,7 @@ static void window_ride_construction_exit_click(rct_window *w) { if (tool_set(w, WIDX_EXIT, TOOL_CROSSHAIR)) { if (!ride_try_get_origin_element(_currentRideIndex, NULL)) { - sub_6CC3FB(_currentRideIndex); + ride_initialise_construction_window(_currentRideIndex); } } else { gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT; @@ -3986,7 +3986,7 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) sint32 saveCurrentTrackAlternative = _currentTrackAlternative; sint32 saveCurrentTrackLiftHill = _currentTrackLiftHill; - sub_6CC3FB(_currentRideIndex); + ride_initialise_construction_window(_currentRideIndex); _currentTrackPieceDirection = saveTrackDirection; _currentTrackCurve = saveCurrentTrackCurve; diff --git a/src/openrct2/windows/track_place.c b/src/openrct2/windows/track_place.c index 2543212f3f..e912baae95 100644 --- a/src/openrct2/windows/track_place.c +++ b/src/openrct2/windows/track_place.c @@ -336,7 +336,7 @@ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetInd window_ride_main_open(rideIndex); window_close(w); } else { - sub_6CC3FB(rideIndex); + ride_initialise_construction_window(rideIndex); w = window_find_by_class(WC_RIDE_CONSTRUCTION); window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } From d8fe9eef9d81799ca86dfd4d7b0777ca16bf751e Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 00:29:50 +0100 Subject: [PATCH 11/38] Name sub_6A759F() --- src/openrct2/ride/ride.c | 2 +- src/openrct2/ride/track_design.c | 2 +- src/openrct2/world/entrance.cpp | 4 ++-- src/openrct2/world/footpath.c | 8 ++++---- src/openrct2/world/footpath.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index f117264797..3625755f9d 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -8015,7 +8015,7 @@ void sub_6CB945(sint32 rideIndex) footpath_queue_chain_reset(); maze_entrance_hedge_replacement(location.x, location.y, mapElement); footpath_remove_edges_at(location.x, location.y, mapElement); - sub_6A759F(); + footpath_update_queue_chains(); map_invalidate_tile_full(location.x, location.y); map_element_remove(mapElement); mapElement--; diff --git a/src/openrct2/ride/track_design.c b/src/openrct2/ride/track_design.c index 49cde38aa6..f51f437015 100644 --- a/src/openrct2/ride/track_design.c +++ b/src/openrct2/ride/track_design.c @@ -870,7 +870,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start, if (_trackDesignPlaceOperation == PTD_OPERATION_4) bl = 105; footpath_connect_edges(mapCoord.x, mapCoord.y, map_element, bl); - sub_6A759F(); + footpath_update_queue_chains(); continue; } break; diff --git a/src/openrct2/world/entrance.cpp b/src/openrct2/world/entrance.cpp index 99fb6390a2..e4d1e6dbc8 100644 --- a/src/openrct2/world/entrance.cpp +++ b/src/openrct2/world/entrance.cpp @@ -440,7 +440,7 @@ static money32 RideEntranceExitPlace(sint16 x, } footpath_connect_edges(x, y, mapElement, flags); - sub_6A759F(); + footpath_update_queue_chains(); map_invalidate_tile_full(x, y); } @@ -546,7 +546,7 @@ static money32 RideEntranceExitRemove(sint16 x, sint16 y, uint8 rideIndex, uint8 ride->entrances[stationNum] = 0xFFFF; } - sub_6A759F(); + footpath_update_queue_chains(); map_invalidate_tile_full(x, y); } diff --git a/src/openrct2/world/footpath.c b/src/openrct2/world/footpath.c index 4b2b74c705..2404f60d71 100644 --- a/src/openrct2/world/footpath.c +++ b/src/openrct2/world/footpath.c @@ -161,7 +161,7 @@ static void loc_6A6620(sint32 flags, sint32 x, sint32 y, rct_map_element *mapEle if (!(flags & GAME_COMMAND_FLAG_7)) footpath_connect_edges(x, y, mapElement, flags); - sub_6A759F(); + footpath_update_queue_chains(); map_invalidate_tile_full(x, y); } @@ -446,7 +446,7 @@ money32 footpath_remove_real(sint32 x, sint32 y, sint32 z, sint32 flags) footpath_remove_edges_at(x, y, mapElement); map_invalidate_tile_full(x, y); map_element_remove(mapElement); - sub_6A759F(); + footpath_update_queue_chains(); } money32 cost = -MONEY(10,00); @@ -1302,7 +1302,7 @@ void footpath_connect_edges(sint32 x, sint32 y, rct_map_element *mapElement, sin rct_neighbour_list neighbourList; rct_neighbour neighbour; - sub_6A759F(); + footpath_update_queue_chains(); neighbour_list_init(&neighbourList); @@ -1474,7 +1474,7 @@ void footpath_queue_chain_push(uint8 rideIndex) * * rct2: 0x006A759F */ -void sub_6A759F() +void footpath_update_queue_chains() { for (uint8 *queueChainPtr = _footpathQueueChain; queueChainPtr < _footpathQueueChainNext; queueChainPtr++) { uint8 rideIndex = *queueChainPtr; diff --git a/src/openrct2/world/footpath.h b/src/openrct2/world/footpath.h index 60e2da8745..ba9eb9086f 100644 --- a/src/openrct2/world/footpath.h +++ b/src/openrct2/world/footpath.h @@ -87,7 +87,7 @@ void footpath_get_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 *x void footpath_bridge_get_info_from_pos(sint32 screenX, sint32 screenY, sint32 *x, sint32 *y, sint32 *direction, rct_map_element **mapElement); void footpath_remove_litter(sint32 x, sint32 y, sint32 z); void footpath_connect_edges(sint32 x, sint32 y, rct_map_element *mapElement, sint32 flags); -void sub_6A759F(); +void footpath_update_queue_chains(); bool fence_in_the_way(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction); void footpath_chain_ride_queue(sint32 rideIndex, sint32 entranceIndex, sint32 x, sint32 y, rct_map_element *mapElement, sint32 direction); void footpath_update_path_wide_flags(sint32 x, sint32 y); From d2fa8bab149381f8ae9f4716d87d7bc797e9d2c3 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 00:35:47 +0100 Subject: [PATCH 12/38] Name sub_6C96C0() --- src/openrct2/ride/ride.c | 7 +++---- src/openrct2/ride/ride.h | 2 +- src/openrct2/windows/ride_construction.c | 6 +++--- src/openrct2/world/entrance.cpp | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 3625755f9d..955efbb7a1 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1334,7 +1334,7 @@ void ride_restore_provisional_track_piece() if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) { sint32 x, y, z, direction, type, rideIndex, edxRS16; if (sub_6CA2DF(&type, &direction, &rideIndex, &edxRS16, &x, &y, &z, NULL)) { - sub_6C96C0(); + ride_construction_remove_ghosts(); } else { _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); window_ride_construction_update_active_elements(); @@ -1388,9 +1388,8 @@ void ride_remove_provisional_track_piece() * * rct2: 0x006C96C0 */ -void sub_6C96C0() +void ride_construction_remove_ghosts() { - if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) { ride_entrance_exit_remove_ghost(); _currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT; @@ -1438,7 +1437,7 @@ void ride_construction_invalidate_current_track() gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; map_invalidate_tile_full(_currentTrackBeginX, _currentTrackBeginY); } - sub_6C96C0(); + ride_construction_remove_ghosts(); break; } } diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index e041a781d5..fd5ba1b7cb 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -1106,7 +1106,7 @@ bool track_block_get_previous(sint32 x, sint32 y, rct_map_element *mapElement, t bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8 direction, track_begin_end *outTrackBeginEnd); void window_ride_construction_update_active_elements(); -void sub_6C96C0(); +void ride_construction_remove_ghosts(); money32 ride_entrance_exit_place_ghost(sint32 rideIndex, sint32 x, sint32 y, sint32 direction, sint32 placeType, sint32 stationNum); void ride_get_entrance_or_exit_position_from_screen_position(sint32 x, sint32 y, sint32 *outX, sint32 *outY, sint32 *outDirection); diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index ea70ec44f0..25fc4a357b 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -2757,7 +2757,7 @@ money32 sub_6CA162(sint32 rideIndex, sint32 trackType, sint32 trackDirection, si rct_ride *ride; money32 result; - sub_6C96C0(); + ride_construction_remove_ghosts(); ride = get_ride(rideIndex); if (ride->type == RIDE_TYPE_MAZE) { result = game_do_command(x, 105 | (4 << 8), y, rideIndex | (trackType << 8) | (edxRS16 << 16), GAME_COMMAND_SET_MAZE_TRACK, z, 0); @@ -2816,7 +2816,7 @@ void sub_6C94D8() case RIDE_CONSTRUCTION_STATE_BACK: if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK)) { if (sub_6CA2DF(&type, &direction, &rideIndex, &edxRS16, &x, &y, &z, NULL)) { - sub_6C96C0(); + ride_construction_remove_ghosts(); } else { _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); window_ride_construction_update_active_elements(); @@ -2859,7 +2859,7 @@ void sub_6C94D8() direction = _currentTrackPieceDirection & 3; type = _currentTrackPieceType; if (sub_6C683D(&x, &y, &z, direction, type, 0, NULL, _currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW ? 2 : 1)) { - sub_6C96C0(); + ride_construction_remove_ghosts(); _rideConstructionState = RIDE_CONSTRUCTION_STATE_0; } break; diff --git a/src/openrct2/world/entrance.cpp b/src/openrct2/world/entrance.cpp index e4d1e6dbc8..e2ee06afe4 100644 --- a/src/openrct2/world/entrance.cpp +++ b/src/openrct2/world/entrance.cpp @@ -734,7 +734,7 @@ extern "C" sint32 placeType, sint32 stationNum) { - sub_6C96C0(); + ride_construction_remove_ghosts(); money32 result = RideEntranceExitPlaceGhost(rideIndex, x, y, direction, placeType, stationNum); if (result != MONEY32_UNDEFINED) From 03286af22b5a271847c480898d86c346a440569b Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 01:17:32 +0100 Subject: [PATCH 13/38] Name sub_693BAB() --- src/openrct2/peep/peep.c | 12 ++++++------ src/openrct2/peep/peep.h | 2 +- src/openrct2/rct1.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index dcbee12a0a..385fb4c2ee 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -130,7 +130,7 @@ static sint32 peep_empty_container_standard_flag(rct_peep* peep); static sint32 peep_empty_container_extra_flag(rct_peep* peep); static sint32 peep_should_find_bench(rct_peep* peep); static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type); -static void sub_693BAB(rct_peep* peep); +static void peep_set_action_sprite_type(rct_peep* peep); static sint32 peep_perform_next_action(rct_peep *peep); static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32 amount); static void peep_set_has_ridden(rct_peep *peep, sint32 rideIndex); @@ -1665,12 +1665,12 @@ static void set_sprite_type(rct_peep* peep, uint8 type){ if (peep->state == PEEP_STATE_SITTING){ peep->action = PEEP_ACTION_NONE_1; peep->next_action_sprite_type = 7; - sub_693BAB(peep); + peep_set_action_sprite_type(peep); } if (peep->state == PEEP_STATE_WATCHING){ peep->action = PEEP_ACTION_NONE_1; peep->next_action_sprite_type = 2; - sub_693BAB(peep); + peep_set_action_sprite_type(peep); } } @@ -2219,7 +2219,7 @@ static void peep_update_sitting(rct_peep* peep){ invalidate_sprite_2((rct_sprite*)peep); peep->action = 254; peep->next_action_sprite_type = 7; - sub_693BAB(peep); + peep_set_action_sprite_type(peep); peep->sub_state++; @@ -5243,7 +5243,7 @@ static void peep_update_watching(rct_peep* peep){ peep->action = 0xFE; peep->next_action_sprite_type = 2; - sub_693BAB(peep); + peep_set_action_sprite_type(peep); peep->sub_state++; @@ -7843,7 +7843,7 @@ void peep_set_map_tooltip(rct_peep *peep) } -void sub_693BAB(rct_peep* peep) { +void peep_set_action_sprite_type(rct_peep* peep) { // TBD: Add nextActionSpriteType as function parameter and make peep->next_action_sprite_type obsolete? uint8 nextActionSpriteType = peep->next_action_sprite_type; if (nextActionSpriteType != peep->action_sprite_type) { diff --git a/src/openrct2/peep/peep.h b/src/openrct2/peep/peep.h index b2b7730716..349050e9c8 100644 --- a/src/openrct2/peep/peep.h +++ b/src/openrct2/peep/peep.h @@ -539,7 +539,7 @@ typedef struct rct_peep { // Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower uint8 special_sprite; // 0x6D uint8 action_sprite_type; // 0x6E - // Seems to be used like a local variable, as it's always set before calling sub_693BAB, which reads this again + // Seems to be used like a local variable, as it's always set before calling peep_set_action_sprite_type, which reads this again uint8 next_action_sprite_type; // 0x6F uint8 action_sprite_image_offset; // 0x70 uint8 action; // 0x71 diff --git a/src/openrct2/rct1.h b/src/openrct2/rct1.h index d43e1bd225..01491940fd 100644 --- a/src/openrct2/rct1.h +++ b/src/openrct2/rct1.h @@ -433,7 +433,7 @@ typedef struct rct1_peep { // Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower uint8 special_sprite; // 0x6D uint8 action_sprite_type; // 0x6E - // Seems to be used like a local variable, as it's always set before calling sub_693BAB, which reads this again + // Seems to be used like a local variable, as it's always set before calling peep_set_action_sprite_type, which reads this again uint8 next_action_sprite_type; // 0x6F uint8 action_sprite_image_offset; // 0x70 uint8 action; // 0x71 From 5abb5c9e9f3be26aba862f2120f52f66c5185c96 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 01:21:26 +0100 Subject: [PATCH 14/38] More accurate name for sub_693BAB() --- src/openrct2/peep/peep.c | 12 ++++++------ src/openrct2/peep/peep.h | 2 +- src/openrct2/rct1.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 385fb4c2ee..4a317cb9c6 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -130,7 +130,7 @@ static sint32 peep_empty_container_standard_flag(rct_peep* peep); static sint32 peep_empty_container_extra_flag(rct_peep* peep); static sint32 peep_should_find_bench(rct_peep* peep); static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type); -static void peep_set_action_sprite_type(rct_peep* peep); +static void peep_switch_to_next_action_sprite_type(rct_peep* peep); static sint32 peep_perform_next_action(rct_peep *peep); static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32 amount); static void peep_set_has_ridden(rct_peep *peep, sint32 rideIndex); @@ -1665,12 +1665,12 @@ static void set_sprite_type(rct_peep* peep, uint8 type){ if (peep->state == PEEP_STATE_SITTING){ peep->action = PEEP_ACTION_NONE_1; peep->next_action_sprite_type = 7; - peep_set_action_sprite_type(peep); + peep_switch_to_next_action_sprite_type(peep); } if (peep->state == PEEP_STATE_WATCHING){ peep->action = PEEP_ACTION_NONE_1; peep->next_action_sprite_type = 2; - peep_set_action_sprite_type(peep); + peep_switch_to_next_action_sprite_type(peep); } } @@ -2219,7 +2219,7 @@ static void peep_update_sitting(rct_peep* peep){ invalidate_sprite_2((rct_sprite*)peep); peep->action = 254; peep->next_action_sprite_type = 7; - peep_set_action_sprite_type(peep); + peep_switch_to_next_action_sprite_type(peep); peep->sub_state++; @@ -5243,7 +5243,7 @@ static void peep_update_watching(rct_peep* peep){ peep->action = 0xFE; peep->next_action_sprite_type = 2; - peep_set_action_sprite_type(peep); + peep_switch_to_next_action_sprite_type(peep); peep->sub_state++; @@ -7843,7 +7843,7 @@ void peep_set_map_tooltip(rct_peep *peep) } -void peep_set_action_sprite_type(rct_peep* peep) { +void peep_switch_to_next_action_sprite_type(rct_peep* peep) { // TBD: Add nextActionSpriteType as function parameter and make peep->next_action_sprite_type obsolete? uint8 nextActionSpriteType = peep->next_action_sprite_type; if (nextActionSpriteType != peep->action_sprite_type) { diff --git a/src/openrct2/peep/peep.h b/src/openrct2/peep/peep.h index 349050e9c8..501cf86c81 100644 --- a/src/openrct2/peep/peep.h +++ b/src/openrct2/peep/peep.h @@ -539,7 +539,7 @@ typedef struct rct_peep { // Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower uint8 special_sprite; // 0x6D uint8 action_sprite_type; // 0x6E - // Seems to be used like a local variable, as it's always set before calling peep_set_action_sprite_type, which reads this again + // Seems to be used like a local variable, as it's always set before calling peep_switch_to_next_action_sprite_type, which reads this again uint8 next_action_sprite_type; // 0x6F uint8 action_sprite_image_offset; // 0x70 uint8 action; // 0x71 diff --git a/src/openrct2/rct1.h b/src/openrct2/rct1.h index 01491940fd..5dc3a17e05 100644 --- a/src/openrct2/rct1.h +++ b/src/openrct2/rct1.h @@ -433,7 +433,7 @@ typedef struct rct1_peep { // Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower uint8 special_sprite; // 0x6D uint8 action_sprite_type; // 0x6E - // Seems to be used like a local variable, as it's always set before calling peep_set_action_sprite_type, which reads this again + // Seems to be used like a local variable, as it's always set before calling peep_switch_to_next_action_sprite_type, which reads this again uint8 next_action_sprite_type; // 0x6F uint8 action_sprite_image_offset; // 0x70 uint8 action; // 0x71 From b492aa544f03f5e8d3adf99b07e04f184a47a62e Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 01:40:17 +0100 Subject: [PATCH 15/38] Name sub_684AC3() --- src/openrct2/interface/console.c | 4 ++-- src/openrct2/management/research.c | 2 +- src/openrct2/management/research.h | 2 +- src/openrct2/scenario/scenario.c | 2 +- src/openrct2/windows/editor_inventions_list.c | 2 +- src/openrct2/windows/editor_object_selection.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index 373760a654..40d44929df 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -1133,14 +1133,14 @@ static sint32 cc_load_object(const utf8 **argv, sint32 argc) { } gSilentResearch = true; - sub_684AC3(); + research_reset_current_item(); gSilentResearch = false; } else if (objectType == OBJECT_TYPE_SCENERY_SETS) { research_insert(true, groupIndex, RESEARCH_CATEGORY_SCENERYSET); gSilentResearch = true; - sub_684AC3(); + research_reset_current_item(); gSilentResearch = false; } scenery_set_default_placement_configuration(); diff --git a/src/openrct2/management/research.c b/src/openrct2/management/research.c index 96e470502f..1058f67eab 100644 --- a/src/openrct2/management/research.c +++ b/src/openrct2/management/research.c @@ -292,7 +292,7 @@ void research_update() * * rct2: 0x00684AC3 */ -void sub_684AC3(){ +void research_reset_current_item(){ rct_research_item* research = gResearchItems; for (; research->entryIndex != RESEARCHED_ITEMS_END; research++); diff --git a/src/openrct2/management/research.h b/src/openrct2/management/research.h index ffac63d613..8c5fa85d09 100644 --- a/src/openrct2/management/research.h +++ b/src/openrct2/management/research.h @@ -93,7 +93,7 @@ extern bool gSilentResearch; void research_reset_items(); void research_update_uncompleted_types(); void research_update(); -void sub_684AC3(); +void research_reset_current_item(); void research_remove_non_separate_vehicle_types(); void research_populate_list_random(); void research_populate_list_researched(); diff --git a/src/openrct2/scenario/scenario.c b/src/openrct2/scenario/scenario.c index 02c3348748..64f75fdb52 100644 --- a/src/openrct2/scenario/scenario.c +++ b/src/openrct2/scenario/scenario.c @@ -175,7 +175,7 @@ void scenario_begin() gParkFlags &= ~PARK_FLAGS_NO_MONEY; if (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) gParkFlags |= PARK_FLAGS_NO_MONEY; - sub_684AC3(); + research_reset_current_item(); scenery_set_default_placement_configuration(); news_item_init_queue(); if (gScenarioObjectiveType != OBJECTIVE_NONE) diff --git a/src/openrct2/windows/editor_inventions_list.c b/src/openrct2/windows/editor_inventions_list.c index 181cc60048..3688c5b1d4 100644 --- a/src/openrct2/windows/editor_inventions_list.c +++ b/src/openrct2/windows/editor_inventions_list.c @@ -576,7 +576,7 @@ static void window_editor_inventions_list_close(rct_window *w) // When used in-game (as a cheat) if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { gSilentResearch = true; - sub_684AC3(); + research_reset_current_item(); gSilentResearch = false; } } diff --git a/src/openrct2/windows/editor_object_selection.c b/src/openrct2/windows/editor_object_selection.c index 9619778411..48342040a3 100644 --- a/src/openrct2/windows/editor_object_selection.c +++ b/src/openrct2/windows/editor_object_selection.c @@ -773,7 +773,7 @@ static void window_editor_object_selection_close(rct_window *w) // Used for in-game object selection cheat // This resets the ride selection list and resets research to 0 on current item gSilentResearch = true; - sub_684AC3(); + research_reset_current_item(); gSilentResearch = false; } research_remove_non_separate_vehicle_types(); From b62bb1db6dd1e193a76ccc4dbab051969ebbcff4 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 01:44:06 +0100 Subject: [PATCH 16/38] Name sub_6ED990() --- src/openrct2/input.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2/input.c b/src/openrct2/input.c index ac1e087300..e48a7b4d74 100644 --- a/src/openrct2/input.c +++ b/src/openrct2/input.c @@ -96,7 +96,7 @@ void game_handle_edge_scroll(); void game_handle_key_scroll(); static void input_widget_left(sint32 x, sint32 y, rct_window *w, rct_widgetindex widgetIndex); void input_state_widget_pressed(sint32 x, sint32 y, sint32 state, rct_widgetindex widgetIndex, rct_window* w, rct_widget* widget); -void sub_6ED990(uint8 cursor_id); +void set_cursor(uint8 cursor_id); static void input_window_position_continue(rct_window *w, sint32 lastX, sint32 lastY, sint32 newX, sint32 newY); static void input_window_position_end(rct_window *w, sint32 x, sint32 y); static void input_window_resize_begin(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y); @@ -1060,7 +1060,7 @@ void process_mouse_over(sint32 x, sint32 y) case WWT_VIEWPORT: if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE)) { if (viewport_interaction_left_over(x, y)) { - sub_6ED990(CURSOR_HAND_POINT); + set_cursor(CURSOR_HAND_POINT); return; } break; @@ -1080,7 +1080,7 @@ void process_mouse_over(sint32 x, sint32 y) cursorId = edi; if ((ebx & 0xFF) != 0) { - sub_6ED990(cursorId); + set_cursor(cursorId); return; } break; @@ -1129,7 +1129,7 @@ void process_mouse_over(sint32 x, sint32 y) } viewport_interaction_right_over(x, y); - sub_6ED990(cursorId); + set_cursor(cursorId); } /** @@ -1562,7 +1562,7 @@ sint32 get_next_key() * * rct2: 0x006ED990 */ -void sub_6ED990(uint8 cursor_id) +void set_cursor(uint8 cursor_id) { if (_inputState == INPUT_STATE_RESIZING) { cursor_id = CURSOR_DIAGONAL_ARROWS; From 457a2f624cc3249939d33424cf8b21d9b418c319 Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 15:18:59 +0100 Subject: [PATCH 17/38] Name sub_69AF1E() --- src/openrct2/peep/peep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 4a317cb9c6..73b6104c38 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -141,7 +141,7 @@ static void peep_on_enter_or_exit_ride(rct_peep *peep, sint32 rideIndex, sint32 static void peep_update_favourite_ride(rct_peep *peep, rct_ride *ride); static sint16 peep_calculate_ride_satisfaction(rct_peep *peep, rct_ride *ride); static void peep_update_ride_nausea_growth(rct_peep *peep, rct_ride *ride); -static bool sub_69AF1E(rct_peep *peep, sint32 rideIndex, sint32 shopItem, money32 price); +static bool peep_decide_and_buy_item(rct_peep *peep, sint32 rideIndex, sint32 shopItem, money32 price); static bool peep_should_use_cash_machine(rct_peep *peep, sint32 rideIndex); static bool peep_should_go_on_ride(rct_peep *peep, sint32 rideIndex, sint32 entranceNum, sint32 flags); static void peep_ride_is_too_intense(rct_peep *peep, sint32 rideIndex, bool peepAtRide); @@ -3373,7 +3373,7 @@ static void peep_update_ride_sub_state_9(rct_peep* peep){ if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO){ uint8 secondaryItem = RidePhotoItems[ride->type]; - if (sub_69AF1E(peep, peep->current_ride, secondaryItem, ride->price_secondary)) { + if (peep_decide_and_buy_item(peep, peep->current_ride, secondaryItem, ride->price_secondary)) { ride->no_secondary_items_sold++; } } @@ -5626,7 +5626,7 @@ static void peep_update_buying(rct_peep* peep) if (ride_type->shop_item_secondary != 0xFF){ money16 price = ride->price_secondary; - item_bought = sub_69AF1E(peep, peep->current_ride, ride_type->shop_item_secondary, price); + item_bought = peep_decide_and_buy_item(peep, peep->current_ride, ride_type->shop_item_secondary, price); if (item_bought) { ride->no_secondary_items_sold++; } @@ -5635,7 +5635,7 @@ static void peep_update_buying(rct_peep* peep) if (!item_bought && ride_type->shop_item != 0xFF){ money16 price = ride->price; - item_bought = sub_69AF1E(peep, peep->current_ride, ride_type->shop_item, price); + item_bought = peep_decide_and_buy_item(peep, peep->current_ride, ride_type->shop_item, price); if (item_bought) { ride->no_primary_items_sold++; } @@ -10922,7 +10922,7 @@ static void peep_on_enter_or_exit_ride(rct_peep *peep, sint32 rideIndex, sint32 * * rct2: 0x0069AF1E */ -static bool sub_69AF1E(rct_peep *peep, sint32 rideIndex, sint32 shopItem, money32 price) +static bool peep_decide_and_buy_item(rct_peep *peep, sint32 rideIndex, sint32 shopItem, money32 price) { rct_ride* ride = get_ride(rideIndex); money32 value; From 07d5931193ed31ecc4fb8c7c97e183764fc262fd Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 15:27:24 +0100 Subject: [PATCH 18/38] Name sub_6A7642() --- src/openrct2/world/footpath.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/world/footpath.c b/src/openrct2/world/footpath.c index 2404f60d71..d777631911 100644 --- a/src/openrct2/world/footpath.c +++ b/src/openrct2/world/footpath.c @@ -25,7 +25,7 @@ #include "../util/util.h" void footpath_interrupt_peeps(sint32 x, sint32 y, sint32 z); -void sub_6A7642(sint32 x, sint32 y, rct_map_element *mapElement); +void footpath_update_queue_entrance_banner(sint32 x, sint32 y, rct_map_element *mapElement); uint8 gFootpathProvisionalFlags; rct_xyz16 gFootpathProvisionalPosition; @@ -1306,7 +1306,7 @@ void footpath_connect_edges(sint32 x, sint32 y, rct_map_element *mapElement, sin neighbour_list_init(&neighbourList); - sub_6A7642(x, y, mapElement); + footpath_update_queue_entrance_banner(x, y, mapElement); for (sint32 direction = 0; direction < 4; direction++) { loc_6A6C85(x, y, direction, mapElement, flags, true, &neighbourList); } @@ -1940,7 +1940,7 @@ void footpath_update_path_wide_flags(sint32 x, sint32 y) * * rct2: 0x006A7642 */ -void sub_6A7642(sint32 x, sint32 y, rct_map_element *mapElement) +void footpath_update_queue_entrance_banner(sint32 x, sint32 y, rct_map_element *mapElement) { sint32 elementType = map_element_get_type(mapElement); switch (elementType) { @@ -2059,7 +2059,7 @@ void footpath_remove_edges_at(sint32 x, sint32 y, rct_map_element *mapElement) return; } - sub_6A7642(x, y, mapElement); + footpath_update_queue_entrance_banner(x, y, mapElement); for (sint32 direction = 0; direction < 4; direction++) { sint32 z1 = mapElement->base_height; From a38d0711a6e6070eb8b6b2b785c97bd6e8ff096c Mon Sep 17 00:00:00 2001 From: Richard Jenkins Date: Fri, 2 Jun 2017 15:35:12 +0100 Subject: [PATCH 19/38] Remove declaration of function never defined (sub_6EDE88) --- src/openrct2/input.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openrct2/input.c b/src/openrct2/input.c index e48a7b4d74..28b64ff60e 100644 --- a/src/openrct2/input.c +++ b/src/openrct2/input.c @@ -89,7 +89,6 @@ void process_mouse_tool(sint32 x, sint32 y); void invalidate_scroll(); static rct_mouse_data* get_mouse_input(); void map_element_right_click(sint32 type, rct_map_element *mapElement, sint32 x, sint32 y); -sint32 sub_6EDE88(sint32 x, sint32 y, rct_map_element **mapElement, sint32 *outX, sint32 *outY); sint32 get_next_key(); static void game_handle_input_mouse(sint32 x, sint32 y, sint32 state); void game_handle_edge_scroll(); From df4b150f92920c47be3ac92ad84f273cbf03d774 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 00:21:00 +0100 Subject: [PATCH 20/38] Name sub_689174() --- src/openrct2/interface/viewport.c | 4 ++-- src/openrct2/interface/viewport.h | 2 +- src/openrct2/interface/window.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/interface/viewport.c b/src/openrct2/interface/viewport.c index 0143283071..777a363b70 100644 --- a/src/openrct2/interface/viewport.c +++ b/src/openrct2/interface/viewport.c @@ -222,7 +222,7 @@ void viewport_update_pointers() * edx is assumed to be (and always is) the current rotation, so it is not * needed as parameter. */ -void sub_689174(sint16* x, sint16* y, sint16 *z) +void viewport_adjust_for_map_height(sint16* x, sint16* y, sint16 *z) { sint16 start_x = *x; sint16 start_y = *y; @@ -526,7 +526,7 @@ void viewport_update_position(rct_window *window) sint16 y = viewport->view_height / 2 + window->saved_view_y; sint16 z; - sub_689174(&x, &y, &z); + viewport_adjust_for_map_height(&x, &y, &z); viewport_set_underground_flag(0, window, viewport); diff --git a/src/openrct2/interface/viewport.h b/src/openrct2/interface/viewport.h index bccf15f1de..c344ef4897 100644 --- a/src/openrct2/interface/viewport.h +++ b/src/openrct2/interface/viewport.h @@ -124,7 +124,7 @@ void viewport_update_sprite_follow(rct_window *window); void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, sint32 left, sint32 top, sint32 right, sint32 bottom); void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 right, sint16 bottom); -void sub_689174(sint16* x, sint16* y, sint16 *z); +void viewport_adjust_for_map_height(sint16* x, sint16* y, sint16 *z); rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16 y); rct_xy16 viewport_coord_to_map_coord(sint32 x, sint32 y, sint32 z); diff --git a/src/openrct2/interface/window.c b/src/openrct2/interface/window.c index 4cb0db0bfa..a2768cf648 100644 --- a/src/openrct2/interface/window.c +++ b/src/openrct2/interface/window.c @@ -1451,7 +1451,7 @@ void window_rotate_camera(rct_window *w, sint32 direction) x = (viewport->view_width >> 1) + viewport->view_x; y = (viewport->view_height >> 1) + viewport->view_y; - sub_689174(&x, &y, &z); + viewport_adjust_for_map_height(&x, &y, &z); } else { z = map_element_height(x, y); From ae684c944e84e9e873146579a51f8826b75fb4b8 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 01:10:16 +0100 Subject: [PATCH 21/38] Name sub_6DB7D6() --- src/openrct2/ride/vehicle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/ride/vehicle.c b/src/openrct2/ride/vehicle.c index a9c3ad23c1..e11455fe6f 100644 --- a/src/openrct2/ride/vehicle.c +++ b/src/openrct2/ride/vehicle.c @@ -7014,7 +7014,7 @@ static void vehicle_update_handle_water_splash(rct_vehicle *vehicle) */ static void sub_6DB807(rct_vehicle *vehicle) { - const rct_vehicle_info *moveInfo = vehicle_get_move_info( + /*const rct_vehicle_info *moveInfo = vehicle_get_move_info( vehicle->var_CD, vehicle->track_type, vehicle->track_progress @@ -7022,7 +7022,7 @@ static void sub_6DB807(rct_vehicle *vehicle) sint32 x = vehicle->track_x + moveInfo->x; sint32 y = vehicle->track_y + moveInfo->y; sint32 z = vehicle->z; - sprite_move(x, y, z, (rct_sprite*)vehicle); + sprite_move(x, y, z, (rct_sprite*)vehicle);*/ } extern const rct_xy16 DuckMoveOffset[4]; @@ -7200,7 +7200,7 @@ static bool vehicle_update_motion_collision_detection( * * rct2: 0x006DB7D6 */ -static void sub_6DB7D6(rct_vehicle *vehicle) +static void vehicle_update_reverser_car_reverse(rct_vehicle *vehicle) { rct_vehicle *previousVehicle = GET_VEHICLE(vehicle->prev_vehicle_on_ride); rct_vehicle *nextVehicle = GET_VEHICLE(vehicle->next_vehicle_on_ride); @@ -7608,7 +7608,7 @@ loc_6DAEB9: trackType == TRACK_ELEM_RIGHT_REVERSER) && vehicle->track_progress == 96 ) { - sub_6DB7D6(vehicle); + vehicle_update_reverser_car_reverse(vehicle); const rct_vehicle_info *moveInfo2 = vehicle_get_move_info( vehicle->var_CD, From 74642c884045327a3cab122ce23d89168102c826 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 01:16:33 +0100 Subject: [PATCH 22/38] Name sub_6DB807(), better name for sub_6DB7D6() --- src/openrct2/ride/vehicle.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openrct2/ride/vehicle.c b/src/openrct2/ride/vehicle.c index e11455fe6f..6cb47f33c2 100644 --- a/src/openrct2/ride/vehicle.c +++ b/src/openrct2/ride/vehicle.c @@ -7012,9 +7012,9 @@ static void vehicle_update_handle_water_splash(rct_vehicle *vehicle) * * rct2: 0x006DB807 */ -static void sub_6DB807(rct_vehicle *vehicle) +static void vehicle_update_reverser_car_bogies(rct_vehicle *vehicle) { - /*const rct_vehicle_info *moveInfo = vehicle_get_move_info( + const rct_vehicle_info *moveInfo = vehicle_get_move_info( vehicle->var_CD, vehicle->track_type, vehicle->track_progress @@ -7022,7 +7022,7 @@ static void sub_6DB807(rct_vehicle *vehicle) sint32 x = vehicle->track_x + moveInfo->x; sint32 y = vehicle->track_y + moveInfo->y; sint32 z = vehicle->z; - sprite_move(x, y, z, (rct_sprite*)vehicle);*/ + sprite_move(x, y, z, (rct_sprite*)vehicle); } extern const rct_xy16 DuckMoveOffset[4]; @@ -7200,7 +7200,7 @@ static bool vehicle_update_motion_collision_detection( * * rct2: 0x006DB7D6 */ -static void vehicle_update_reverser_car_reverse(rct_vehicle *vehicle) +static void vehicle_reverse_reverser_car(rct_vehicle *vehicle) { rct_vehicle *previousVehicle = GET_VEHICLE(vehicle->prev_vehicle_on_ride); rct_vehicle *nextVehicle = GET_VEHICLE(vehicle->next_vehicle_on_ride); @@ -7211,8 +7211,8 @@ static void vehicle_update_reverser_car_reverse(rct_vehicle *vehicle) previousVehicle->track_progress = 86; nextVehicle->track_progress = 158; - sub_6DB807(nextVehicle); - sub_6DB807(previousVehicle); + vehicle_update_reverser_car_bogies(nextVehicle); + vehicle_update_reverser_car_bogies(previousVehicle); } /** @@ -7608,7 +7608,7 @@ loc_6DAEB9: trackType == TRACK_ELEM_RIGHT_REVERSER) && vehicle->track_progress == 96 ) { - vehicle_update_reverser_car_reverse(vehicle); + vehicle_reverse_reverser_car(vehicle); const rct_vehicle_info *moveInfo2 = vehicle_get_move_info( vehicle->var_CD, From c3401b75d51776d6193858186b4b6219b6ec6251 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 01:24:08 +0100 Subject: [PATCH 23/38] Name sub_6B7588() --- src/openrct2/peep/peep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 73b6104c38..0ab3701d74 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -170,7 +170,7 @@ static bool peep_update_fixing_sub_state_11(bool firstRun, rct_peep *peep, rct_r static bool peep_update_fixing_sub_state_12(bool firstRun, rct_peep *peep, rct_ride *ride); static bool peep_update_fixing_sub_state_13(bool firstRun, sint32 steps, rct_peep *peep, rct_ride *ride); static bool peep_update_fixing_sub_state_14(bool firstRun, rct_peep *peep, rct_ride *ride); -static void sub_6B7588(sint32 rideIndex); +static void peep_update_ride_inspected(sint32 rideIndex); bool loc_690FD0(rct_peep *peep, uint8 *rideToView, uint8 *rideSeatToView, rct_map_element *esi); @@ -4722,7 +4722,7 @@ static bool peep_update_fixing_sub_state_13(bool firstRun, sint32 steps, rct_pee if (!firstRun) { if (peep->state == PEEP_STATE_INSPECTING) { - sub_6B7588(peep->current_ride); + peep_update_ride_inspected(peep->current_ride); peep->staff_rides_inspected++; peep->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME | RIDE_INVALIDATE_RIDE_LIST; @@ -4810,7 +4810,7 @@ static bool peep_update_fixing_sub_state_14(bool firstRun, rct_peep *peep, rct_r /** * rct2: 0x6B7588 */ -static void sub_6B7588(sint32 rideIndex) { +static void peep_update_ride_inspected(sint32 rideIndex) { rct_ride *ride = get_ride(rideIndex); ride->lifecycle_flags &= ~RIDE_LIFECYCLE_DUE_INSPECTION; From 364ce73272a4f5cb5f97357162b60a156a36e294 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 01:33:13 +0100 Subject: [PATCH 24/38] Name sub_69ED9E() --- src/openrct2/ride/ride.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 955efbb7a1..7fa759e5ed 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -4409,7 +4409,7 @@ static void ride_set_start_finish_points(sint32 rideIndex, rct_xy_element *start * * rct2: 0x0069ED9E */ -static sint32 sub_69ED9E() +static sint32 count_free_misc_sprite_slots() { sint32 miscSpriteCount = gSpriteListCount[SPRITE_LIST_MISC]; sint32 remainingSpriteCount = gSpriteListCount[SPRITE_LIST_NULL]; @@ -4770,7 +4770,7 @@ static bool ride_create_vehicles(rct_ride *ride, sint32 rideIndex, rct_xy_elemen // Check if there are enough free sprite slots for all the vehicles sint32 totalCars = ride->num_vehicles * ride->num_cars_per_train; - if (totalCars > sub_69ED9E()) { + if (totalCars > count_free_misc_sprite_slots()) { gGameCommandErrorText = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; return false; } @@ -5006,7 +5006,7 @@ static bool ride_create_cable_lift(sint32 rideIndex, bool isApplying) return false; } - if (sub_69ED9E() <= 5) { + if (count_free_misc_sprite_slots() <= 5) { gGameCommandErrorText = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; return false; } From b346be8488df36e3a989b120fea19bad296dd141 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 13:08:00 +0100 Subject: [PATCH 25/38] Name sub_68F8CD() --- src/openrct2/peep/peep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 0ab3701d74..6030bc0b0e 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -702,7 +702,7 @@ static void peep_leave_park(rct_peep* peep){ * * rct2: 0x0068F8CD */ -static void sub_68F8CD(rct_peep *peep) +static void peep_decide_whether_to_leave_park(rct_peep *peep) { if (peep->energy_growth_rate >= 33) { peep->energy_growth_rate -= 2; @@ -1113,7 +1113,7 @@ static void sub_68F41A(rct_peep *peep, sint32 index) case PEEP_STATE_WALKING: case PEEP_STATE_LEAVING_PARK: case PEEP_STATE_ENTERING_PARK: - sub_68F8CD(peep); + peep_decide_whether_to_leave_park(peep); peep_update_hunger(peep); break; @@ -1180,7 +1180,7 @@ static void sub_68F41A(rct_peep *peep, sint32 index) case PEEP_STATE_ENTERING_RIDE: if (peep->sub_state == 17 || peep->sub_state == 15){ - sub_68F8CD(peep); + peep_decide_whether_to_leave_park(peep); } peep_update_hunger(peep); break; From 0797a41f80e2b8a8d4a52d5b15cee6fc94c44e22 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 13:22:52 +0100 Subject: [PATCH 26/38] Name sub_685EBC() --- src/openrct2/paint/paint.c | 2 +- src/openrct2/paint/paint.h | 2 +- src/openrct2/paint/sprite/misc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/paint/paint.c b/src/openrct2/paint/paint.c index 9eae6adc0d..d0c621ca57 100644 --- a/src/openrct2/paint/paint.c +++ b/src/openrct2/paint/paint.c @@ -592,7 +592,7 @@ bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y) * @param y_offsets (di) * @param rotation (ebp) */ -void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation) +void paint_floating_money_effect(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation) { if (gNextFreePaintStruct >= gEndOfPaintStructArray) { return; diff --git a/src/openrct2/paint/paint.h b/src/openrct2/paint/paint.h index 69f99964ee..442cd246e0 100644 --- a/src/openrct2/paint/paint.h +++ b/src/openrct2/paint/paint.h @@ -170,7 +170,7 @@ void paint_util_push_tunnel_rotated(uint8 direction, uint16 height, uint8 type); bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y); bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y); -void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation); +void paint_floating_money_effect(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation); void paint_init(rct_drawpixelinfo * dpi); void paint_generate_structs(rct_drawpixelinfo * dpi); diff --git a/src/openrct2/paint/sprite/misc.c b/src/openrct2/paint/sprite/misc.c index ca2be38400..0024e22dda 100644 --- a/src/openrct2/paint/sprite/misc.c +++ b/src/openrct2/paint/sprite/misc.c @@ -57,7 +57,7 @@ void misc_paint(rct_sprite *misc, sint32 imageDirection) rct_money_effect * moneyEffect = &misc->money_effect; rct_string_id stringId = money_effect_get_string_id(moneyEffect); - sub_685EBC(moneyEffect->value, stringId, moneyEffect->y, moneyEffect->z, (sint8 *) &money_wave[moneyEffect->wiggle % 22], moneyEffect->offset_x, get_current_rotation()); + paint_floating_money_effect(moneyEffect->value, stringId, moneyEffect->y, moneyEffect->z, (sint8 *) &money_wave[moneyEffect->wiggle % 22], moneyEffect->offset_x, get_current_rotation()); break; } From a03699839c0c97e59be816c443068a6c0f29dc7d Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 13:59:38 +0100 Subject: [PATCH 27/38] Name sub_666EEF() --- src/openrct2/windows/map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/windows/map.c b/src/openrct2/windows/map.c index 4ced5528f9..a48d756e66 100644 --- a/src/openrct2/windows/map.c +++ b/src/openrct2/windows/map.c @@ -1208,7 +1208,7 @@ static void window_map_set_land_rights_tool_update(sint32 x, sint32 y) * * rct2: 0x00666EEF */ -static void sub_666EEF(sint32 x, sint32 y, sint16 *mapX, sint16 *mapY, sint16 *mapZ, sint32 *direction) +static void place_park_entrance_get_map_position(sint32 x, sint32 y, sint16 *mapX, sint16 *mapY, sint16 *mapZ, sint32 *direction) { rct_map_element *mapElement; @@ -1243,7 +1243,7 @@ static void window_map_place_park_entrance_tool_update(sint32 x, sint32 y) map_invalidate_map_selection_tiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - sub_666EEF(x, y, &mapX, &mapY, &mapZ, &direction); + place_park_entrance_get_map_position(x, y, &mapX, &mapY, &mapZ, &direction); if (mapX == (sint16)-1) { park_entrance_remove_ghost(); return; @@ -1322,7 +1322,7 @@ static void window_map_place_park_entrance_tool_down(sint32 x, sint32 y) sint16 mapX, mapY, mapZ; sint32 direction; - sub_666EEF(x, y, &mapX, &mapY, &mapZ, &direction); + place_park_entrance_get_map_position(x, y, &mapX, &mapY, &mapZ, &direction); if (mapX != MAP_LOCATION_NULL) { gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE; money32 price = game_do_command( From c2688736bcebd36ecd59be0d21ea1ef7a539ba3a Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 14:20:57 +0100 Subject: [PATCH 28/38] Fix comment [ci skip] --- src/openrct2/ride/ride.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index fd5ba1b7cb..c664485665 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -220,7 +220,7 @@ typedef struct rct_ride { union { uint8 inversions; // 0x114 (???X XXXX) uint8 holes; // 0x114 (???X XXXX) - // This a very rough approximation of how much of the ride is undercover. + // This is a very rough approximation of how much of the ride is undercover. // It reaches the maximum value of 7 at about 50% undercover and doesn't increase beyond that. uint8 sheltered_eighths; // 0x114 (XXX?-????) }; From 1db56c43effa57e499663c84180c8be7610b68a0 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 14:31:03 +0100 Subject: [PATCH 29/38] Name sub_6DEDE8() --- src/openrct2/ride/vehicle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/ride/vehicle.c b/src/openrct2/ride/vehicle.c index 6cb47f33c2..6ebad94532 100644 --- a/src/openrct2/ride/vehicle.c +++ b/src/openrct2/ride/vehicle.c @@ -6927,7 +6927,7 @@ static void vehicle_trigger_on_ride_photo(rct_vehicle *vehicle, rct_map_element * * rct2: 0x006DEDE8 */ -static void sub_6DEDE8(rct_vehicle *vehicle) +static void vehicle_update_handle_scenery_door(rct_vehicle *vehicle) { sint32 trackType = vehicle->track_type >> 2; const rct_preview_track *trackBlock = TrackBlocks[trackType]; @@ -7470,7 +7470,7 @@ loc_6DB41D: vehicle->update_flags ^= VEHICLE_UPDATE_FLAG_13; } if (vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_8) { - sub_6DEDE8(vehicle); + vehicle_update_handle_scenery_door(vehicle); } return true; } From d1928bdb2281e1c61bcf539788b34049fb89f9dc Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 15:00:55 +0100 Subject: [PATCH 30/38] Name sub_6D2189() --- src/openrct2/ride/track_design.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/ride/track_design.c b/src/openrct2/ride/track_design.c index f51f437015..a54669c8e7 100644 --- a/src/openrct2/ride/track_design.c +++ b/src/openrct2/ride/track_design.c @@ -1322,7 +1322,7 @@ sint32 place_virtual_track(rct_track_td6 *td6, uint8 bl, uint8 rideIndex, sint32 * ebx = ride_id * cost = edi */ -static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 *flags) +static bool track_design_place_preview(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 *flags) { *flags = 0; @@ -1683,7 +1683,7 @@ void track_design_draw_preview(rct_track_td6 *td6, uint8 *pixels) money32 cost; uint8 rideIndex; uint8 flags; - if (!sub_6D2189(td6, &cost, &rideIndex, &flags)) { + if (!track_design_place_preview(td6, &cost, &rideIndex, &flags)) { memset(pixels, 0, TRACK_PREVIEW_IMAGE_SIZE * 4); track_design_preview_restore_map(mapBackup); return; From ee637b8a33acab6228d99b765424ec21c6c657f0 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Mon, 5 Jun 2017 23:55:05 +0100 Subject: [PATCH 31/38] Name sub_6B2FA9() --- src/openrct2/windows/ride_construction.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index 25fc4a357b..1b2111fb00 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -35,14 +35,6 @@ #include "../world/map.h" #include "../world/entrance.h" -/* move to ride.c */ -static void sub_6B2FA9(rct_windownumber number) -{ - rct_window* w = window_find_by_number(WC_RIDE, number); - if (w != NULL && w->page == 1) - window_close(w); -} - #pragma region Widgets enum { @@ -539,6 +531,14 @@ static sint32 ride_get_alternative_type(rct_ride *ride) ride->type; } +/* move to ride.c */ +static void close_ride_window_for_construction(rct_windownumber number) +{ + rct_window* w = window_find_by_number(WC_RIDE, number); + if (w != NULL && w->page == 1) + window_close(w); +} + /** * * rct2: 0x006CB481 @@ -546,7 +546,7 @@ static sint32 ride_get_alternative_type(rct_ride *ride) rct_window *window_ride_construction_open() { sint32 rideIndex = _currentRideIndex; - sub_6B2FA9(rideIndex); + close_ride_window_for_construction(rideIndex); rct_window *w; rct_ride* ride = get_ride(rideIndex); From dbd03257d9e622d28ff4016cd300d7e810d8889c Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 00:03:34 +0100 Subject: [PATCH 32/38] Name sub_688956() --- src/openrct2/interface/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/interface/window.c b/src/openrct2/interface/window.c index a2768cf648..fb38ff5dcf 100644 --- a/src/openrct2/interface/window.c +++ b/src/openrct2/interface/window.c @@ -1416,7 +1416,7 @@ void window_scroll_to_location(rct_window *w, sint32 x, sint32 y, sint32 z) * * rct2: 0x00688956 */ -static void sub_688956() +static void call_event_unknown_14_on_all_windows() { rct_window *w; @@ -1469,7 +1469,7 @@ void window_rotate_camera(rct_window *w, sint32 direction) window_invalidate(w); - sub_688956(); + call_event_unknown_14_on_all_windows(); reset_all_sprite_quadrant_placements(); } From be0d09d6ac42cb352b04b2881fce46d4bf4d8b82 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 00:19:12 +0100 Subject: [PATCH 33/38] Name sub_6E7FF3() --- src/openrct2/interface/viewport.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/openrct2/interface/viewport.c b/src/openrct2/interface/viewport.c index 777a363b70..1f8c19ec3d 100644 --- a/src/openrct2/interface/viewport.c +++ b/src/openrct2/interface/viewport.c @@ -250,7 +250,7 @@ void viewport_adjust_for_map_height(sint16* x, sint16* y, sint16 *z) *z = height; } -static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport *viewport, sint32 x, sint32 y) +static void viewport_redraw_after_shift(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport *viewport, sint32 x, sint32 y) { // sub-divide by intersecting windows if (window < gWindowNextSlot) @@ -261,7 +261,7 @@ static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport viewport->x >= window->x + window->width || viewport->y + viewport->height <= window->y || viewport->y >= window->y + window->height){ - sub_6E7FF3(dpi, window + 1, viewport, x, y); + viewport_redraw_after_shift(dpi, window + 1, viewport, x, y); return; } @@ -273,49 +273,49 @@ static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport { viewport->width = window->x - viewport->x; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); viewport->x += viewport->width; viewport->view_x += viewport->width << viewport->zoom; viewport->width = view_copy.width - viewport->width; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); } else if (viewport->x + viewport->width > window->x + window->width) { viewport->width = window->x + window->width - viewport->x; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); viewport->x += viewport->width; viewport->view_x += viewport->width << viewport->zoom; viewport->width = view_copy.width - viewport->width; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); } else if (viewport->y < window->y) { viewport->height = window->y - viewport->y; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); viewport->y += viewport->height; viewport->view_y += viewport->height << viewport->zoom; viewport->height = view_copy.height - viewport->height; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); } else if (viewport->y + viewport->height > window->y + window->height) { viewport->height = window->y + window->height - viewport->y; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); viewport->y += viewport->height; viewport->view_y += viewport->height << viewport->zoom; viewport->height = view_copy.height - viewport->height; viewport->view_width = viewport->width << viewport->zoom; - sub_6E7FF3(dpi, window, viewport, x, y); + viewport_redraw_after_shift(dpi, window, viewport, x, y); } // restore viewport @@ -403,7 +403,7 @@ static void viewport_shift_pixels(rct_drawpixelinfo *dpi, rct_window* w, rct_vie } w = orignal_w; - sub_6E7FF3(dpi, w, viewport, x_diff, y_diff); + viewport_redraw_after_shift(dpi, w, viewport, x_diff, y_diff); } static void viewport_move(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport) From aa17f296cb30571a1a33d35568d327b83649c5c8 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 00:26:41 +0100 Subject: [PATCH 34/38] Name sub_693BE5() and second param --- src/openrct2/peep/peep.c | 16 ++++++++-------- src/openrct2/peep/peep.h | 2 +- src/openrct2/ride/ride.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 6030bc0b0e..4ce0781bf0 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -1413,10 +1413,10 @@ void peep_update_current_action_sprite_type(rct_peep* peep){ } /* 0x00693BE5 */ -void sub_693BE5(rct_peep* peep, uint8 al){ - if (al == peep->special_sprite)return; +void peep_switch_to_special_sprite(rct_peep* peep, uint8 special_sprite_id){ + if (special_sprite_id == peep->special_sprite)return; - peep->special_sprite = al; + peep->special_sprite = special_sprite_id; // If NONE_1 or NONE_2 if (peep->action >= PEEP_ACTION_NONE_1){ @@ -1437,7 +1437,7 @@ void remove_peep_from_ride(rct_peep* peep) peep_decrement_num_riders(peep); peep->state = PEEP_STATE_1; peep_window_state_update(peep); - sub_693BE5(peep, 0); + peep_switch_to_special_sprite(peep, 0); } static void peep_state_reset(rct_peep* peep){ @@ -1445,7 +1445,7 @@ static void peep_state_reset(rct_peep* peep){ peep->state = PEEP_STATE_1; peep_window_state_update(peep); - sub_693BE5(peep, 0); + peep_switch_to_special_sprite(peep, 0); } /** @@ -2892,7 +2892,7 @@ static void peep_update_ride_sub_state_2_enter_ride(rct_peep* peep, rct_ride* ri } if (ride->type == RIDE_TYPE_SPIRAL_SLIDE){ - sub_693BE5(peep, 1); + peep_switch_to_special_sprite(peep, 1); } peep_update_ride_sub_state_1(peep); @@ -3366,7 +3366,7 @@ static void peep_update_ride_sub_state_9(rct_peep* peep){ return; } - sub_693BE5(peep, 0); + peep_switch_to_special_sprite(peep, 0); sprite_move(x, y, peep->z, (rct_sprite*)peep); invalidate_sprite_2((rct_sprite*)peep); } @@ -4967,7 +4967,7 @@ static void peep_update_mowing(rct_peep* peep){ peep->var_37++; if (peep->var_37 == 1){ - sub_693BE5(peep, 2); + peep_switch_to_special_sprite(peep, 2); } if (peep->var_37 == countof(_9929C8)) { diff --git a/src/openrct2/peep/peep.h b/src/openrct2/peep/peep.h index 501cf86c81..617d5b0139 100644 --- a/src/openrct2/peep/peep.h +++ b/src/openrct2/peep/peep.h @@ -755,7 +755,7 @@ void peep_update_current_action_sprite_type(rct_peep* peep); void remove_peep_from_ride(rct_peep* peep); void remove_peep_from_queue(rct_peep* peep); -void sub_693BE5(rct_peep* peep, uint8 al); +void peep_switch_to_special_sprite(rct_peep* peep, uint8 special_sprite_id); void peep_update_name_sort(rct_peep *peep); void peep_sort(); void peep_update_names(bool realNames); diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 7fa759e5ed..7adcbc8281 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1170,7 +1170,7 @@ void ride_remove_peeps(sint32 rideIndex) invalidate_sprite_2((rct_sprite*)peep); peep->state = PEEP_STATE_FALLING; - sub_693BE5(peep, 0); + peep_switch_to_special_sprite(peep, 0); peep->happiness = min(peep->happiness, peep->happiness_growth_rate) / 2; peep->happiness_growth_rate = peep->happiness; From ea96ab0225be397bdc2508ef183ba872b12c829f Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 01:02:34 +0100 Subject: [PATCH 35/38] Name sub_6CA162() --- src/openrct2/ride/ride.c | 4 ++-- src/openrct2/windows/ride_construction.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 7adcbc8281..d352f1915b 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -217,7 +217,7 @@ static void ride_update_vehicle_colours(sint32 rideIndex); static void ride_set_vehicle_colours_to_random_preset(rct_ride *ride, uint8 preset_index); void loc_6DDF9C(rct_ride *ride, rct_map_element *mapElement); bool sub_6CA2DF(sint32 *trackType, sint32 *trackDirection, sint32 *rideIndex, sint32 *edxRS16, sint32 *x, sint32 *y, sint32 *z, sint32 *properties); -money32 sub_6CA162(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z); +money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z); rct_ride *get_ride(sint32 index) { @@ -1336,7 +1336,7 @@ void ride_restore_provisional_track_piece() if (sub_6CA2DF(&type, &direction, &rideIndex, &edxRS16, &x, &y, &z, NULL)) { ride_construction_remove_ghosts(); } else { - _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); + _currentTrackPrice = place_provisional_track_piece(rideIndex, type, direction, edxRS16, x, y, z); window_ride_construction_update_active_elements(); } } diff --git a/src/openrct2/windows/ride_construction.c b/src/openrct2/windows/ride_construction.c index 1b2111fb00..7d80c55a5e 100644 --- a/src/openrct2/windows/ride_construction.c +++ b/src/openrct2/windows/ride_construction.c @@ -491,7 +491,7 @@ static void window_ride_construction_update_map_selection(); static void window_ride_construction_update_possible_ride_configurations(); static void window_ride_construction_update_widgets(rct_window *w); static void window_ride_construction_select_map_tiles(rct_ride *ride, sint32 trackType, sint32 trackDirection, sint32 x, sint32 y); -money32 sub_6CA162(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z); +money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z); static void window_ride_construction_show_special_track_dropdown(rct_window *w, rct_widget *widget); static void ride_selected_track_set_seat_rotation(sint32 seatRotation); static void loc_6C7502(sint32 al); @@ -2752,7 +2752,7 @@ static void window_ride_construction_update_enabled_track_pieces() * * rct2: 0x006CA162 */ -money32 sub_6CA162(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z) +money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32 trackDirection, sint32 edxRS16, sint32 x, sint32 y, sint32 z) { rct_ride *ride; money32 result; @@ -2818,7 +2818,7 @@ void sub_6C94D8() if (sub_6CA2DF(&type, &direction, &rideIndex, &edxRS16, &x, &y, &z, NULL)) { ride_construction_remove_ghosts(); } else { - _currentTrackPrice = sub_6CA162(rideIndex, type, direction, edxRS16, x, y, z); + _currentTrackPrice = place_provisional_track_piece(rideIndex, type, direction, edxRS16, x, y, z); window_ride_construction_update_active_elements(); } } @@ -3730,7 +3730,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) if (ride->type == RIDE_TYPE_MAZE) { for (;;) { sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, &x, &y, &z, NULL); - _currentTrackPrice = sub_6CA162(rideIndex, trackType, trackDirection, edxRS16, x, y, z); + _currentTrackPrice = place_provisional_track_piece(rideIndex, trackType, trackDirection, edxRS16, x, y, z); if (_currentTrackPrice != MONEY32_UNDEFINED) break; @@ -3753,7 +3753,7 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) for (;;) { sub_6CA2DF(&trackType, &trackDirection, &rideIndex, &edxRS16, &x, &y, &z, NULL); - _currentTrackPrice = sub_6CA162(rideIndex, trackType, trackDirection, edxRS16, x, y, z); + _currentTrackPrice = place_provisional_track_piece(rideIndex, trackType, trackDirection, edxRS16, x, y, z); if (_currentTrackPrice != MONEY32_UNDEFINED) break; From 325bb3e2daa4f61cb099fd9f1d83d5caa12d5f8b Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 01:16:44 +0100 Subject: [PATCH 36/38] Name sub_88ABA4() --- src/openrct2/ride/gentle/crooked_house.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/ride/gentle/crooked_house.c b/src/openrct2/ride/gentle/crooked_house.c index 82c624f54c..651b2872cb 100644 --- a/src/openrct2/ride/gentle/crooked_house.c +++ b/src/openrct2/ride/gentle/crooked_house.c @@ -43,7 +43,7 @@ rct_crooked_house_bound_box crooked_house_data[] = { * @param (ebx) image_id * @param (edx) height */ -static void sub_88ABA4(uint8 direction, uint8 x_offset, uint8 y_offset, uint32 segment, sint32 height) { +static void paint_crooked_house_structure(uint8 direction, uint8 x_offset, uint8 y_offset, uint32 segment, sint32 height) { rct_map_element *original_map_element = g_currently_drawn_item; rct_ride *ride = get_ride(original_map_element->properties.track.ride_index); @@ -80,10 +80,10 @@ static void paint_crooked_house(uint8 rideIndex, uint8 trackSequence, uint8 dire track_paint_util_paint_fences(edges, position, mapElement, ride, gTrackColours[SCHEME_MISC], height, fenceSpritesRope, get_current_rotation()); switch(trackSequence) { - case 3: sub_88ABA4(direction, 32, 224, 0, height); break; + case 3: paint_crooked_house_structure(direction, 32, 224, 0, height); break; // case 5: sub_88ABA4(direction, 0, 224, 1, height); break; - case 6: sub_88ABA4(direction, 224, 32, 4, height); break; - case 7: sub_88ABA4(direction, 224, 224, 2, height); break; + case 6: paint_crooked_house_structure(direction, 224, 32, 4, height); break; + case 7: paint_crooked_house_structure(direction, 224, 224, 2, height); break; // case 8: sub_88ABA4(rideIndex, 224, 0, 3, height); break; } From f0dec49e6dc0876391758bde6e27746468ac1037 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 13:48:06 +0100 Subject: [PATCH 37/38] Add RCT2 address comments [ci skip] --- src/openrct2/interface/viewport.c | 3 +++ src/openrct2/peep/peep.c | 4 ++++ src/openrct2/ride/ride.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/openrct2/interface/viewport.c b/src/openrct2/interface/viewport.c index 1f8c19ec3d..6b83098b34 100644 --- a/src/openrct2/interface/viewport.c +++ b/src/openrct2/interface/viewport.c @@ -250,6 +250,9 @@ void viewport_adjust_for_map_height(sint16* x, sint16* y, sint16 *z) *z = height; } +/* +* rct2: 0x006E7FF3 +*/ static void viewport_redraw_after_shift(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport *viewport, sint32 x, sint32 y) { // sub-divide by intersecting windows diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 4ce0781bf0..37594e2c3f 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -1392,6 +1392,10 @@ static uint8 peep_get_action_sprite_type(rct_peep* peep) } } + +/* +* rct2: 0x00693B58 +*/ void peep_update_current_action_sprite_type(rct_peep* peep){ if (peep->sprite_type >= countof(g_peep_animation_entries)) { return; diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index d352f1915b..481a90553f 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1400,6 +1400,9 @@ void ride_construction_remove_ghosts() } } +/* +* rct2: 0x006C9627 +*/ void ride_construction_invalidate_current_track() { sint32 x, y, z; From aa81ee460146fee9e320b3cee19e922ca35faf6c Mon Sep 17 00:00:00 2001 From: rwjuk Date: Tue, 6 Jun 2017 13:55:23 +0100 Subject: [PATCH 38/38] Add another RCT2 address comment [ci skip] --- src/openrct2/peep/peep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openrct2/peep/peep.c b/src/openrct2/peep/peep.c index 37594e2c3f..683f7ba1a8 100644 --- a/src/openrct2/peep/peep.c +++ b/src/openrct2/peep/peep.c @@ -7846,7 +7846,9 @@ void peep_set_map_tooltip(rct_peep *peep) } } - +/** +* rct2: 0x00693BAB +*/ void peep_switch_to_next_action_sprite_type(rct_peep* peep) { // TBD: Add nextActionSpriteType as function parameter and make peep->next_action_sprite_type obsolete? uint8 nextActionSpriteType = peep->next_action_sprite_type;