Merge branch 'carctrl_dev'

This commit is contained in:
Nikolay Korolev 2019-09-14 20:54:56 +03:00
commit 84186e7b0f
11 changed files with 669 additions and 57 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include "PathFind.h"
#include "Boat.h"
#include "Vehicle.h"
class CZoneInfo;
@ -25,7 +26,7 @@ class CCarCtrl
SPECIAL,
BIG,
TAXI,
CLASS7,
TOTAL_CUSTOM_CLASSES,
MAFIA,
TRIAD,
DIABLO,
@ -44,7 +45,6 @@ public:
static int32 ChooseCarModel(int32 vehclass);
static bool JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool);
static void JoinCarWithRoadSystem(CVehicle*);
static void SteerAICarWithPhysics(CVehicle*);
static void UpdateCarOnRails(CVehicle*);
static bool MapCouldMoveInThisArea(float x, float y);
static void ScanForPedDanger(CVehicle *veh);
@ -66,7 +66,6 @@ public:
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);
static void Init(void);
static void SlowCarDownForOtherCar(CEntity*, CVehicle*, float*, float);
static float TestCollisionBetween2MovingRects(CVehicle*, CVehicle*, float, float, CVector*, CVector*, uint8);
static float FindAngleToWeaveThroughTraffic(CVehicle*, CPhysical*, float, float);
@ -84,12 +83,19 @@ public:
static bool PickNextNodeToFollowPath(CVehicle*);
static void PickNextNodeRandomly(CVehicle*);
static uint8 FindPathDirection(int32, int32, int32);
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 void Init(void);
static void ReInit(void);
static float FindSpeedMultiplier(float, float, float, float);
static void SteerAICarWithPhysics(CVehicle*);
static void SteerAICarWithPhysics_OnlyMission(CVehicle*, float*, float*, float*, bool*);
static void SteerAIBoatWithPhysics(CBoat*);
static float FindMaxSteerAngle(CVehicle*);
static void SteerAICarWithPhysicsFollowPath(CVehicle*, float*, float*, float*, bool*);
static void SteerAICarWithPhysicsHeadingForTarget(CVehicle*, CPhysical*, float, float, float*, float*, float*, bool*);
static void SteerAICarWithPhysicsTryingToBlockTarget(CVehicle*, float, float, float, float, float*, float*, float*, bool*);
static void SteerAICarWithPhysicsTryingToBlockTarget_Stop(CVehicle*, float, float, float, float, float*, float*, float*, bool*);
static void SteerAIBoatWithPhysicsHeadingForTarget(CBoat*, float, float, float*, float*, float*);
static bool ThisRoadObjectCouldMove(int16);
static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
{
@ -112,14 +118,17 @@ public:
static int32 &NumRandomCars;
static int32 &NumMissionCars;
static int32 &NumParkedCars;
static int32 &NumPermanentCars;
static bool &bCarsGeneratedAroundCamera;
static float &CarDensityMultiplier;
static int8 &CountDownToCarsAtStart;
static int32 &MaxNumberOfCarsInUse;
static uint32 &LastTimeLawEnforcerCreated;
static int32 (&TotalNumOfCarsOfRating)[7];
static int32 (&NextCarOfRating)[7];
static int32 (&CarArrays)[7][MAX_CAR_MODELS_IN_ARRAY];
static uint32 &LastTimeFireTruckCreated;
static uint32 &LastTimeAmbulanceCreated;
static int32 (&TotalNumOfCarsOfRating)[TOTAL_CUSTOM_CLASSES];
static int32 (&NextCarOfRating)[TOTAL_CUSTOM_CLASSES];
static int32 (&CarArrays)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
};
extern CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP];