mirror of
https://github.com/GTAmodding/re3.git
synced 2025-07-17 19:24:09 +00:00
Merge remote-tracking branch 'origin/miami' into miami
# Conflicts: # src/core/config.h
This commit is contained in:
commit
dab6d6dd6d
78 changed files with 3941 additions and 126 deletions
|
@ -81,6 +81,9 @@
|
|||
#define OFFSCREEN_DESPAWN_RANGE (40.0f)
|
||||
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
bool CCarCtrl::bMadDriversCheat;
|
||||
int CCarCtrl::NumLawEnforcerCars;
|
||||
int CCarCtrl::NumAmbulancesOnDuty;
|
||||
int CCarCtrl::NumFiretrucksOnDuty;
|
||||
|
@ -664,7 +667,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
nMadDrivers = 6;
|
||||
break;
|
||||
}
|
||||
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers /* TODO(MIAMI): || mad drivers cheat */) {
|
||||
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) {
|
||||
pVehicle->SetStatus(STATUS_PHYSICS);
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed += 10;
|
||||
|
@ -2519,7 +2522,7 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
|
|||
SteerAIBoatWithPhysicsAttackingPlayer(pVehicle, pSwerve, pAccel, pBrake, pHandbrake);
|
||||
return;
|
||||
case MISSION_PLANE_FLYTOCOORS:
|
||||
//SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle);
|
||||
SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle);
|
||||
return;
|
||||
case MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1:
|
||||
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil,
|
||||
|
@ -2741,6 +2744,51 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
|
|||
pHeli->GetMatrix().GetUp() = up;
|
||||
}
|
||||
|
||||
void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
|
||||
{
|
||||
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
|
||||
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
|
||||
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
|
||||
float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y);
|
||||
while (angle > TWOPI)
|
||||
angle -= TWOPI;
|
||||
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
|
||||
float steer = difference > 0.0f ? 0.04f : -0.04f;
|
||||
if (Abs(difference) < 0.2f)
|
||||
steer *= 5.0f * Abs(difference);
|
||||
pPlane->m_fPlaneSteer *= Pow(0.96, CTimer::GetTimeStep());
|
||||
float steerChange = steer - pPlane->m_fPlaneSteer;
|
||||
float maxChange = 0.003f * CTimer::GetTimeStep();
|
||||
if (Abs(steerChange) < maxChange)
|
||||
pPlane->m_fPlaneSteer = steer;
|
||||
else if (steerChange < 0.0f)
|
||||
pPlane->m_fPlaneSteer -= maxChange;
|
||||
else
|
||||
pPlane->m_fPlaneSteer += maxChange;
|
||||
pPlane->m_fOrientation += pPlane->m_fPlaneSteer * CTimer::GetTimeStep();
|
||||
CVector up(0.0f, 0.0f, 1.0f);
|
||||
up.Normalise();
|
||||
CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ);
|
||||
forward.Normalise();
|
||||
CVector right = CrossProduct(forward, up);
|
||||
right.z -= 5.0f * pPlane->m_fPlaneSteer;
|
||||
right.Normalise();
|
||||
up = CrossProduct(forward, right);
|
||||
up.Normalise();
|
||||
right = CrossProduct(forward, up);
|
||||
pPlane->GetMatrix().GetRight() = right;
|
||||
pPlane->GetMatrix().GetForward() = forward;
|
||||
pPlane->GetMatrix().GetUp() = up;
|
||||
float newSplit = 1.0f - Pow(0.95, CTimer::GetTimeStep());
|
||||
float oldSplit = 1.0f - newSplit;
|
||||
#ifdef FIX_BUGS
|
||||
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.GetCruiseSpeed() * 0.01f * forward * newSplit;
|
||||
#else
|
||||
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.m_nCruiseSpeed * 0.01f * forward * newSplit;
|
||||
#endif
|
||||
pPlane->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake)
|
||||
{
|
||||
CVector2D forward = pVehicle->GetForward();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue