2019-05-18 10:39:39 +00:00
|
|
|
#pragma once
|
2019-08-11 17:11:54 +00:00
|
|
|
#include "PathFind.h"
|
|
|
|
#include "Vehicle.h"
|
2019-05-18 10:39:39 +00:00
|
|
|
|
2019-08-06 21:32:19 +00:00
|
|
|
class CZoneInfo;
|
2019-05-18 10:39:39 +00:00
|
|
|
|
2019-08-11 17:11:54 +00:00
|
|
|
enum{
|
|
|
|
MAX_CARS_TO_KEEP = 2,
|
|
|
|
MAX_CAR_MODELS_IN_ARRAY = 256,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LANE_WIDTH 5.0f
|
|
|
|
|
2019-05-18 10:39:39 +00:00
|
|
|
class CCarCtrl
|
|
|
|
{
|
2019-08-06 21:32:19 +00:00
|
|
|
enum eCarClass {
|
|
|
|
POOR = 0,
|
|
|
|
RICH,
|
|
|
|
EXEC,
|
|
|
|
WORKER,
|
|
|
|
SPECIAL,
|
|
|
|
BIG,
|
|
|
|
TAXI,
|
|
|
|
CLASS7,
|
|
|
|
MAFIA,
|
|
|
|
TRIAD,
|
|
|
|
DIABLO,
|
|
|
|
YAKUZA,
|
|
|
|
YARDIE,
|
|
|
|
COLOMB,
|
|
|
|
NINES,
|
|
|
|
GANG8,
|
|
|
|
GANG9,
|
|
|
|
COPS
|
|
|
|
};
|
2019-05-18 10:39:39 +00:00
|
|
|
public:
|
|
|
|
static void SwitchVehicleToRealPhysics(CVehicle*);
|
2019-06-28 10:34:02 +00:00
|
|
|
static void AddToCarArray(int32 id, int32 vehclass);
|
2019-06-24 22:42:23 +00:00
|
|
|
static void UpdateCarCount(CVehicle*, bool);
|
2019-06-28 10:34:02 +00:00
|
|
|
static int32 ChooseCarModel(int32 vehclass);
|
2019-07-14 11:49:27 +00:00
|
|
|
static bool JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool);
|
|
|
|
static void JoinCarWithRoadSystem(CVehicle*);
|
2019-07-17 11:19:20 +00:00
|
|
|
static void SteerAICarWithPhysics(CVehicle*);
|
|
|
|
static void UpdateCarOnRails(CVehicle*);
|
2019-07-17 21:58:06 +00:00
|
|
|
static bool MapCouldMoveInThisArea(float x, float y);
|
2019-07-18 13:41:09 +00:00
|
|
|
static void ScanForPedDanger(CVehicle *veh);
|
2019-07-25 20:34:29 +00:00
|
|
|
static void RemoveFromInterestingVehicleList(CVehicle*);
|
2019-08-06 21:32:19 +00:00
|
|
|
static void GenerateRandomCars(void);
|
|
|
|
static void GenerateOneRandomCar(void);
|
|
|
|
static void GenerateEmergencyServicesCar(void);
|
|
|
|
static int32 ChooseModel(CZoneInfo*, CVector*, int*);
|
|
|
|
static int32 ChoosePoliceCarModel(void);
|
2019-08-10 07:44:19 +00:00
|
|
|
static int32 ChooseGangCarModel(int32 gang);
|
2019-08-11 17:11:54 +00:00
|
|
|
static void RemoveDistantCars(void);
|
|
|
|
static void PossiblyRemoveVehicle(CVehicle*);
|
|
|
|
static bool IsThisVehicleInteresting(CVehicle*);
|
|
|
|
static int32 CountCarsOfType(int32 mi);
|
|
|
|
static void SlowCarOnRailsDownForTrafficAndLights(CVehicle*);
|
|
|
|
static void PickNextNodeAccordingStrategy(CVehicle*);
|
|
|
|
static void DragCarToPoint(CVehicle*, CVector*);
|
|
|
|
static float FindMaximumSpeedForThisCarInTraffic(CVehicle*);
|
|
|
|
static void SlowCarDownForCarsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float);
|
|
|
|
static void SlowCarDownForPedsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float);
|
2019-08-15 14:51:39 +00:00
|
|
|
static void Init(void);
|
2019-08-11 17:11:54 +00:00
|
|
|
|
|
|
|
static float GetOffsetOfLaneFromCenterOfRoad(int8 lane, CCarPathLink* pLink)
|
|
|
|
{
|
|
|
|
return (lane + ((pLink->numLeftLanes == 0) ? (0.5f - 0.5f * pLink->numRightLanes) :
|
|
|
|
((pLink->numRightLanes == 0) ? (0.5f - 0.5f * pLink->numLeftLanes) : 0.5f))) * LANE_WIDTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
|
|
|
|
{
|
|
|
|
uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve;
|
|
|
|
return (float)timeInCurve / pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve;
|
|
|
|
}
|
2019-06-24 14:57:54 +00:00
|
|
|
|
|
|
|
static int32 &NumLawEnforcerCars;
|
2019-06-30 10:59:55 +00:00
|
|
|
static int32 &NumAmbulancesOnDuty;
|
|
|
|
static int32 &NumFiretrucksOnDuty;
|
2019-07-25 20:34:29 +00:00
|
|
|
static int32 &NumRandomCars;
|
|
|
|
static int32 &NumMissionCars;
|
|
|
|
static int32 &NumParkedCars;
|
2019-06-29 09:09:33 +00:00
|
|
|
static bool &bCarsGeneratedAroundCamera;
|
2019-07-03 22:16:24 +00:00
|
|
|
static float &CarDensityMultiplier;
|
2019-08-06 21:32:19 +00:00
|
|
|
static int8 &CountDownToCarsAtStart;
|
|
|
|
static int32 &MaxNumberOfCarsInUse;
|
|
|
|
static uint32 &LastTimeLawEnforcerCreated;
|
2019-08-10 07:44:19 +00:00
|
|
|
static int32 (&TotalNumOfCarsOfRating)[7];
|
|
|
|
static int32 (&NextCarOfRating)[7];
|
2019-08-11 17:11:54 +00:00
|
|
|
static int32 (&CarArrays)[7][MAX_CAR_MODELS_IN_ARRAY];
|
2019-05-18 10:39:39 +00:00
|
|
|
};
|
2019-08-11 17:11:54 +00:00
|
|
|
|
|
|
|
extern CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP];
|