From 69221606ef212a595dfa9f022dac1eecf9a73734 Mon Sep 17 00:00:00 2001 From: Helio Santos Date: Wed, 8 Jul 2020 15:07:00 -0700 Subject: [PATCH 1/4] Part of #12165: Use CoordsXYZ on steam_particle_create Updated steam_particle_create function prototype to use CoordsXYZ. Updated caller(s) accordingly. --- src/openrct2/ride/Vehicle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index f6773160a9..9eea88950a 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -7173,10 +7173,10 @@ void Vehicle::UpdateSpinningCar() * * rct2: 0x006734B2 */ -static void steam_particle_create(int16_t x, int16_t y, int16_t z) +static void steam_particle_create(const CoordsXYZ& coords) { - auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); - if (surfaceElement != nullptr && z > surfaceElement->GetBaseZ()) + auto surfaceElement = map_get_surface_element_at(coords); + if (surfaceElement != nullptr && coords.z > surfaceElement->GetBaseZ()) { SteamParticle* steam = &create_sprite(SPRITE_IDENTIFIER_MISC)->steam_particle; if (steam == nullptr) @@ -7189,7 +7189,7 @@ static void steam_particle_create(int16_t x, int16_t y, int16_t z) steam->type = SPRITE_MISC_STEAM_PARTICLE; steam->frame = 256; steam->time_to_move = 0; - steam->MoveTo({ x, y, z }); + steam->MoveTo(coords); } } @@ -7243,7 +7243,7 @@ void Vehicle::UpdateAdditionalAnimation() }(); int32_t directionIndex = sprite_direction >> 1; auto offset = SteamParticleOffsets[typeIndex][directionIndex]; - steam_particle_create(x + offset.x, y + offset.y, z + offset.z); + steam_particle_create({ x + offset.x, y + offset.y, z + offset.z }); } } } From a524b2d5ba2d1009a9d24df88d7354357c452169 Mon Sep 17 00:00:00 2001 From: Helio Santos Date: Thu, 9 Jul 2020 08:02:45 -0700 Subject: [PATCH 2/4] Part of #12165: Use CoordsXYZ on vehicle_check_collision Updated vehicle_check_collision function prototype to use CoordsXYZ. Updated caller(s) accordingly. --- src/openrct2/ride/Vehicle.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 9eea88950a..9c6d9005f6 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -5130,34 +5130,34 @@ void Vehicle::UpdateDoingCircusShow() * rct2: 0x0068B8BD * @returns the map element that the vehicle will collide with or NULL if no collisions. */ -static TileElement* vehicle_check_collision(int16_t x, int16_t y, int16_t z) +static TileElement* vehicle_check_collision(const CoordsXYZ& vehiclePosition) { - TileElement* tileElement = map_get_first_element_at({ x, y }); + TileElement* tileElement = map_get_first_element_at(vehiclePosition); if (tileElement == nullptr) { return nullptr; } uint8_t quadrant; - if ((x & 0x1F) >= 16) + if ((vehiclePosition.x & 0x1F) >= 16) { quadrant = 1; - if ((y & 0x1F) < 16) + if ((vehiclePosition.y & 0x1F) < 16) quadrant = 2; } else { quadrant = 4; - if ((y & 0x1F) >= 16) + if ((vehiclePosition.y & 0x1F) >= 16) quadrant = 8; } do { - if (z < tileElement->GetBaseZ()) + if (vehiclePosition.z < tileElement->GetBaseZ()) continue; - if (z >= tileElement->GetClearanceZ()) + if (vehiclePosition.z >= tileElement->GetClearanceZ()) continue; if (tileElement->GetOccupiedQuadrants() & quadrant) @@ -5398,7 +5398,7 @@ void Vehicle::UpdateCrash() continue; } - TileElement* collideElement = vehicle_check_collision(curVehicle->x, curVehicle->y, curVehicle->z); + TileElement* collideElement = vehicle_check_collision({ curVehicle->x, curVehicle->y, curVehicle->z }); if (collideElement == nullptr) { curVehicle->sub_state = 1; From f85319ec8e48f63f30fa3add820c187e1f4db56d Mon Sep 17 00:00:00 2001 From: Helio Santos Date: Thu, 9 Jul 2020 08:05:43 -0700 Subject: [PATCH 3/4] Part of #12165: Use CoordsXYZ on try_add_synchronised_station Updated try_add_synchronised_station function prototype to use CoordsXYZ. Updated caller(s) accordingly. --- src/openrct2/ride/Vehicle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 9c6d9005f6..2fe6c8d000 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -2690,15 +2690,15 @@ static rct_synchronised_vehicle* _lastSynchronisedVehicle = nullptr; * to synchronise to the vehicle synchronisation list. * rct2: 0x006DE1A4 */ -static bool try_add_synchronised_station(int32_t x, int32_t y, int32_t z) +static bool try_add_synchronised_station(const CoordsXYZ& coords) { // make sure we are in map bounds - if (!map_is_location_valid({ x, y })) + if (!map_is_location_valid(coords)) { return false; } - TileElement* tileElement = get_station_platform(x, y, z, 2); + TileElement* tileElement = get_station_platform(coords.x, coords.y, coords.z, 2); if (tileElement == nullptr) { /* No station platform element found, @@ -2819,7 +2819,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex { x += CoordsDirectionDelta[direction].x; y += CoordsDirectionDelta[direction].y; - if (try_add_synchronised_station(x, y, z)) + if (try_add_synchronised_station({ x, y, z })) { spaceBetween = maxCheckDistance; continue; @@ -2841,7 +2841,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex { x += CoordsDirectionDelta[direction].x; y += CoordsDirectionDelta[direction].y; - if (try_add_synchronised_station(x, y, z)) + if (try_add_synchronised_station({ x, y, z })) { spaceBetween = maxCheckDistance; continue; From 54acc20a773567fffb3daa5e574f9f5ca274b72e Mon Sep 17 00:00:00 2001 From: Helio Santos Date: Thu, 9 Jul 2020 08:06:54 -0700 Subject: [PATCH 4/4] Add heliobatimarqui contributors.md Inserted my name on contributors file --- contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.md b/contributors.md index 321e18d1a1..86fa6002ad 100644 --- a/contributors.md +++ b/contributors.md @@ -88,6 +88,7 @@ The following people are not part of the development team, but have been contrib * Peter Ryszkiewicz (pRizz) - Added horizontal grid lines to finance charts. * Hudson Oliveira (hdpoliveira) - Misc. * Jim Verheijde (Jimver) - Make handymen less likely to get stuck in queue lines, misc. +* Helio Batimarqui (batimarqui) - Misc. ## Bug fixes * (halfbro)