summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-06-08 00:59:43 +0300
committereray orçunus <erayorcunus@gmail.com>2020-06-08 00:59:43 +0300
commita77b181e32e64604868cb90dd0346b8da7bf2fd6 (patch)
tree63f9a7ea70e28eedce723590faf330c460bb9f1c /src
parente07b6fdce73884de93dbefd7056b3a04d2f4898c (diff)
CarCtrl fixes
Diffstat (limited to 'src')
-rw-r--r--src/control/CarCtrl.cpp14
-rw-r--r--src/control/Script.cpp2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index ae57e030..59f49a41 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -1127,7 +1127,7 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
}
}
pVehicle->bWarnedPeds = true;
- if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS)
+ if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS || pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS)
return maxSpeed;
return (maxSpeed + pVehicle->AutoPilot.GetCruiseSpeed()) / 2;
}
@@ -1226,13 +1226,13 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
if (pVehicle->GetModelIndex() == MI_RCBANDIT){
if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit)
pPed->SetEvasiveStep(pVehicle, 0);
- }else if (dotVelocity > 0.3f){
- if (sideLength - 0.5f < sidewaysDistance)
+ }else if (dotVelocity > 0.3f) {
+ if (sideLength + 0.1f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0);
else
pPed->SetEvasiveDive(pVehicle, 0);
- }else{
- if (sideLength + 0.1f < sidewaysDistance)
+ }else if (dotVelocity > 0.1f) {
+ if (sideLength - 0.5f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0);
else
pPed->SetEvasiveDive(pVehicle, 0);
@@ -1261,7 +1261,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
CPlayerPed* pPlayerPed = (CPlayerPed*)pPed;
if (pPlayerPed->IsPlayer() && dotDirection < frontSafe &&
pPlayerPed->IsPedInControl() &&
- pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking &&
+ pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking &&
CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) {
pPlayerPed->AnnoyPlayerPed(false);
pPlayerPed->SetLookFlag(pVehicle, true);
@@ -2751,10 +2751,12 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
if (PickNextNodeAccordingStrategy(pVehicle)) {
switch (pVehicle->AutoPilot.m_nCarMission){
case MISSION_GOTOCOORDS:
+ pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return;
case MISSION_GOTOCOORDS_ACCURATE:
+ pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 5a1da380..4d784e4a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -2268,7 +2268,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->SetStatus(STATUS_PHYSICS);
car->bEngineOn = true;
- car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
+ car->AutoPilot.m_nCruiseSpeed = Max(1, car->AutoPilot.m_nCruiseSpeed);
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
}