diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 729481c7b1..9ad4e78773 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#22476] “Time since last inspection” statistic is available in the rides window. - Feature: [#24313] [Plugin] Add API for setting a ride vehicle’s sprite to a smoke plume. +- Improved: [#24345] Vehicle fallback sprites are less likely to glitch with the track. - Improved: [#24362, #24491] The Windows installer is now translated as well. - Improved: [#24364] Improve the fallback vehicle sprites for Zero G Rolls, and allow small ones to be built without cheats if the fallbacks are available. - Improved: [#24368] Clicking the in-game update notication now leads to a more user-friendly download page. diff --git a/src/openrct2/paint/vehicle/VehiclePaint.cpp b/src/openrct2/paint/vehicle/VehiclePaint.cpp index 448b2a5651..6dacace3a9 100644 --- a/src/openrct2/paint/vehicle/VehiclePaint.cpp +++ b/src/openrct2/paint/vehicle/VehiclePaint.cpp @@ -954,12 +954,33 @@ const uint8_t PitchInvertTable[] = { // Opposite Bank values for reversed cars const uint8_t BankInvertTable[] = { 0, 3, 4, 1, 2, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 15, 18, 19, 16, 17 }; +constexpr uint32_t kBoundBoxIndexUndefined = std::numeric_limits::max(); +constexpr uint32_t kBoundBoxIndexFlat = 0; +constexpr uint32_t kBoundBoxIndex25 = 16; +constexpr uint32_t kBoundBoxIndex42 = 32; +constexpr uint32_t kBoundBoxIndex60 = 40; +constexpr uint32_t kBoundBoxIndex75 = 56; +constexpr uint32_t kBoundBoxIndex90 = 60; +constexpr uint32_t kBoundBoxIndex105 = 76; +constexpr uint32_t kBoundBoxIndex120 = 80; +constexpr uint32_t kBoundBoxIndex135 = 84; +constexpr uint32_t kBoundBoxIndex150 = 88; +constexpr uint32_t kBoundBoxIndex165 = 92; +constexpr uint32_t kBoundBoxIndexInverted = 96; // 100-107 unused?? +constexpr uint32_t kBoundBoxIndexFlatBanked45 = 108; +constexpr uint32_t kBoundBoxIndexFlatBanked67 = 124; +constexpr uint32_t kBoundBoxIndexFlatBanked90 = 128; +constexpr uint32_t kBoundBoxIndexFlatBanked112 = 132; +constexpr uint32_t kBoundBoxIndexFlatBanked135 = 136; +constexpr uint32_t kBoundBoxIndexFlatBanked157 = 140; +constexpr uint32_t kBoundBoxIndexCorkscrew = 144; + #pragma endregion #pragma region VehiclePaintUtil static void PaintVehicleRiders( - PaintSession& session, const Vehicle* vehicle, const CarEntry* carEntry, uint32_t baseImageId, int32_t z, + PaintSession& session, const Vehicle* vehicle, const CarEntry* carEntry, uint32_t baseImageId, const int32_t z, const VehicleBoundBox& bb) { baseImageId += carEntry->NumCarImages; @@ -991,7 +1012,7 @@ static void PaintVehicleRiders( // 6D5214 static void vehicle_sprite_paint( - PaintSession& session, const Vehicle* vehicle, int32_t spriteNum, const VehicleBoundBox& bb, int32_t z, + PaintSession& session, const Vehicle* vehicle, int32_t spriteIndex, const VehicleBoundBox& bb, const int32_t z, const CarEntry* carEntry) { if (carEntry->draw_order >= std::size(VehicleBoundboxes)) @@ -999,7 +1020,7 @@ static void vehicle_sprite_paint( return; } - auto baseImageId = static_cast(spriteNum); + auto baseImageId = static_cast(spriteIndex); if (carEntry->flags & CAR_ENTRY_FLAG_SPINNING_ADDITIONAL_FRAMES) { baseImageId += (vehicle->spin_sprite / 8) & 31; @@ -1028,21 +1049,23 @@ static void vehicle_sprite_paint( // 6D520E static void VehicleSpritePaintWithSwinging( - PaintSession& session, const Vehicle* vehicle, int32_t spriteNum, int32_t boundingBoxNum, int32_t z, + PaintSession& session, const Vehicle* vehicle, int32_t spriteIndex, int32_t boundingBoxIndex, const int32_t z, const CarEntry* carEntry) { vehicle_sprite_paint( - session, vehicle, spriteNum + vehicle->SwingSprite, VehicleBoundboxes[carEntry->draw_order][boundingBoxNum], z, + session, vehicle, spriteIndex + vehicle->SwingSprite, VehicleBoundboxes[carEntry->draw_order][boundingBoxIndex], z, carEntry); } static void VehicleSpritePaintRestraints( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { - int32_t boundingBoxNum = YawTo16(imageDirection); + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; auto restraintFrame = ((vehicle->restraints_position - 64) / 64); - auto spriteNum = carEntry->SpriteOffset(SpriteGroupType::RestraintAnimation, imageDirection, restraintFrame); - vehicle_sprite_paint(session, vehicle, spriteNum, VehicleBoundboxes[carEntry->draw_order][boundingBoxNum], z, carEntry); + const auto spriteIndex = carEntry->SpriteOffset(SpriteGroupType::RestraintAnimation, imageDirection, restraintFrame); + vehicle_sprite_paint(session, vehicle, spriteIndex, VehicleBoundboxes[carEntry->draw_order][boundingBoxIndex], z, carEntry); } // Returns the opposite of the bank angle for reversed cars, normal bank angle otherwise @@ -1057,383 +1080,418 @@ static uint8_t GetPaintBankRotation(const Vehicle* vehicle) // 6D51DE static void VehiclePitchFlatUnbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // Restraint animations are only drawn for vehicles that are in a cardinal direction (north, east, south, west) if (vehicle->restraints_position >= 64 && carEntry->GroupEnabled(SpriteGroupType::RestraintAnimation) && (imageDirection & 7) == 0) { - VehicleSpritePaintRestraints(session, vehicle, imageDirection, z, carEntry); + VehicleSpritePaintRestraints(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); return; } - int32_t boundingBoxNum = YawTo16(imageDirection); - auto spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopeFlat, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; + const auto spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopeFlat, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } // 6D4EE7 static void VehiclePitchFlatBankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4F34 static void VehiclePitchFlatBankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlatBanked45; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection) + 108; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4F0C static void VehiclePitchFlatBankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4F5C static void VehiclePitchFlatBankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection) ^ 8) + kBoundBoxIndexFlatBanked45; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked45)) { - int32_t boundingBoxNum = (YawTo16(imageDirection) ^ 8) + 108; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4F84 static void VehiclePitchFlatBankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked67)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked67, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked67, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4FE4 static void VehiclePitchFlatBankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked90)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked90, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked90, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D5055 static void VehiclePitchFlatBankedLeft112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D50C6 static void VehiclePitchFlatBankedLeft135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D5137 static void VehiclePitchFlatBankedLeft157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 4); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 4); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4FB1 static void VehiclePitchFlatBankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked67)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked67, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked67, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D501B static void VehiclePitchFlatBankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::FlatBanked90)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::FlatBanked90, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::FlatBanked90, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D508C static void VehiclePitchFlatBankedRight112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D50FD static void VehiclePitchFlatBankedRight135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D516E static void VehiclePitchFlatBankedRight157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 5); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::InlineTwists, imageDirection, 5); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4EE4 static void VehiclePitchUninvertedFlatBankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D4F31 static void VehiclePitchUninvertedFlatBankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D4F09 static void VehiclePitchUninvertedFlatBankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchFlatBankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D4F59 static void VehiclePitchUninvertedFlatBankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D51D7 static void VehiclePitchFlat( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3DE4: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchFlatBankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchFlatBankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 7: - VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 9: - VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchFlatBankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 12: - VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 14: - VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 15: // what is roll 15? - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 16: - VehiclePitchUninvertedFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUninvertedFlatBankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 17: - VehiclePitchUninvertedFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUninvertedFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 18: - VehiclePitchUninvertedFlatBankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUninvertedFlatBankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 19: - VehiclePitchUninvertedFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUninvertedFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -1446,120 +1504,131 @@ static void VehiclePitchFlat( // 6D4614 static void VehiclePitchUp12Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4662 static void VehiclePitchUp12BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D46DB static void VehiclePitchUp12BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D467D static void VehiclePitchUp12BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D46FD static void VehiclePitchUp12BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D460D static void VehiclePitchUp12( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3C04: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp12BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp12BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 16: - VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 17: - VehiclePitchUp12BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 18: - VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 19: - VehiclePitchUp12BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -1569,309 +1638,343 @@ static void VehiclePitchUp12( // 6D4791 static void VehiclePitchUp25Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4833 static void VehiclePitchUp25BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D48D6 static void VehiclePitchUp25BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + if (boundingBoxIndex == kBoundBoxIndexUndefined) + { + boundingBoxIndex = YawTo16(imageDirection); + if (carEntry->draw_order < 5) + boundingBoxIndex += kBoundBoxIndexFlatBanked45; + else + boundingBoxIndex += kBoundBoxIndex25; + } if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - if (carEntry->draw_order < 5) - boundingBoxNum += 108; - else - boundingBoxNum += 16; - - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4858 static void VehiclePitchUp25BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4910 static void VehiclePitchUp25BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + if (boundingBoxIndex == kBoundBoxIndexUndefined) + { + boundingBoxIndex = YawTo16(imageDirection); + if (carEntry->draw_order < 5) + boundingBoxIndex = (boundingBoxIndex ^ 8) + kBoundBoxIndexFlatBanked45; + else + boundingBoxIndex += kBoundBoxIndex25; + } if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - if (carEntry->draw_order < 5) - boundingBoxNum = (boundingBoxNum ^ 8) + 108; - else - boundingBoxNum += 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked67)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked90)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedLeft112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedLeft135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 4); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 4); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedLeft157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 8); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 8); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked67)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked90)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedRight112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedRight135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 5); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 5); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp25BankedRight157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 9); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 9); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D476C static void VehiclePitchUp25( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3CA4: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchUp25BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchUp25BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchUp25BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchUp25BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 7: - VehiclePitchUp25BankedLeft112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchUp25BankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 9: - VehiclePitchUp25BankedLeft157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchUp25BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchUp25BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 12: - VehiclePitchUp25BankedRight112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchUp25BankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 14: - VehiclePitchUp25BankedRight157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 15: - VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 16: - VehiclePitchUp25BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 17: - VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 18: - VehiclePitchUp25BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 19: - VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -1884,277 +1987,311 @@ static void VehiclePitchUp25( // 6D49DC static void VehiclePitchUp42Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked22)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked45)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked22)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked45)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked67)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked90)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked67)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked90)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedLeft135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + constexpr uint32_t corkscrewFrame = 13; + const int32_t modifiedImageDirection = (imageDirection + 8) % 32; + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined + ? boundingBoxIndex + : YawTo4(modifiedImageDirection) + corkscrewFrame * kNumOrthogonalDirections + kBoundBoxIndexCorkscrew; if (carEntry->GroupEnabled(SpriteGroupType::Corkscrews)) { - imageDirection = (imageDirection + 8) % 32; - int32_t boundingBoxNum = YawTo4(imageDirection) + 13 * 4 + 144; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, 13); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, modifiedImageDirection, corkscrewFrame); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp42BankedRight135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + constexpr uint32_t corkscrewFrame = 3; + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined + ? boundingBoxIndex + : YawTo4(imageDirection) + corkscrewFrame * kNumOrthogonalDirections + kBoundBoxIndexCorkscrew; if (carEntry->GroupEnabled(SpriteGroupType::Corkscrews)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 3 * 4 + 144; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, corkscrewFrame); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D49DC static void VehiclePitchUp42( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchUp42BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp42BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchUp42BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp42BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchUp42BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchUp42BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchUp42BankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchUp42BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchUp42BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchUp42BankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42BankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4A31 static void VehiclePitchUp60Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp60BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60Banked22)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp60BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60Banked22)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp60( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchUp60BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchUp60BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -2166,150 +2303,161 @@ static void VehiclePitchUp60( // 6D463D static void VehiclePitchDown12Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D469B static void VehiclePitchDown12BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4722 static void VehiclePitchDown12BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D46B9 static void VehiclePitchDown12BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4747 static void VehiclePitchDown12BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes12Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes12Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4636 static void VehiclePitchDown12( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3C54: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown12BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown12BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 7: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 9: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 12: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 14: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 15: - VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 16: - VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 17: - VehiclePitchDown12BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 18: - VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 19: - VehiclePitchDown12BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown12BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -2323,310 +2471,343 @@ static void VehiclePitchDown12( // 6D47E4 static void VehiclePitchDown25Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo16(imageDirection)) ^ 8) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25)) { - int32_t boundingBoxNum = ((YawTo16(imageDirection)) ^ 8) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4880 static void VehiclePitchDown25BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo16(imageDirection)) ^ 8) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked22)) { - int32_t boundingBoxNum = ((YawTo16(imageDirection)) ^ 8) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4953 static void VehiclePitchDown25BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + if (boundingBoxIndex == kBoundBoxIndexUndefined) + { + boundingBoxIndex = YawTo16(imageDirection); + if (carEntry->draw_order < 5) + boundingBoxIndex += kBoundBoxIndexFlatBanked45; + else + boundingBoxIndex = (boundingBoxIndex ^ 8) + kBoundBoxIndex25; + } if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - if (carEntry->draw_order < 5) - boundingBoxNum += 108; - else - boundingBoxNum = (boundingBoxNum ^ 8) + 16; - - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D48AB static void VehiclePitchDown25BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo16(imageDirection)) ^ 8) + kBoundBoxIndex25; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked22)) { - int32_t boundingBoxNum = ((YawTo16(imageDirection)) ^ 8) + 16; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4996 static void VehiclePitchDown25BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + if (boundingBoxIndex == kBoundBoxIndexUndefined) + { + boundingBoxIndex = YawTo16(imageDirection); + if (carEntry->draw_order < 5) + boundingBoxIndex = (boundingBoxIndex ^ 8) + kBoundBoxIndexFlatBanked45; + else + boundingBoxIndex = (boundingBoxIndex ^ 8) + kBoundBoxIndex25; + } if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - if (carEntry->draw_order < 5) - boundingBoxNum = (boundingBoxNum ^ 8) + 108; - else - boundingBoxNum = (boundingBoxNum ^ 8) + 16; - - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked67)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked90)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedLeft112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedLeft135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 6); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 6); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedLeft157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo4(imageDirection) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 10); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 10); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked67; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked67)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 124; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked67, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25Banked90)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 128; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25Banked90, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedRight112( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked112; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 132; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedRight135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked135; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 136; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 7); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 7); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown25BankedRight157( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection) ^ 2) + kBoundBoxIndexFlatBanked157; if (carEntry->GroupEnabled(SpriteGroupType::Slopes25InlineTwists)) { - int32_t boundingBoxNum = (YawTo4(imageDirection) ^ 2) + 140; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 11); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes25InlineTwists, imageDirection, 11); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D47DD static void VehiclePitchDown25( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3CF4: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchDown25BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchDown25BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchDown25BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchDown25BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 7: - VehiclePitchDown25BankedLeft112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchDown25BankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 9: - VehiclePitchDown25BankedLeft157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchDown25BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchDown25BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 12: - VehiclePitchDown25BankedRight112(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight112(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchDown25BankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 14: - VehiclePitchDown25BankedRight157(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight157(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 15: - VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 16: - VehiclePitchDown25BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 17: - VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 18: - VehiclePitchDown25BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 19: - VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -2639,276 +2820,310 @@ static void VehiclePitchDown25( // 6D4A05 static void VehiclePitchDown42Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo8(imageDirection)) ^ 4) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42)) { - int32_t boundingBoxNum = ((YawTo8(imageDirection)) ^ 4) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked22)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked45)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked22)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked45)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked67)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked90)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked67)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked67, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo8(imageDirection)) + kBoundBoxIndex42; if (carEntry->GroupEnabled(SpriteGroupType::Slopes42Banked90)) { - int32_t boundingBoxNum = (YawTo8(imageDirection)) + 32; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes42Banked90, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedLeft135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + constexpr uint32_t corkscrewFrame = 8; + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined + ? boundingBoxIndex + : YawTo4(imageDirection) + corkscrewFrame * kNumOrthogonalDirections + kBoundBoxIndexCorkscrew; if (carEntry->GroupEnabled(SpriteGroupType::Corkscrews)) { - int32_t boundingBoxNum = YawTo4(imageDirection) + 8 * 4 + 144; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, 8); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, corkscrewFrame); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42BankedRight135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + constexpr uint32_t corkscrewFrame = 18; + const int32_t modifiedImageDirection = (imageDirection + 8) % 32; + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined + ? boundingBoxIndex + : YawTo4(modifiedImageDirection) + corkscrewFrame * kNumOrthogonalDirections + kBoundBoxIndexCorkscrew; if (carEntry->GroupEnabled(SpriteGroupType::Corkscrews)) { - imageDirection = (imageDirection + 8) % 32; - int32_t boundingBoxNum = YawTo4(imageDirection) + 18 * 4 + 144; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, 18); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, modifiedImageDirection, corkscrewFrame); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown42( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchDown42BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown42BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchDown42BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown42BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchDown42BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchDown42BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 8: - VehiclePitchDown42BankedLeft135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedLeft135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchDown42BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchDown42BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 13: - VehiclePitchDown42BankedRight135(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42BankedRight135(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4A59 static void VehiclePitchDown60Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo16(imageDirection)) ^ 8) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60)) { - int32_t boundingBoxNum = ((YawTo16(imageDirection)) ^ 8) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown60BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60Banked22)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown60BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes60Banked22)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes60Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown60( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchDown60BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchDown60BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -2918,33 +3133,37 @@ static void VehiclePitchDown60( // 6D4A81 static void VehiclePitchUp75( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex75; if (carEntry->GroupEnabled(SpriteGroupType::Slopes75)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 56; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes75, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes75, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4AE8 static void VehiclePitchUp90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes90)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 60; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes90, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes90, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -2954,81 +3173,91 @@ static void VehiclePitchUp90( // 6D4B57 static void VehiclePitchUp105( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex105; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 76; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4BB7 static void VehiclePitchUp120( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex120; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 80; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4C17 static void VehiclePitchUp135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex135; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 84; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 4); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 4); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4C77 static void VehiclePitchUp150( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex150; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 88; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 6); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 6); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4CD7 static void VehiclePitchUp165( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndex165; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 92; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 8); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 8); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3038,17 +3267,19 @@ static void VehiclePitchUp165( // 6D4D37 static void VehiclePitchInverted( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo4(imageDirection)) + kBoundBoxIndexInverted; if (carEntry->GroupEnabled(SpriteGroupType::SlopeInverted)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + 96; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopeInverted, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopeInverted, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3058,7 +3289,8 @@ static void VehiclePitchInverted( // 6D4AA3 static void VehiclePitchDown75( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { @@ -3068,21 +3300,23 @@ static void VehiclePitchDown75( carEntry--; } } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex75; if (carEntry->GroupEnabled(SpriteGroupType::Slopes75)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 56; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes75, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes75, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4B0D static void VehiclePitchDown90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { @@ -3092,15 +3326,16 @@ static void VehiclePitchDown90( carEntry--; } } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo16(imageDirection)) ^ 8) + kBoundBoxIndex90; if (carEntry->GroupEnabled(SpriteGroupType::Slopes90)) { - int32_t boundingBoxNum = ((YawTo16(imageDirection)) ^ 8) + 60; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes90, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes90, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3110,101 +3345,111 @@ static void VehiclePitchDown90( // 6D4B80 static void VehiclePitchDown105( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex105; if (carEntry->GroupEnabled(SpriteGroupType::Slopes90)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 76; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4BE0 static void VehiclePitchDown120( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex120; if (carEntry->GroupEnabled(SpriteGroupType::Slopes90)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 80; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4C40 static void VehiclePitchDown135( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex135; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 84; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 5); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 5); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4CA0 static void VehiclePitchDown150( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex150; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 88; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 7); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 7); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4D00 static void VehiclePitchDown165( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : ((YawTo4(imageDirection)) ^ 2) + kBoundBoxIndex165; if (carEntry->GroupEnabled(SpriteGroupType::SlopesLoop)) { - int32_t boundingBoxNum = ((YawTo4(imageDirection)) ^ 2) + 92; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 9); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::SlopesLoop, imageDirection, 9); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3215,21 +3460,24 @@ static void VehiclePitchDown165( // 6D51A5 template void VehiclePitchCorkscrew( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { if (vehicle->HasFlag(VehicleFlags::CarIsInverted)) { carEntry--; } + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined + ? boundingBoxIndex + : (YawTo4(imageDirection)) + corkscrewFrame * kNumOrthogonalDirections + kBoundBoxIndexCorkscrew; if (carEntry->GroupEnabled(SpriteGroupType::Corkscrews)) { - int32_t boundingBoxNum = (YawTo4(imageDirection)) + corkscrewFrame * 4 + 144; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, corkscrewFrame); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Corkscrews, imageDirection, corkscrewFrame); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatUnbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3241,108 +3489,119 @@ void VehiclePitchCorkscrew( // 6D4D67 static void VehiclePitchUp8Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4DB5 static void VehiclePitchUp8BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4DD3 static void VehiclePitchUp8BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp8BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp8BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4D60 static void VehiclePitchUp8( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3D44: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: case 16: - VehiclePitchUp8BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: case 18: - VehiclePitchUp8BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp8BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp8BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -3353,102 +3612,113 @@ static void VehiclePitchUp8( // 6D4E3A static void VehiclePitchUp16Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp16BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp16BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp16BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp16BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp16BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp16BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp16( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp16Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchUp16BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchUp16BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp16BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp16BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp16Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp16Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -3459,138 +3729,153 @@ static void VehiclePitchUp16( // 6D4E8F static void VehiclePitchUp50Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked45)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked45)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked67)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedLeft45(session, vehicle, (imageDirection + 2) % 32, z, carEntry); + VehiclePitchUp25BankedLeft45(session, vehicle, (imageDirection + 2) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked67)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchUp25BankedRight45(session, vehicle, (imageDirection - 2) % 32, z, carEntry); + VehiclePitchUp25BankedRight45(session, vehicle, (imageDirection - 2) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked90)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchCorkscrew<12>(session, vehicle, (imageDirection + 8) % 32, z, carEntry); + VehiclePitchCorkscrew<12>(session, vehicle, (imageDirection + 8) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked90)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchCorkscrew<2>(session, vehicle, imageDirection, z, carEntry); + VehiclePitchCorkscrew<2>(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchUp50( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchUp50BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchUp50BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchUp50BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchUp50BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchUp50BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchUp50BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchUp50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3604,108 +3889,119 @@ static void VehiclePitchUp50( // 6D4D90 static void VehiclePitchDown8Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4DF4 static void VehiclePitchDown8BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4E15 static void VehiclePitchDown8BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown8BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown8BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes8Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes8Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlatBankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } // 6D4D89 static void VehiclePitchDown8( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { // 0x009A3D94: switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: case 16: - VehiclePitchDown8BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: case 18: - VehiclePitchDown8BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown8BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown8BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchDown8Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown8Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -3716,102 +4012,113 @@ static void VehiclePitchDown8( // 6D4E63 static void VehiclePitchDown16Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown16BankedLeft22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown16BankedRight22( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked22)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked22, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown16BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown16BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown16BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes16Banked45)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes16Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown16BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown16( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown16Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 1: - VehiclePitchDown16BankedLeft22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedLeft22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 3: - VehiclePitchDown16BankedRight22(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedRight22(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown16BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown16BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchDown16Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown16Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; } } @@ -3822,138 +4129,153 @@ static void VehiclePitchDown16( // 6D4EB8 static void VehiclePitchDown50Unbanked( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50, imageDirection, 1); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50, imageDirection, 1); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedLeft45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked45)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedRight45( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked45)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked45, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedLeft67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked67)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedLeft45(session, vehicle, (imageDirection - 2) % 32, z, carEntry); + VehiclePitchDown25BankedLeft45(session, vehicle, (imageDirection - 2) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedRight67( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked67)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked67, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchDown25BankedRight45(session, vehicle, (imageDirection + 2) % 32, z, carEntry); + VehiclePitchDown25BankedRight45(session, vehicle, (imageDirection + 2) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedLeft90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked90)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 2); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 2); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchCorkscrew<7>(session, vehicle, imageDirection, z, carEntry); + VehiclePitchCorkscrew<7>(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50BankedRight90( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : (YawTo16(imageDirection)) + kBoundBoxIndex60; if (carEntry->GroupEnabled(SpriteGroupType::Slopes50Banked90)) { - int32_t boundingBoxNum = (YawTo16(imageDirection)) + 40; - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 3); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::Slopes50Banked90, imageDirection, 3); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchCorkscrew<17>(session, vehicle, (imageDirection + 8) % 32, z, carEntry); + VehiclePitchCorkscrew<17>(session, vehicle, (imageDirection + 8) % 32, z, carEntry, boundingBoxIndex); } } static void VehiclePitchDown50( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { switch (GetPaintBankRotation(vehicle)) { case 0: - VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 2: - VehiclePitchDown50BankedLeft45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedLeft45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 4: - VehiclePitchDown50BankedRight45(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedRight45(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 5: - VehiclePitchDown50BankedLeft67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedLeft67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 6: - VehiclePitchDown50BankedLeft90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedLeft90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 10: - VehiclePitchDown50BankedRight67(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedRight67(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; case 11: - VehiclePitchDown50BankedRight90(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown50BankedRight90(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); break; default: - VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60Unbanked(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -3965,26 +4287,29 @@ static void VehiclePitchDown50( // 6D47DA static void VehiclePitchInvertingDown25( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown25(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D4A02 static void VehiclePitchInvertingDown42( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchDown42(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown42(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } // 6D4A56 static void VehiclePitchInvertingDown60( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { carEntry--; - VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry); + VehiclePitchDown60(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } #pragma endregion @@ -3993,32 +4318,36 @@ static void VehiclePitchInvertingDown60( // 6D4773 static void VehiclePitchSpiralLiftUp( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::CurvedLiftHillUp)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::CurvedLiftHillUp, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::CurvedLiftHillUp, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } static void VehiclePitchSpiralLiftDown( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry) + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, const int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex) { + boundingBoxIndex = boundingBoxIndex != kBoundBoxIndexUndefined ? boundingBoxIndex + : YawTo16(imageDirection) + kBoundBoxIndexFlat; if (carEntry->GroupEnabled(SpriteGroupType::CurvedLiftHillDown)) { - int32_t boundingBoxNum = YawTo16(imageDirection); - int32_t spriteNum = carEntry->SpriteOffset(SpriteGroupType::CurvedLiftHillDown, imageDirection, 0); - VehicleSpritePaintWithSwinging(session, vehicle, spriteNum, boundingBoxNum, z, carEntry); + const int32_t spriteIndex = carEntry->SpriteOffset(SpriteGroupType::CurvedLiftHillDown, imageDirection, 0); + VehicleSpritePaintWithSwinging(session, vehicle, spriteIndex, boundingBoxIndex, z, carEntry); } else { - VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry); + VehiclePitchFlat(session, vehicle, imageDirection, z, carEntry, boundingBoxIndex); } } @@ -4026,7 +4355,8 @@ static void VehiclePitchSpiralLiftDown( // 0x009A3B14: using vehicle_sprite_func = void (*)( - PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry); + PaintSession& session, const Vehicle* vehicle, int32_t imageDirection, int32_t z, const CarEntry* carEntry, + uint32_t boundingBoxIndex); // clang-format off static constexpr vehicle_sprite_func PaintFunctionsByPitch[] = { @@ -4100,7 +4430,7 @@ static constexpr vehicle_sprite_func PaintFunctionsByPitch[] = { * * rct2: 0x006D5600 */ -static void vehicle_visual_splash1_effect(PaintSession& session, int32_t z, const Vehicle* vehicle) +static void vehicle_visual_splash1_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle) { if (vehicle->GetTrackType() != TrackElemType::Watersplash) { @@ -4127,7 +4457,7 @@ static void vehicle_visual_splash1_effect(PaintSession& session, int32_t z, cons * * rct2: 0x006D5696 */ -static void vehicle_visual_splash2_effect(PaintSession& session, int32_t z, const Vehicle* vehicle) +static void vehicle_visual_splash2_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle) { if (vehicle->Orientation & 7) { @@ -4150,7 +4480,7 @@ static void vehicle_visual_splash2_effect(PaintSession& session, int32_t z, cons * * rct2: 0x006D57EE */ -static void vehicle_visual_splash3_effect(PaintSession& session, int32_t z, const Vehicle* vehicle) +static void vehicle_visual_splash3_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle) { if (vehicle->Orientation & 7) { @@ -4173,7 +4503,7 @@ static void vehicle_visual_splash3_effect(PaintSession& session, int32_t z, cons * * rct2: 0x006D5783 */ -static void vehicle_visual_splash4_effect(PaintSession& session, int32_t z, const Vehicle* vehicle) +static void vehicle_visual_splash4_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle) { Vehicle* vehicle2 = GetEntity(vehicle->prev_vehicle_on_ride); if (vehicle2 == nullptr) @@ -4201,7 +4531,7 @@ static void vehicle_visual_splash4_effect(PaintSession& session, int32_t z, cons * * rct2: 0x006D5701 */ -static void vehicle_visual_splash5_effect(PaintSession& session, int32_t z, const Vehicle* vehicle) +static void vehicle_visual_splash5_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle) { Vehicle* vehicle2 = GetEntity(vehicle->prev_vehicle_on_ride); if (vehicle2 == nullptr) @@ -4229,7 +4559,7 @@ static void vehicle_visual_splash5_effect(PaintSession& session, int32_t z, cons PaintAddImageAsChild(session, ImageId(image_id), { 0, 0, z }, { { 0, 0, z }, { 1, 1, 0 } }); } -void VehicleVisualSplashEffect(PaintSession& session, int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) +void VehicleVisualSplashEffect(PaintSession& session, const int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) { switch (carEntry->effect_visual) { @@ -4258,7 +4588,7 @@ void VehicleVisualSplashEffect(PaintSession& session, int32_t z, const Vehicle* * rct2: 0x006D45F8 */ void VehicleVisualDefault( - PaintSession& session, int32_t imageDirection, int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) + PaintSession& session, int32_t imageDirection, const int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) { if (vehicle->Pitch < std::size(PaintFunctionsByPitch)) { @@ -4267,11 +4597,11 @@ void VehicleVisualDefault( auto imagePitch = PitchInvertTable[vehicle->Pitch]; auto imageYaw = (imageDirection + (OpenRCT2::Entity::Yaw::kBaseRotation / 2)) & (OpenRCT2::Entity::Yaw::kBaseRotation - 1); - PaintFunctionsByPitch[imagePitch](session, vehicle, imageYaw, z, carEntry); + PaintFunctionsByPitch[imagePitch](session, vehicle, imageYaw, z, carEntry, kBoundBoxIndexUndefined); } else { - PaintFunctionsByPitch[vehicle->Pitch](session, vehicle, imageDirection, z, carEntry); + PaintFunctionsByPitch[vehicle->Pitch](session, vehicle, imageDirection, z, carEntry, kBoundBoxIndexUndefined); } } }