diff --git a/src/ride/ride.c b/src/ride/ride.c index 01ec491a0b..908f3a91ad 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -178,6 +178,11 @@ uint8 _currentBrakeSpeed; uint8 _currentBrakeSpeed2; uint8 _currentSeatRotationAngle; +rct_xy16 _unkF44188; +rct_xyzd16 _unkF440BF; +uint8 _unkF440C4; +rct_xyzd16 _unkF440C5; + uint8 gRideEntranceExitPlaceType; uint8 gRideEntranceExitPlaceRideIndex; uint8 gRideEntranceExitPlaceStationIndex; @@ -1347,12 +1352,12 @@ void sub_6C96C0() if (_currentTrackSelectionFlags & 4) { _currentTrackSelectionFlags &= ~4; game_do_command( - RCT2_GLOBAL(0x00F440BF, uint16), + _unkF440BF.x, (GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_APPLY), - RCT2_GLOBAL(0x00F440C1, uint16), + _unkF440BF.y, _currentRideIndex, GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, - RCT2_GLOBAL(0x00F440C4, uint8), + _unkF440C4, 0 ); } @@ -1361,9 +1366,9 @@ void sub_6C96C0() rideIndex = _currentRideIndex; - x = RCT2_GLOBAL(0x00F440C5, uint16); - y = RCT2_GLOBAL(0x00F440C7, uint16); - z = RCT2_GLOBAL(0x00F440C9, uint16); + x = _unkF440C5.x; + y = _unkF440C5.y; + z = _unkF440C5.z; ride = get_ride(rideIndex); if (ride->type == RIDE_TYPE_MAZE) { @@ -1372,7 +1377,7 @@ void sub_6C96C0() game_do_command(x + 16, 41 | (2 << 8), y + 16, rideIndex | (2 << 8), GAME_COMMAND_SET_MAZE_TRACK, z, 0); game_do_command(x + 16, 41 | (3 << 8), y , rideIndex | (2 << 8), GAME_COMMAND_SET_MAZE_TRACK, z, 0); } else { - direction = RCT2_GLOBAL(0x00F440CB, uint8); + direction = _unkF440C5.direction; if (!(direction & 4)) { x -= TileDirectionDelta[direction].x; y -= TileDirectionDelta[direction].y; @@ -7072,10 +7077,10 @@ money32 ride_get_entrance_or_exit_price(int rideIndex, int x, int y, int directi ); if (result != MONEY32_UNDEFINED) { _currentTrackSelectionFlags |= (1 << 2); - RCT2_GLOBAL(0x00F440BF, uint16) = x; - RCT2_GLOBAL(0x00F440C1, uint16) = y; - RCT2_GLOBAL(0x00F440C3, uint8) = direction; - RCT2_GLOBAL(0x00F440C4, uint8) = di & 0xFF; + _unkF440BF.x = x; + _unkF440BF.y = y; + _unkF440BF.direction = direction; + _unkF440C4 = di & 0xFF; } return result; } @@ -7149,10 +7154,10 @@ void ride_get_entrance_or_exit_position_from_screen_position(int screenX, int sc word_F4418C = mapX; word_F4418E = mapY; - RCT2_GLOBAL(0x00F44188, uint16) = floor2(mapX, 32); - RCT2_GLOBAL(0x00F4418A, uint16) = floor2(mapY, 32); - *outX = RCT2_GLOBAL(0x00F44188, uint16); - *outY = RCT2_GLOBAL(0x00F4418A, uint16); + _unkF44188.x = floor2(mapX, 32); + _unkF44188.y = floor2(mapY, 32); + *outX = _unkF44188.x; + *outY = _unkF44188.y; if (ride->type == RIDE_TYPE_NULL) return; @@ -7173,8 +7178,8 @@ void ride_get_entrance_or_exit_position_from_screen_position(int screenX, int sc } for (int i = 0; i < 4; i++) { - mapX = RCT2_GLOBAL(0x00F44188, uint16) + TileDirectionDelta[direction].x; - mapY = RCT2_GLOBAL(0x00F4418A, uint16) + TileDirectionDelta[direction].y; + mapX = _unkF44188.x + TileDirectionDelta[direction].x; + mapY = _unkF44188.y + TileDirectionDelta[direction].y; if (mapX >= 0 && mapY >= 0 && mapX < (256 * 32) && mapY < (256 * 32)) { mapElement = map_get_first_element_at(mapX >> 5, mapY >> 5); do { diff --git a/src/ride/ride.h b/src/ride/ride.h index 8deef146bb..4ba726df6b 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -965,6 +965,11 @@ extern uint8 _currentBrakeSpeed; extern uint8 _currentBrakeSpeed2; extern uint8 _currentSeatRotationAngle; +extern rct_xy16 _unkF44188; +extern rct_xyzd16 _unkF440BF; +extern uint8 _unkF440C4; +extern rct_xyzd16 _unkF440C5; + extern uint8 gRideEntranceExitPlaceType; extern uint8 gRideEntranceExitPlaceRideIndex; extern uint8 gRideEntranceExitPlaceStationIndex; diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index d1c2ca3dd3..1c2a9cafe9 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -464,6 +464,8 @@ static money32 _trackPlaceCost; static bool _autoOpeningShop; static uint8 _rideConstructionState2; +static uint32 _currentDisabledSpecialTrackPieces; + // This variable is updated separately from ride->num_stations because the latter // is unreliable if currently in station construction mode static bool _stationConstructed; @@ -2718,10 +2720,10 @@ money32 sub_6CA162(int rideIndex, int trackType, int trackDirection, int edxRS16 if (result == MONEY32_UNDEFINED) return result; - RCT2_GLOBAL(0x00F440C5, uint16) = x; - RCT2_GLOBAL(0x00F440C7, uint16) = y; - RCT2_GLOBAL(0x00F440C9, uint16) = z; - RCT2_GLOBAL(0x00F440CB, uint8) = trackDirection; + _unkF440C5.x = x; + _unkF440C5.y = y; + _unkF440C5.z = z; + _unkF440C5.direction = trackDirection; _currentTrackSelectionFlags |= 2; viewport_set_visibility(gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND ? 1 : 3); if (_currentTrackSlopeEnd != 0) @@ -2733,14 +2735,14 @@ money32 sub_6CA162(int rideIndex, int trackType, int trackDirection, int edxRS16 if (result == MONEY32_UNDEFINED) return result; - RCT2_GLOBAL(0x00F440C5, uint16) = x; - RCT2_GLOBAL(0x00F440C7, uint16) = y; + _unkF440C5.x = x; + _unkF440C5.y = y; z += ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE) ? FlatTrackCoordinates[trackType].z_begin: TrackCoordinates[trackType].z_begin; - RCT2_GLOBAL(0x00F440C9, uint16) = z; - RCT2_GLOBAL(0x00F440CB, uint8) = trackDirection; + _unkF440C5.z = z; + _unkF440C5.direction = trackDirection; _currentTrackSelectionFlags |= 2; viewport_set_visibility(gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND ? 1 : 3); if (_currentTrackSlopeEnd != 0) @@ -2966,14 +2968,14 @@ static void window_ride_construction_update_possible_ride_configurations() continue; _currentPossibleRideConfigurations[currentPossibleRideConfigurationIndex] = trackType; - RCT2_GLOBAL(0x00F4409C, uint32) |= (1 << currentPossibleRideConfigurationIndex); + _currentDisabledSpecialTrackPieces |= (1 << currentPossibleRideConfigurationIndex); if ( _currentTrackPieceDirection < 4 && slope == _previousTrackSlopeEnd && bank == _previousTrackBankEnd && (trackType != TRACK_ELEM_TOWER_BASE || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_29)) ) { - RCT2_GLOBAL(0x00F4409C, uint32) &= ~(1 << currentPossibleRideConfigurationIndex); + _currentDisabledSpecialTrackPieces &= ~(1 << currentPossibleRideConfigurationIndex); _numCurrentPossibleSpecialTrackPieces++; } currentPossibleRideConfigurationIndex++; @@ -3510,7 +3512,7 @@ static void window_ride_construction_show_special_track_dropdown(rct_window *w, widget->right - widget->left ); - gDropdownItemsDisabled = (uint64)RCT2_GLOBAL(0x00F4409C, uint32); + gDropdownItemsDisabled = _currentDisabledSpecialTrackPieces; gDropdownDefaultIndex = defaultIndex; } @@ -3747,10 +3749,10 @@ void ride_construction_toolupdate_entrance_exit(int screenX, int screenY) unk = gRideEntranceExitPlaceStationIndex; if ( !(_currentTrackSelectionFlags & 4) || - x != RCT2_GLOBAL(0x00F440BF, uint16) || - y != RCT2_GLOBAL(0x00F440C1, uint16) || - direction != RCT2_GLOBAL(0x00F440C3, uint8) || - unk != RCT2_GLOBAL(0x00F440C4, uint8) + x != _unkF440BF.x || + y != _unkF440BF.y || + direction != _unkF440BF.direction || + unk != _unkF440C4 ) { _currentTrackPrice = ride_get_entrance_or_exit_price( _currentRideIndex, x, y, direction, gRideEntranceExitPlaceType, unk @@ -3983,9 +3985,9 @@ static void ride_construction_tooldown_entrance_exit(int screenX, int screenY) game_command_callback = game_command_callback_place_ride_entrance_or_exit; game_do_command( - RCT2_GLOBAL(0x00F44188, uint16), + _unkF44188.x, (GAME_COMMAND_FLAG_APPLY) | ((gRideEntranceExitPlaceDirection ^ 2) << 8), - RCT2_GLOBAL(0x00F4418A, uint16), + _unkF44188.y, gRideEntranceExitPlaceRideIndex | (gRideEntranceExitPlaceType << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, gRideEntranceExitPlaceStationIndex, diff --git a/src/world/map.h b/src/world/map.h index a7c2ae4702..5a8cda5080 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -272,6 +272,12 @@ typedef struct rct_xyz16 { } rct_xyz16; assert_struct_size(rct_xyz16, 6); +typedef struct rct_xyzd16 { + sint16 x, y, z; + uint8 direction; +} rct_xyzd16; +assert_struct_size(rct_xyzd16, 7); + typedef struct rct_xy32 { sint32 x, y; } rct_xy32;