@@ -204,6 +204,16 @@ void CVehicleSA::Init()
204204 GetVehicleInterface ()->m_pVehicle = this ;
205205 g_bVehiclePointerInvalid = false ;
206206
207+ CModelInfo* modelInfo = pGame->GetModelInfo (GetModelIndex ());
208+
209+ if (modelInfo != nullptr )
210+ {
211+ for (size_t i = 0 ; i < m_dummyPositions.size (); ++i)
212+ {
213+ m_dummyPositions[i] = modelInfo->GetVehicleDummyPosition ((eVehicleDummies)i);
214+ }
215+ }
216+
207217 // Unlock doors as they spawn randomly with locked doors
208218 LockDoors (false );
209219
@@ -1950,14 +1960,13 @@ void CVehicleSA::SetBikeWheelStatus(BYTE bWheel, BYTE bStatus)
19501960bool CVehicleSA::IsWheelCollided (BYTE eWheelPosition)
19511961{
19521962 auto vehicle = static_cast <CAutomobileSAInterface*>(GetInterface ());
1953- switch (vehicle->m_type )
1963+ switch ((VehicleClass) vehicle->m_vehicleClass )
19541964 {
1955- case 0 :
1965+ case VehicleClass::AUTOMOBILE :
19561966 if (eWheelPosition < 4 )
19571967 return vehicle->m_wheelCollisionState [eWheelPosition] == 4 .f ;
19581968 break ;
1959-
1960- case 9 :
1969+ case VehicleClass::BIKE:
19611970 if (eWheelPosition < 2 )
19621971 return *(float *)((DWORD)vehicle + 0x730 + eWheelPosition * 8 ) == 4 .f || *(float *)((DWORD)vehicle + 0x734 + eWheelPosition * 8 ) == 4 .f ;
19631972 break ;
@@ -2668,6 +2677,63 @@ void CVehicleSA::UpdateLandingGearPosition()
26682677 }
26692678 }
26702679}
2680+
2681+ bool CVehicleSA::GetDummyPosition (eVehicleDummies dummy, CVector& position) const
2682+ {
2683+ if (dummy >= 0 && dummy < VEHICLE_DUMMY_COUNT)
2684+ {
2685+ position = m_dummyPositions[dummy];
2686+ return true ;
2687+ }
2688+
2689+ return false ;
2690+ }
2691+
2692+ bool CVehicleSA::SetDummyPosition (eVehicleDummies dummy, const CVector& position)
2693+ {
2694+ if (dummy < 0 || dummy >= VEHICLE_DUMMY_COUNT)
2695+ return false ;
2696+
2697+ auto vehicle = reinterpret_cast <CVehicleSAInterface*>(m_pInterface);
2698+
2699+ m_dummyPositions[dummy] = position;
2700+
2701+ if (dummy == ENGINE)
2702+ {
2703+ if (vehicle->m_overheatParticle != nullptr )
2704+ CFxSystemSA::SetPosition (vehicle->m_overheatParticle , position);
2705+
2706+ if (vehicle->m_fireParticle != nullptr )
2707+ CFxSystemSA::SetPosition (vehicle->m_fireParticle , position);
2708+ }
2709+
2710+ bool isAutomobileClass = static_cast <VehicleClass>(vehicle->m_vehicleClass ) == VehicleClass::AUTOMOBILE;
2711+
2712+ if (isAutomobileClass)
2713+ {
2714+ SetAutomobileDummyPosition (reinterpret_cast <CAutomobileSAInterface*>(m_pInterface), dummy, position);
2715+ }
2716+
2717+ return true ;
2718+ }
2719+
2720+ //
2721+ // NOTE(botder): Move the code to CAutomobileSA::SetDummyPosition, when we start using CAutomobileSA
2722+ //
2723+ void CVehicleSA::SetAutomobileDummyPosition (CAutomobileSAInterface* automobile, eVehicleDummies dummy, const CVector& position)
2724+ {
2725+ if (dummy == EXHAUST)
2726+ {
2727+ if (automobile->pNitroParticle [0 ] != nullptr )
2728+ CFxSystemSA::SetPosition (automobile->pNitroParticle [0 ], position);
2729+ }
2730+ else if (dummy == EXHAUST_SECONDARY)
2731+ {
2732+ if (automobile->pNitroParticle [1 ] != nullptr )
2733+ CFxSystemSA::SetPosition (automobile->pNitroParticle [1 ], position);
2734+ }
2735+ }
2736+
26712737// Change plate text of existing vehicle
26722738bool CVehicleSA::SetPlateText (const SString& strText)
26732739{
0 commit comments