diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 8ff2edc189..eaefc167e2 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1696,7 +1696,7 @@ rct_window* window_ride_open_track(TileElement* tileElement) */ rct_window* window_ride_open_vehicle(Vehicle* vehicle) { - Vehicle* headVehicle = vehicle_get_head(vehicle); + Vehicle* headVehicle = vehicle->TrainHead(); uint16_t headVehicleSpriteIndex = headVehicle->sprite_index; auto ride = get_ride(headVehicle->ride); if (ride == nullptr) diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 09561ec1c2..fe8aefd11e 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -725,7 +725,7 @@ void lightfx_add_lights_magic_vehicle(const Vehicle* vehicle) break; case RIDE_TYPE_MINE_TRAIN_COASTER: case RIDE_TYPE_GHOST_TRAIN: - if (vehicle == vehicle_get_head(vehicle)) + if (vehicle == vehicle->TrainHead()) { place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; @@ -748,7 +748,7 @@ void lightfx_add_lights_magic_vehicle(const Vehicle* vehicle) case RIDE_TYPE_SPLASH_BOATS: case RIDE_TYPE_WATER_COASTER: { - Vehicle* vehicle_draw = vehicle_get_head(vehicle); + Vehicle* vehicle_draw = vehicle->TrainHead(); if (vehicle_draw->next_vehicle_on_train != SPRITE_INDEX_NULL) { vehicle_draw = GET_VEHICLE(vehicle_draw->next_vehicle_on_train); @@ -770,7 +770,7 @@ void lightfx_add_lights_magic_vehicle(const Vehicle* vehicle) lightfx_add_3d_light( vehicleID, 0x0000 | LIGHTFX_LIGHT_QUALIFIER_SPRITE, vehicle->x, vehicle->y, vehicle->z + 12, LIGHTFX_LIGHT_TYPE_SPOT_2); - if (vehicle == vehicle_get_head(vehicle)) + if (vehicle == vehicle->TrainHead()) { place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; @@ -783,7 +783,7 @@ void lightfx_add_lights_magic_vehicle(const Vehicle* vehicle) vehicleID, 0x0200 | LIGHTFX_LIGHT_QUALIFIER_SPRITE, place_x, place_y, place_z + 2, LIGHTFX_LIGHT_TYPE_LANTERN_3); } - if (vehicle == vehicle_get_tail(vehicle)) + if (vehicle == vehicle->TrainTail()) { place_x += offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y += offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; @@ -798,7 +798,7 @@ void lightfx_add_lights_magic_vehicle(const Vehicle* vehicle) } break; case RIDE_TYPE_MINIATURE_RAILWAY: - if (vehicle == vehicle_get_head(vehicle)) + if (vehicle == vehicle->TrainHead()) { place_x -= offsetLookup[(vehicle->sprite_direction + 0) % 32] * 2; place_y -= offsetLookup[(vehicle->sprite_direction + 8) % 32] * 2; diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index b138c4fabf..016ab0e5db 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -377,7 +377,7 @@ int32_t cable_lift_update_track_motion(Vehicle* cableLift) Vehicle* frontVehicle = cableLift; if (cableLift->velocity < 0) { - frontVehicle = vehicle_get_tail(cableLift); + frontVehicle = cableLift->TrainTail(); } _vehicleFrontVehicle = frontVehicle; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index bdfd7c0608..5d32811d6f 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -4402,7 +4402,7 @@ static Vehicle* vehicle_create_car( vehicle->sprite_direction = scenario_rand() & 0x1E; chosenLoc.y = y + (scenario_rand() & 0xFF); chosenLoc.x = x + (scenario_rand() & 0xFF); - } while (vehicle_update_dodgems_collision(vehicle, chosenLoc.x, chosenLoc.y, nullptr)); + } while (vehicle->DodgemsCarWouldCollideAt(chosenLoc, nullptr)); sprite_move(chosenLoc.x, chosenLoc.y, z, vehicle); } @@ -4740,7 +4740,7 @@ static bool ride_create_vehicles(Ride* ride, CoordsXYE* element, int32_t isApply { Vehicle* vehicle = GET_VEHICLE(ride->vehicles[i]); - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_DODGEM_CAR_PLACEMENT)) { @@ -7483,7 +7483,7 @@ void fix_invalid_vehicle_sprite_sizes() break; } - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { break; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 60010e0712..c589d4b728 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -2974,18 +2974,19 @@ static bool vehicle_can_depart_synchronised(Vehicle* vehicle) * * rct2: 0x006D9EB0 */ -void vehicle_peep_easteregg_here_we_are(const Vehicle* vehicle) +void Vehicle::PeepEasterEggHereWeAre() const { + const Vehicle* vehicle = this; uint16_t spriteId = vehicle->sprite_index; do { vehicle = GET_VEHICLE(spriteId); for (int32_t i = 0; i < vehicle->num_peeps; ++i) { - Peep* peep = GET_PEEP(vehicle->peep[i]); - if (peep->peep_flags & PEEP_FLAGS_HERE_WE_ARE) + Peep* curPeep = GET_PEEP(vehicle->peep[i]); + if (curPeep->peep_flags & PEEP_FLAGS_HERE_WE_ARE) { - peep->InsertNewThought(PEEP_THOUGHT_TYPE_HERE_WE_ARE, peep->current_ride); + curPeep->InsertNewThought(PEEP_THOUGHT_TYPE_HERE_WE_ARE, curPeep->current_ride); } } } while ((spriteId = vehicle->next_vehicle_on_train) != SPRITE_INDEX_NULL); @@ -3172,7 +3173,7 @@ void Vehicle::UpdateDeparting() } sub_state = 1; - vehicle_peep_easteregg_here_we_are(this); + PeepEasterEggHereWeAre(); if (rideEntry->flags & RIDE_ENTRY_FLAG_PLAY_DEPART_SOUND) { @@ -4156,7 +4157,7 @@ void Vehicle::UpdateTravellingCableLift() } sub_state = 1; - vehicle_peep_easteregg_here_we_are(this); + PeepEasterEggHereWeAre(); if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED)) { if (update_flags & VEHICLE_UPDATE_FLAG_TESTING) @@ -4260,7 +4261,7 @@ void Vehicle::UpdateMotionBoatHire() _vehicleVelocityF64E08 = velocity; _vehicleVelocityF64E0C = (velocity >> 10) * 42; - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(this); + auto vehicleEntry = Entry(); if (vehicleEntry == nullptr) { return; @@ -6180,8 +6181,9 @@ void vehicle_set_map_toolbar(const Vehicle* vehicle) } } -Vehicle* vehicle_get_head(const Vehicle* vehicle) +Vehicle* Vehicle::TrainHead() const { + const Vehicle* vehicle = this; Vehicle* prevVehicle; for (;;) @@ -6198,8 +6200,9 @@ Vehicle* vehicle_get_head(const Vehicle* vehicle) return const_cast(vehicle); } -Vehicle* vehicle_get_tail(const Vehicle* vehicle) +Vehicle* Vehicle::TrainTail() const { + const Vehicle* vehicle = this; uint16_t spriteIndex; while ((spriteIndex = vehicle->next_vehicle_on_train) != SPRITE_INDEX_NULL) @@ -6283,7 +6286,7 @@ int32_t Vehicle::UpdateMotionDodgems() location.x += Unk9A36C4[oldCollisionDirection + 1].x; location.y += Unk9A36C4[oldCollisionDirection + 1].y; - if (!vehicle_update_dodgems_collision(this, location.x, location.y, &collideSprite)) + if (!DodgemsCarWouldCollideAt(location, &collideSprite)) { Invalidate(); sprite_move(location.x, location.y, location.z, this); @@ -6312,7 +6315,7 @@ int32_t Vehicle::UpdateMotionDodgems() location.x += Unk9A36C4[direction].x; location.y += Unk9A36C4[direction].y; - if (vehicle_update_dodgems_collision(this, location.x, location.y, &collideSprite)) + if (DodgemsCarWouldCollideAt(location, &collideSprite)) break; remaining_distance -= Unk9A36C4[direction].distance; @@ -6393,26 +6396,32 @@ int32_t Vehicle::UpdateMotionDodgems() * * rct2: 0x006DD365 */ -bool vehicle_update_dodgems_collision(Vehicle* vehicle, int16_t x, int16_t y, uint16_t* spriteId) +static bool wouldCollideWithDodgemsTrackEdge( + const CoordsXY& coords, const CoordsXY& trackLocation, uint32_t trackType, uint16_t dodgemsCarRadius) { - uint16_t bp = (vehicle->var_44 * 30) >> 9; - uint32_t trackType = vehicle->track_type >> 2; + int16_t rideLeft = trackLocation.x + DodgemsTrackSize[trackType].left; + int16_t rideRight = trackLocation.x + DodgemsTrackSize[trackType].right; + int16_t rideTop = trackLocation.y + DodgemsTrackSize[trackType].top; + int16_t rideBottom = trackLocation.y + DodgemsTrackSize[trackType].bottom; - int16_t rideLeft = vehicle->TrackLocation.x + DodgemsTrackSize[trackType].left; - int16_t rideRight = vehicle->TrackLocation.x + DodgemsTrackSize[trackType].right; - int16_t rideTop = vehicle->TrackLocation.y + DodgemsTrackSize[trackType].top; - int16_t rideBottom = vehicle->TrackLocation.y + DodgemsTrackSize[trackType].bottom; + return coords.x - dodgemsCarRadius < rideLeft || coords.y - dodgemsCarRadius < rideTop + || coords.x + dodgemsCarRadius > rideRight || coords.y + dodgemsCarRadius > rideBottom; +} - if (x - bp < rideLeft || y - bp < rideTop || x + bp > rideRight || y + bp > rideBottom) +bool Vehicle::DodgemsCarWouldCollideAt(const CoordsXY& coords, uint16_t* collidedWith) const +{ + uint32_t trackType = track_type >> 2; + + if (wouldCollideWithDodgemsTrackEdge(coords, TrackLocation, trackType, (var_44 * 30) >> 9)) { - if (spriteId != nullptr) - *spriteId = SPRITE_INDEX_NULL; + if (collidedWith != nullptr) + *collidedWith = SPRITE_INDEX_NULL; return true; } - auto location = CoordsXY{ x, y }; + auto location = coords; - ride_id_t rideIndex = vehicle->ride; + ride_id_t rideIndex = ride; for (auto xy_offset : SurroundingTiles) { location += xy_offset; @@ -6423,7 +6432,7 @@ bool vehicle_update_dodgems_collision(Vehicle* vehicle, int16_t x, int16_t y, ui Vehicle* vehicle2 = GET_VEHICLE(spriteIdx); spriteIdx = vehicle2->next_in_quadrant; - if (vehicle2 == vehicle) + if (vehicle2 == this) continue; if (vehicle2->sprite_identifier != SPRITE_IDENTIFIER_VEHICLE) @@ -6432,21 +6441,21 @@ bool vehicle_update_dodgems_collision(Vehicle* vehicle, int16_t x, int16_t y, ui if (vehicle2->ride != rideIndex) continue; - int32_t distX = abs(x - vehicle2->x); + int32_t distX = abs(coords.x - vehicle2->x); if (distX > 32768) continue; - int32_t distY = abs(y - vehicle2->y); + int32_t distY = abs(coords.y - vehicle2->y); if (distY > 32768) continue; - int32_t ecx = (vehicle->var_44 + vehicle2->var_44) / 2; + int32_t ecx = (var_44 + vehicle2->var_44) / 2; ecx *= 30; ecx >>= 8; if (std::max(distX, distY) < ecx) { - if (spriteId != nullptr) - *spriteId = vehicle2->sprite_index; + if (collidedWith != nullptr) + *collidedWith = vehicle2->sprite_index; return true; } } @@ -6461,7 +6470,7 @@ bool vehicle_update_dodgems_collision(Vehicle* vehicle, int16_t x, int16_t y, ui */ static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) { - auto vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { return; @@ -6596,7 +6605,7 @@ static void check_and_apply_block_section_stop_site(Vehicle* vehicle) if (ride == nullptr) return; - auto vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) return; @@ -6884,7 +6893,7 @@ static void vehicle_update_swinging_car(Vehicle* vehicle) vehicle->var_4E += dword_F64E08 >> swingAmount; } - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { return; @@ -7068,7 +7077,7 @@ static void vehicle_update_spinning_car(Vehicle* vehicle) return; } - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { return; @@ -7203,7 +7212,7 @@ void Vehicle::UpdateAdditionalAnimation() uint32_t eax; uint32_t* curVar_C8 = reinterpret_cast(&var_C8); - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(this); + auto vehicleEntry = Entry(); if (vehicleEntry == nullptr) { return; @@ -7594,7 +7603,7 @@ static bool vehicle_update_motion_collision_detection( if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_1) return false; - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + auto vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { return false; @@ -7662,11 +7671,11 @@ static bool vehicle_update_motion_collision_detection( if (collideVehicle->ride_subtype == RIDE_TYPE_NULL) continue; - rct_ride_entry_vehicle* collideType = vehicle_get_vehicle_entry(collideVehicle); - if (collideType == nullptr) + auto collideVehicleEntry = collideVehicle->Entry(); + if (collideVehicleEntry == nullptr) continue; - if (!(collideType->flags & VEHICLE_ENTRY_FLAG_BOAT_HIRE_COLLISION_DETECTION)) + if (!(collideVehicleEntry->flags & VEHICLE_ENTRY_FLAG_BOAT_HIRE_COLLISION_DETECTION)) continue; uint32_t x_diff = abs(collideVehicle->x - x); @@ -7691,7 +7700,7 @@ static bool vehicle_update_motion_collision_detection( if (x_diff + y_diff >= ecx) continue; - if (!(collideType->flags & VEHICLE_ENTRY_FLAG_GO_KART)) + if (!(collideVehicleEntry->flags & VEHICLE_ENTRY_FLAG_GO_KART)) { mayCollide = true; break; @@ -7805,7 +7814,7 @@ static void vehicle_reverse_reverser_car(Vehicle* vehicle) */ static void sub_6DBF3E(Vehicle* vehicle) { - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + rct_ride_entry_vehicle* vehicleEntry = vehicle->Entry(); vehicle->acceleration = vehicle->acceleration / _vehicleUnkF64E10; if (vehicle->TrackSubposition == VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK) @@ -8011,7 +8020,7 @@ loc_6DB41D: vehicle->TrackLocation = location; // TODO check if getting the vehicle entry again is necessary - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + rct_ride_entry_vehicle* vehicleEntry = vehicle->Entry(); if (vehicleEntry == nullptr) { return false; @@ -8101,7 +8110,7 @@ loc_6DAEB9: if (track_progress == 80) { vehicle_type ^= 1; - vehicleEntry = vehicle_get_vehicle_entry(this); + vehicleEntry = Entry(); } if (_vehicleVelocityF64E08 >= 0x40000) { @@ -8173,7 +8182,7 @@ loc_6DAEB9: if (track_progress == 32) { vehicle_type = vehicleEntry->log_flume_reverser_vehicle_type; - vehicleEntry = vehicle_get_vehicle_entry(this); + vehicleEntry = Entry(); } } else @@ -8293,7 +8302,7 @@ loc_6DB967: remaining_distance = -1; // Might need to be bp rather than this, but hopefully not - Vehicle* head = vehicle_get_head(GET_VEHICLE(regs.bp)); + auto head = (GET_VEHICLE(regs.bp))->TrainHead(); regs.eax = abs(velocity - head->velocity); if (!(rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES)) @@ -8653,7 +8662,7 @@ static int32_t vehicle_update_track_motion_mini_golf(Vehicle* vehicle, int32_t* return 0; rct_ride_entry* rideEntry = get_ride_entry(vehicle->ride_subtype); - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(vehicle); + rct_ride_entry_vehicle* vehicleEntry = vehicle->Entry(); TileElement* tileElement = nullptr; @@ -8664,7 +8673,7 @@ static int32_t vehicle_update_track_motion_mini_golf(Vehicle* vehicle, int32_t* _vehicleVelocityF64E0C = (vehicle->velocity >> 10) * 42; if (_vehicleVelocityF64E08 < 0) { - vehicle = vehicle_get_tail(vehicle); + vehicle = vehicle->TrainTail(); } _vehicleFrontVehicle = vehicle; @@ -9506,7 +9515,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) return 0; rct_ride_entry* rideEntry = get_ride_entry(ride_subtype); - rct_ride_entry_vehicle* vehicleEntry = vehicle_get_vehicle_entry(this); + auto vehicleEntry = Entry(); if (vehicleEntry == nullptr) { @@ -9530,7 +9539,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) Vehicle* vehicle = this; if (_vehicleVelocityF64E08 < 0) { - vehicle = vehicle_get_tail(vehicle); + vehicle = vehicle->TrainTail(); } // This will be the front vehicle even when traveling // backwards. @@ -9540,7 +9549,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) while (spriteId != SPRITE_INDEX_NULL) { Vehicle* car = GET_VEHICLE(spriteId); - vehicleEntry = vehicle_get_vehicle_entry(car); + vehicleEntry = car->Entry(); if (vehicleEntry == nullptr) { goto loc_6DBF3E; @@ -9643,7 +9652,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) // loc_6DC144 vehicle = gCurrentVehicle; - vehicleEntry = vehicle_get_vehicle_entry(vehicle); + vehicleEntry = vehicle->Entry(); // eax int32_t totalAcceleration = 0; // ebp @@ -9755,14 +9764,14 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) return regs.eax; } -rct_ride_entry_vehicle* vehicle_get_vehicle_entry(const Vehicle* vehicle) +rct_ride_entry_vehicle* Vehicle::Entry() const { - rct_ride_entry* rideEntry = get_ride_entry(vehicle->ride_subtype); + rct_ride_entry* rideEntry = get_ride_entry(ride_subtype); if (rideEntry == nullptr) { return nullptr; } - return &rideEntry->vehicles[vehicle->vehicle_type]; + return &rideEntry->vehicles[vehicle_type]; } int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle) @@ -9795,7 +9804,7 @@ void vehicle_invalidate_window(Vehicle* vehicle) void Vehicle::UpdateCrossings() const { - if (vehicle_get_head(this) != this) + if (TrainHead() != this) { return; } @@ -9808,11 +9817,11 @@ void Vehicle::UpdateCrossings() const if (travellingForwards) { frontVehicle = this; - backVehicle = vehicle_get_tail(this); + backVehicle = TrainTail(); } else { - frontVehicle = vehicle_get_tail(this); + frontVehicle = TrainTail(); backVehicle = this; } diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 22b443ea57..f126d87d43 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -305,7 +305,11 @@ struct Vehicle : SpriteBase void SetState(VEHICLE_STATUS vehicleStatus, uint8_t subState = 0); bool IsGhost() const; void UpdateSoundParams(std::vector& vehicleSoundParamsList) const; + bool DodgemsCarWouldCollideAt(const CoordsXY& coords, uint16_t* spriteId) const; int32_t UpdateTrackMotion(int32_t* outStation); + rct_ride_entry_vehicle* Entry() const; + Vehicle* TrainHead() const; + Vehicle* TrainTail() const; private: bool SoundCanPlay() const; @@ -356,6 +360,7 @@ private: bool CurrentTowerElementIsTop(); bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); + void PeepEasterEggHereWeAre() const; }; struct train_ref @@ -554,17 +559,12 @@ void vehicle_sounds_update(); GForces vehicle_get_g_forces(const Vehicle* vehicle); void vehicle_set_map_toolbar(const Vehicle* vehicle); int32_t vehicle_is_used_in_pairs(const Vehicle* vehicle); -rct_ride_entry_vehicle* vehicle_get_vehicle_entry(const Vehicle* vehicle); int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle); void vehicle_invalidate_window(Vehicle* vehicle); void vehicle_update_test_finish(Vehicle* vehicle); void vehicle_test_reset(Vehicle* vehicle); -void vehicle_peep_easteregg_here_we_are(const Vehicle* vehicle); -Vehicle* vehicle_get_head(const Vehicle* vehicle); -Vehicle* vehicle_get_tail(const Vehicle* vehicle); const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset); uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection); -bool vehicle_update_dodgems_collision(Vehicle* vehicle, int16_t x, int16_t y, uint16_t* spriteId); extern Vehicle* gCurrentVehicle; extern StationIndex _vehicleStationIndex; diff --git a/src/openrct2/ride/VehiclePaint.cpp b/src/openrct2/ride/VehiclePaint.cpp index ac472c8fe5..a3893f709e 100644 --- a/src/openrct2/ride/VehiclePaint.cpp +++ b/src/openrct2/ride/VehiclePaint.cpp @@ -2976,7 +2976,7 @@ static void vehicle_visual_splash1_effect(paint_session* session, int32_t z, con { return; } - if (vehicle_get_head(vehicle)->velocity <= 0x50000) + if (vehicle->TrainHead()->velocity <= 0x50000) { return; }