From edbca479e3e3ce11d432b09773987121dd2c1d7a Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 20 Feb 2016 15:50:05 +0000 Subject: [PATCH] remove old usages of 0x00993CCC and 0x00F441D3 --- src/ride/ride.c | 35 +++++++++++++++++------------------ src/ride/track.c | 12 ++++++------ src/ride/vehicle.c | 20 ++++++++++---------- src/windows/track_place.c | 4 ++-- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/ride/ride.c b/src/ride/ride.c index 6314da06e3..6158d4ef82 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -393,11 +393,10 @@ bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output) bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 rideIndex, uint8 direction_start, rct_xy_element *output, int *z, int *direction) { rct_ride* ride = get_ride(rideIndex); - RCT2_GLOBAL(0x00F441D3, uint8) = direction_start; if (!(direction_start & (1 << 2))){ - x += RCT2_ADDRESS(0x00993CCC, sint16)[RCT2_GLOBAL(0x00F441D3, uint8) * 2]; - y += RCT2_ADDRESS(0x00993CCE, sint16)[RCT2_GLOBAL(0x00F441D3, uint8) * 2]; + x += TileDirectionDelta[direction_start].x; + y += TileDirectionDelta[direction_start].y; } rct_map_element* mapElement = map_get_first_element_at(x / 32, y / 32); @@ -425,7 +424,7 @@ bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 ri (mapElement->type & MAP_ELEMENT_DIRECTION_MASK)) & MAP_ELEMENT_DIRECTION_MASK) | (nextTrackCoordinate->rotation_begin & (1 << 2)); - if (nextRotation != RCT2_GLOBAL(0x00F441D3, uint8)) + if (nextRotation != direction_start) continue; sint16 nextZ = nextTrackCoordinate->z_begin - nextTrackBlock->z + mapElement->base_height * 8; @@ -440,7 +439,7 @@ bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 ri return 1; } while (!map_element_is_last_for_tile(mapElement++)); - if (direction != NULL) *direction = RCT2_GLOBAL(0x00F441D3, uint8); + if (direction != NULL) *direction = direction_start; if (z != NULL) *z = z_start; output->x = x; output->y = y; @@ -516,12 +515,12 @@ bool track_block_get_next(rct_xy_element *input, rct_xy_element *output, int *z, bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8 direction, track_begin_end *outTrackBeginEnd){ rct_ride* ride = get_ride(rideIndex); - RCT2_GLOBAL(0x00F441D3, uint8) = direction; + uint8 directionStart = direction; direction ^= (1 << 1); if (!(direction & (1 << 2))){ - x += RCT2_ADDRESS(0x00993CCC, sint16)[direction * 2]; - y += RCT2_ADDRESS(0x00993CCE, sint16)[direction * 2]; + x += TileDirectionDelta[direction].x; + y += TileDirectionDelta[direction].y; } rct_map_element* mapElement = map_get_first_element_at(x / 32, y / 32); @@ -529,7 +528,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride outTrackBeginEnd->end_x = x; outTrackBeginEnd->end_y = y; outTrackBeginEnd->begin_element = NULL; - outTrackBeginEnd->begin_direction = RCT2_GLOBAL(0x00F441D3, uint8) ^ (1 << 1); + outTrackBeginEnd->begin_direction = directionStart ^ (1 << 1); return 0; } @@ -552,7 +551,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride (mapElement->type & MAP_ELEMENT_DIRECTION_MASK)) & MAP_ELEMENT_DIRECTION_MASK) | (nextTrackCoordinate->rotation_end & (1 << 2)); - if (nextRotation != RCT2_GLOBAL(0x00F441D3, uint8)) + if (nextRotation != directionStart) continue; sint16 nextZ = nextTrackCoordinate->z_end - nextTrackBlock->z + mapElement->base_height * 8; @@ -593,7 +592,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride nextTrackBlock->z; outTrackBeginEnd->begin_direction = nextRotation; - outTrackBeginEnd->end_direction = RCT2_GLOBAL(0x00F441D3, uint8) ^ (1 << 1); + outTrackBeginEnd->end_direction = directionStart ^ (1 << 1); return 1; } while (!map_element_is_last_for_tile(mapElement++)); @@ -601,7 +600,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride outTrackBeginEnd->end_y = y; outTrackBeginEnd->begin_z = z; outTrackBeginEnd->begin_element = NULL; - outTrackBeginEnd->end_direction = RCT2_GLOBAL(0x00F441D3, uint8) ^ (1 << 1); + outTrackBeginEnd->end_direction = directionStart ^ (1 << 1); return 0; } @@ -2482,8 +2481,8 @@ rct_peep *ride_find_closest_mechanic(rct_ride *ride, int forInspection) x *= 32; y *= 32; direction = mapElement->type & 3; - x -= RCT2_ADDRESS(0x00993CCC, sint16)[direction * 2]; - y -= RCT2_ADDRESS(0x00993CCE, sint16)[direction * 2]; + x -= TileDirectionDelta[direction].x; + y -= TileDirectionDelta[direction].y; x += 16; y += 16; @@ -3058,8 +3057,8 @@ static int ride_entrance_exit_is_reachable(uint16 coordinate, rct_ride* ride, in x *= 32; y *= 32; - x -= RCT2_ADDRESS(0x00993CCC, sint16)[face_direction * 2]; - y -= RCT2_ADDRESS(0x00993CCE, sint16)[face_direction * 2]; + x -= TileDirectionDelta[face_direction].x; + y -= TileDirectionDelta[face_direction].y; x /= 32; y /= 32; @@ -3147,8 +3146,8 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx) // Flip direction north<->south, east<->west uint8 face_direction = count ^ 2; - int y2 = y - RCT2_ADDRESS(0x00993CCE, sint16)[face_direction * 2]; - int x2 = x - RCT2_ADDRESS(0x00993CCC, sint16)[face_direction * 2]; + int y2 = y - TileDirectionDelta[face_direction].x; + int x2 = x - TileDirectionDelta[face_direction].y; if (map_coord_is_connected(x2 / 32, y2 / 32, mapElement->base_height, face_direction)) return; diff --git a/src/ride/track.c b/src/ride/track.c index 8c74bcc7b5..f4b2e91dd3 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -1781,8 +1781,8 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac rotation |= (1 << 2); if (!(rotation & (1 << 2))){ - x += RCT2_ADDRESS(0x00993CCC, sint16)[rotation * 2]; - y += RCT2_ADDRESS(0x00993CCE, sint16)[rotation * 2]; + x += TileDirectionDelta[rotation].x; + y += TileDirectionDelta[rotation].y; } } @@ -1860,8 +1860,8 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac if (RCT2_GLOBAL(0x00F440D4, uint8) != 1){ rct_xy16 tile; - tile.x = x + RCT2_ADDRESS(0x00993CCC, sint16)[rotation * 2]; - tile.y = y + RCT2_ADDRESS(0x00993CCE, sint16)[rotation * 2]; + tile.x = x + TileDirectionDelta[rotation].x; + tile.y = y + TileDirectionDelta[rotation].y; rct_map_element* map_element = map_get_first_element_at(tile.x / 32, tile.y / 32); z = RCT2_GLOBAL(0x00F44146, sint16) / 8; @@ -4688,8 +4688,8 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in _bl &= ~(1 << dl); int temp_x = x, temp_y = y; int temp_direction = (direction + dl) & 3; - temp_x += RCT2_ADDRESS(0x00993CCC, sint16)[temp_direction * 2]; - temp_y += RCT2_ADDRESS(0x00993CCE, sint16)[temp_direction * 2]; + temp_x += TileDirectionDelta[temp_direction].x; + temp_y += TileDirectionDelta[temp_direction].y; temp_direction ^= (1 << 1); map_remove_intersecting_walls(temp_x, temp_y, baseZ, clearanceZ, temp_direction & 3); } diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 466bf66370..554b5bd4c9 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -2105,8 +2105,8 @@ static void vehicle_update_travelling_boat_hire_setup(rct_vehicle* vehicle) { vehicle->track_y = vehicle->y & 0xFFE0; rct_xy8 location = { - .x = (vehicle->track_x + RCT2_ADDRESS(0x00993CCC, sint16)[2 * (vehicle->sprite_direction >> 3)]) / 32, - .y = (vehicle->track_y + RCT2_ADDRESS(0x00993CCE, sint16)[2 * (vehicle->sprite_direction >> 3)]) / 32 + .x = (vehicle->track_x + TileDirectionDelta[vehicle->sprite_direction >> 3].x) / 32, + .y = (vehicle->track_y + TileDirectionDelta[vehicle->sprite_direction >> 3].y) / 32 }; vehicle->boat_location = location; @@ -3437,8 +3437,8 @@ static void sub_6DA280(rct_vehicle *vehicle) rct_ride* ride = get_ride(vehicle->ride); rct_xy8 location = { - .x = (vehicle->x + RCT2_ADDRESS(0x00993CCC, sint16)[2 * (ride->boat_hire_return_direction & 3)]) / 32, - .y = (vehicle->y + RCT2_ADDRESS(0x00993CCE, sint16)[2 * (ride->boat_hire_return_direction & 3)]) / 32 + .x = (vehicle->x + TileDirectionDelta[ride->boat_hire_return_direction & 3].x) / 32, + .y = (vehicle->y + TileDirectionDelta[ride->boat_hire_return_direction & 3].y) / 32 }; if (*((uint16*)&location) == ride->boat_hire_return_position) { @@ -3455,8 +3455,8 @@ static void sub_6DA280(rct_vehicle *vehicle) if (scenario_rand() & 1 && (!(rideEntry->flags & RIDE_ENTRY_FLAG_7) || vehicle->lost_time_out > 1920)) { location = *((rct_xy8*)&ride->boat_hire_return_position); rct_xy16 destLocation = { - .x = location.x * 32 - RCT2_ADDRESS(0x00993CCC, sint16)[2 * (ride->boat_hire_return_direction & 3)] + 16, - .y = location.y * 32 - RCT2_ADDRESS(0x00993CCE, sint16)[2 * (ride->boat_hire_return_direction & 3)] + 16 + .x = location.x * 32 - TileDirectionDelta[ride->boat_hire_return_direction & 3].x + 16, + .y = location.y * 32 - TileDirectionDelta[ride->boat_hire_return_direction & 3].y + 16 }; destLocation.x -= vehicle->x; @@ -3475,8 +3475,8 @@ static void sub_6DA280(rct_vehicle *vehicle) continue; } - sint16 x = vehicle->track_x + RCT2_ADDRESS(0x00993CCC, sint16)[2 * (randDirection + rotations[i] & 3)]; - sint16 y = vehicle->track_y + RCT2_ADDRESS(0x00993CCE, sint16)[2 * (randDirection + rotations[i] & 3)]; + sint16 x = vehicle->track_x + TileDirectionDelta[(randDirection + rotations[i]) & 3].x; + sint16 y = vehicle->track_y + TileDirectionDelta[(randDirection + rotations[i]) & 3].y; if (vehicle_is_boat_on_water(vehicle, x, y)) { continue; @@ -3486,8 +3486,8 @@ static void sub_6DA280(rct_vehicle *vehicle) return; } - sint16 x = vehicle->track_x + RCT2_ADDRESS(0x00993CCC, sint16)[2 * (curDirection & 3)]; - sint16 y = vehicle->track_y + RCT2_ADDRESS(0x00993CCE, sint16)[2 * (curDirection & 3)]; + sint16 x = vehicle->track_x + TileDirectionDelta[curDirection & 3].x; + sint16 y = vehicle->track_y + TileDirectionDelta[curDirection & 3].y; vehicle->boat_location.x = x / 32; vehicle->boat_location.y = y / 32; } diff --git a/src/windows/track_place.c b/src/windows/track_place.c index 587a1935f4..0567f9722e 100644 --- a/src/windows/track_place.c +++ b/src/windows/track_place.c @@ -240,8 +240,8 @@ static void window_track_place_draw_mini_preview() if (track_coordinate->rotation_end & 4) rotation |= 4; if (!(rotation & 4)) { - originX += RCT2_GLOBAL(0x00993CCC + (rotation * 4), sint16); - originY += RCT2_GLOBAL(0x00993CCE + (rotation * 4), sint16); + originX += TileDirectionDelta[rotation].x; + originY += TileDirectionDelta[rotation].y; } trackElement++; }