|
|
@ -24,11 +24,7 @@
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
|
|
|
|
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifndef MIAMI
|
|
|
|
|
|
|
|
return 30.0f;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
return pVehicle->AutoPilot.m_nSwitchDistance;
|
|
|
|
return pVehicle->AutoPilot.m_nSwitchDistance;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
@ -45,7 +41,6 @@ float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle)
|
|
|
|
return FindSwitchDistanceFarNormalVehicle(pVehicle);
|
|
|
|
return FindSwitchDistanceFarNormalVehicle(pVehicle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
|
|
|
|
void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -59,7 +54,6 @@ void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
@ -148,24 +142,9 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
pVehicle->m_nCarHornTimer = 0;
|
|
|
|
pVehicle->m_nCarHornTimer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
|
|
|
|
|
|
|
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){
|
|
|
|
|
|
|
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
|
|
|
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
|
|
|
|
if (CCullZones::NoPolice())
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (pVehicle->bIsLawEnforcer)
|
|
|
|
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MISSION_BLOCKPLAYER_FARAWAY:
|
|
|
|
case MISSION_BLOCKPLAYER_FARAWAY:
|
|
|
|
if (FindSwitchDistanceClose(pVehicle) > (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() ||
|
|
|
|
if (FindSwitchDistanceClose(pVehicle) > (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() ||
|
|
|
@ -174,19 +153,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()))
|
|
|
|
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()))
|
|
|
|
pVehicle->m_bSirenOrAlarm = true;
|
|
|
|
pVehicle->m_bSirenOrAlarm = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifndef MIAMI
|
|
|
|
|
|
|
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
|
|
|
|
|
|
|
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
|
|
|
|
|
|
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
|
|
|
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
|
|
|
|
if (CCullZones::NoPolice())
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MISSION_BLOCKPLAYER_CLOSE:
|
|
|
|
case MISSION_BLOCKPLAYER_CLOSE:
|
|
|
|
if (FindSwitchDistanceFar(pVehicle) >= (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() ||
|
|
|
|
if (FindSwitchDistanceFar(pVehicle) >= (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() ||
|
|
|
@ -216,30 +183,12 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
pVehicle->m_nCarHornTimer = 0;
|
|
|
|
pVehicle->m_nCarHornTimer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
|
|
|
|
|
|
|
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
|
|
|
|
|
|
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
|
|
|
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
|
|
|
|
if (CCullZones::NoPolice())
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
|
|
|
|
MellowOutChaseSpeed(pVehicle);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MISSION_GOTOCOORDS:
|
|
|
|
case MISSION_GOTOCOORDS:
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if ((pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D() < FindSwitchDistanceClose(pVehicle) ||
|
|
|
|
if ((pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D() < FindSwitchDistanceClose(pVehicle) ||
|
|
|
|
#else
|
|
|
|
|
|
|
|
if ((pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D() < DISTANCE_TO_SWITCH_DISTANCE_GOTO ||
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_bIgnorePathfinding)
|
|
|
|
pVehicle->AutoPilot.m_bIgnorePathfinding)
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -251,12 +200,10 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
if (distance < 5.0f){
|
|
|
|
if (distance < 5.0f){
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bParking) {
|
|
|
|
if (pVehicle->bParking) {
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
pVehicle->bParking = false;
|
|
|
|
pVehicle->bParking = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (distance > FindSwitchDistanceFarNormalVehicle(pVehicle) && !pVehicle->AutoPilot.m_bIgnorePathfinding && (CTimer::GetFrameCounter() & 7) == 0){
|
|
|
|
else if (distance > FindSwitchDistanceFarNormalVehicle(pVehicle) && !pVehicle->AutoPilot.m_bIgnorePathfinding && (CTimer::GetFrameCounter() & 7) == 0){
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
@ -313,12 +260,10 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
if (distance < 1.0f) {
|
|
|
|
if (distance < 1.0f) {
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bParking) {
|
|
|
|
if (pVehicle->bParking) {
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
pVehicle->bParking = false;
|
|
|
|
pVehicle->bParking = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (distance > FindSwitchDistanceFarNormalVehicle(pVehicle) && !pVehicle->AutoPilot.m_bIgnorePathfinding && (CTimer::GetFrameCounter() & 7) == 0) {
|
|
|
|
else if (distance > FindSwitchDistanceFarNormalVehicle(pVehicle) && !pVehicle->AutoPilot.m_bIgnorePathfinding && (CTimer::GetFrameCounter() & 7) == 0) {
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
@ -338,30 +283,10 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MISSION_RAMCAR_CLOSE:
|
|
|
|
case MISSION_RAMCAR_CLOSE:
|
|
|
|
if (pVehicle->AutoPilot.m_pTargetCar){
|
|
|
|
if (pVehicle->AutoPilot.m_pTargetCar){
|
|
|
|
#ifndef MIAMI
|
|
|
|
|
|
|
|
if
|
|
|
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
|
|
|
|
(FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
(FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
|
|
|
|
|
|
|
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
|
|
|
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
|
|
|
|
|
|
|
pVehicle->m_bSirenOrAlarm = false;
|
|
|
|
|
|
|
|
if (CCullZones::NoPolice())
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifdef FIX_BUGS // btw fixed in SA
|
|
|
|
#ifdef FIX_BUGS // btw fixed in SA
|
|
|
|
if (FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar)
|
|
|
|
if (FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((pVehicle->AutoPilot.m_pTargetCar->GetPosition() - pVehicle->GetPosition()).Magnitude2D() <= FindSwitchDistanceFar(pVehicle) ||
|
|
|
|
if ((pVehicle->AutoPilot.m_pTargetCar->GetPosition() - pVehicle->GetPosition()).Magnitude2D() <= FindSwitchDistanceFar(pVehicle) ||
|
|
|
|
pVehicle->AutoPilot.m_bIgnorePathfinding){
|
|
|
|
pVehicle->AutoPilot.m_bIgnorePathfinding){
|
|
|
|
if (pVehicle->GetHasCollidedWith(pVehicle->AutoPilot.m_pTargetCar)){
|
|
|
|
if (pVehicle->GetHasCollidedWith(pVehicle->AutoPilot.m_pTargetCar)){
|
|
|
@ -403,7 +328,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
case MISSION_ATTACKPLAYER:
|
|
|
|
case MISSION_ATTACKPLAYER:
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
if (pVehicle->bIsLawEnforcer)
|
|
|
|
MellowOutChaseSpeedBoat(pVehicle);
|
|
|
|
MellowOutChaseSpeedBoat(pVehicle);
|
|
|
@ -438,7 +362,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_CLOSE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_CLOSE;
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
BackToCruisingIfNoWantedLevel(pVehicle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){
|
|
|
|
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){
|
|
|
|
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
|
|
|
|
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
|
|
|
@ -446,10 +369,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
|
|
|
|
pVehicle->SetStatus(STATUS_PHYSICS);
|
|
|
|
pVehicle->SetStatus(STATUS_PHYSICS);
|
|
|
|
pVehicle->AutoPilot.m_nCarMission =
|
|
|
|
pVehicle->AutoPilot.m_nCarMission =
|
|
|
|
#ifdef MIAMI
|
|
|
|
pVehicle->GetVehicleAppearance() == VEHICLE_BOAT ? FindPoliceBoatMissionForWantedLevel() : FindPoliceCarMissionForWantedLevel();
|
|
|
|
pVehicle->GetVehicleAppearance() == VEHICLE_BOAT ? FindPoliceBoatMissionForWantedLevel() :
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
FindPoliceCarMissionForWantedLevel();
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
|
|
|
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
|
|
|
|
}else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){
|
|
|
|
}else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){
|
|
|
@ -470,13 +390,11 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel >= 1 && CCullZones::PoliceAbandonCars()) {
|
|
|
|
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel >= 1 && CCullZones::PoliceAbandonCars()) {
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
TellOccupantsToLeaveCar(pVehicle);
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
float flatSpeed = pVehicle->GetMoveSpeed().MagnitudeSqr2D();
|
|
|
|
float flatSpeed = pVehicle->GetMoveSpeed().MagnitudeSqr2D();
|
|
|
|
if (flatSpeed > SQR(0.018f)){
|
|
|
|
if (flatSpeed > SQR(0.018f)){
|
|
|
|
pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
|
|
|
pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
|
|
@ -485,16 +403,12 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
if (pVehicle->GetStatus() == STATUS_PHYSICS && pVehicle->AutoPilot.m_nTempAction == TEMPACT_NONE){
|
|
|
|
if (pVehicle->GetStatus() == STATUS_PHYSICS && pVehicle->AutoPilot.m_nTempAction == TEMPACT_NONE){
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission != MISSION_NONE){
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission != MISSION_NONE){
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission != MISSION_STOP_FOREVER &&
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission != MISSION_STOP_FOREVER &&
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCarMission != MISSION_BLOCKPLAYER_HANDBRAKESTOP &&
|
|
|
|
pVehicle->AutoPilot.m_nCarMission != MISSION_BLOCKPLAYER_HANDBRAKESTOP &&
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed != 0 &&
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed != 0 &&
|
|
|
|
(pVehicle->VehicleCreatedBy != RANDOM_VEHICLE || pVehicle->AutoPilot.m_nCarMission != MISSION_CRUISE)){
|
|
|
|
(pVehicle->VehicleCreatedBy != RANDOM_VEHICLE || pVehicle->AutoPilot.m_nCarMission != MISSION_CRUISE)){
|
|
|
|
if (pVehicle->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_STOP_FOR_CARS
|
|
|
|
if (pVehicle->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_STOP_FOR_CARS
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
&& pVehicle->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS ||
|
|
|
|
&& pVehicle->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS ||
|
|
|
|
pVehicle->VehicleCreatedBy == MISSION_VEHICLE
|
|
|
|
pVehicle->VehicleCreatedBy == MISSION_VEHICLE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
if (CTimer::GetTimeInMilliseconds() - pVehicle->m_nLastTimeCollided > 500)
|
|
|
|
if (CTimer::GetTimeInMilliseconds() - pVehicle->m_nLastTimeCollided > 500)
|
|
|
|
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
|
|
|
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
|
|
@ -526,7 +440,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 400;
|
|
|
|
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 400;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (pVehicle->bIsLawEnforcer) {
|
|
|
|
if (pVehicle->bIsLawEnforcer) {
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY ||
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY ||
|
|
|
|
pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) {
|
|
|
|
pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) {
|
|
|
@ -534,7 +447,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FARAWAY;
|
|
|
|
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FARAWAY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pVehicle->GetUp().z < 0.7f){
|
|
|
|
if (pVehicle->GetUp().z < 0.7f){
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
|
|
|
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
|
|
|
|
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
|
|
|
|
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
|
|
|
@ -574,7 +486,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
if ((uint8)(pVehicle->m_randomSeed ^ CGeneral::GetRandomNumber()) == 0xAD)
|
|
|
|
if ((uint8)(pVehicle->m_randomSeed ^ CGeneral::GetRandomNumber()) == 0xAD)
|
|
|
|
pVehicle->m_nCarHornTimer = 45;
|
|
|
|
pVehicle->m_nCarHornTimer = 45;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
float target = 1.0f;
|
|
|
|
float target = 1.0f;
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE)
|
|
|
|
if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE)
|
|
|
|
target = CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(pVehicle->AutoPilot.m_nCruiseSpeedMultiplierType);
|
|
|
|
target = CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(pVehicle->AutoPilot.m_nCruiseSpeedMultiplierType);
|
|
|
@ -603,7 +514,6 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
@ -630,7 +540,6 @@ float CCarAI::GetCarToGoToCoors(CVehicle* pVehicle, CVector* pTarget)
|
|
|
|
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
|
|
|
|
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
float CCarAI::GetCarToParkAtCoors(CVehicle* pVehicle, CVector* pTarget)
|
|
|
|
float CCarAI::GetCarToParkAtCoors(CVehicle* pVehicle, CVector* pTarget)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -639,7 +548,6 @@ float CCarAI::GetCarToParkAtCoors(CVehicle* pVehicle, CVector* pTarget)
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 10;
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 10;
|
|
|
|
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
|
|
|
|
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: TODO: MI_VICECHEE
|
|
|
|
//--MIAMI: TODO: MI_VICECHEE
|
|
|
|
void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
|
|
|
void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
|
|
@ -661,7 +569,6 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
|
|
|
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1)
|
|
|
|
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1)
|
|
|
|
pVehicle->SetupPassenger(0);
|
|
|
|
pVehicle->SetupPassenger(0);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
case MI_PREDATOR:
|
|
|
|
case MI_PREDATOR:
|
|
|
|
pVehicle->SetUpDriver();
|
|
|
|
pVehicle->SetUpDriver();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -677,7 +584,6 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -708,18 +614,13 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
|
|
|
|
int timer = 100;
|
|
|
|
int timer = 100;
|
|
|
|
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
|
|
|
|
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
|
|
|
|
if (pVehicle->pPassengers[i]) {
|
|
|
|
if (pVehicle->pPassengers[i]) {
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
pVehicle->pPassengers[i]->m_leaveCarTimer = timer;
|
|
|
|
pVehicle->pPassengers[i]->m_leaveCarTimer = timer;
|
|
|
|
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
|
|
|
|
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
|
|
|
|
timer += CGeneral::GetRandomNumberInRange(200, 400);
|
|
|
|
timer += CGeneral::GetRandomNumberInRange(200, 400);
|
|
|
|
#else
|
|
|
|
|
|
|
|
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
|
|
|
|
void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -737,7 +638,6 @@ void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::TellCarToRamOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
|
|
|
void CCarAI::TellCarToRamOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
|
|
@ -774,7 +674,6 @@ eCarMission CCarAI::FindPoliceCarMissionForWantedLevel()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel()
|
|
|
|
eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -789,7 +688,6 @@ eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel()
|
|
|
|
default: return MISSION_BLOCKPLAYER_FARAWAY;
|
|
|
|
default: return MISSION_BLOCKPLAYER_FARAWAY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
|
|
|
|
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
|
|
|
@ -845,15 +743,12 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 34;
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = 34;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (!FindPlayerVehicle() && FindPlayerPed()->GetMoveSpeed().Magnitude() < 0.07f) {
|
|
|
|
if (!FindPlayerVehicle() && FindPlayerPed()->GetMoveSpeed().Magnitude() < 0.07f) {
|
|
|
|
if ((FindPlayerCoors() - pVehicle->GetPosition()).Magnitude() < 30.0f)
|
|
|
|
if ((FindPlayerCoors() - pVehicle->GetPosition()).Magnitude() < 30.0f)
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = Min(10, pVehicle->AutoPilot.m_nCruiseSpeed);
|
|
|
|
pVehicle->AutoPilot.m_nCruiseSpeed = Min(10, pVehicle->AutoPilot.m_nCruiseSpeed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
|
|
|
|
void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -867,7 +762,6 @@ void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
|
|
|
|
case 6: pVehicle->AutoPilot.m_nCruiseSpeed = 40; break;
|
|
|
|
case 6: pVehicle->AutoPilot.m_nCruiseSpeed = 40; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--MIAMI: done
|
|
|
|
//--MIAMI: done
|
|
|
|
void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
|
|
|
|
void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
|
|
|
@ -892,10 +786,8 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
if (vehicle == pVehicle)
|
|
|
|
if (vehicle == pVehicle)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
#ifdef MIAMI
|
|
|
|
|
|
|
|
if (vehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
|
|
|
if (vehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (Abs(pVehicle->GetPosition().z - vehicle->GetPosition().z) >= 5.0f)
|
|
|
|
if (Abs(pVehicle->GetPosition().z - vehicle->GetPosition().z) >= 5.0f)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
CVector2D distance = vehicle->GetPosition() - pVehicle->GetPosition();
|
|
|
|
CVector2D distance = vehicle->GetPosition() - pVehicle->GetPosition();
|
|
|
|