2019-07-06 00:44:49 +02:00
|
|
|
#pragma once
|
2019-08-06 23:32:19 +02:00
|
|
|
#include "Timer.h"
|
2019-07-06 00:44:49 +02:00
|
|
|
|
|
|
|
class CVehicle;
|
2019-09-11 20:42:34 +02:00
|
|
|
struct CPathNode;
|
2019-07-06 00:44:49 +02:00
|
|
|
|
2020-12-07 00:36:40 +01:00
|
|
|
enum eCarMission
|
2019-07-06 00:44:49 +02:00
|
|
|
{
|
|
|
|
MISSION_NONE,
|
|
|
|
MISSION_CRUISE,
|
|
|
|
MISSION_RAMPLAYER_FARAWAY,
|
|
|
|
MISSION_RAMPLAYER_CLOSE,
|
|
|
|
MISSION_BLOCKPLAYER_FARAWAY,
|
|
|
|
MISSION_BLOCKPLAYER_CLOSE,
|
|
|
|
MISSION_BLOCKPLAYER_HANDBRAKESTOP,
|
|
|
|
MISSION_WAITFORDELETION,
|
|
|
|
MISSION_GOTOCOORDS,
|
|
|
|
MISSION_GOTOCOORDS_STRAIGHT,
|
|
|
|
MISSION_EMERGENCYVEHICLE_STOP,
|
|
|
|
MISSION_STOP_FOREVER,
|
|
|
|
MISSION_GOTOCOORDS_ACCURATE,
|
|
|
|
MISSION_GOTO_COORDS_STRAIGHT_ACCURATE,
|
|
|
|
MISSION_GOTOCOORDS_ASTHECROWSWIMS,
|
|
|
|
MISSION_RAMCAR_FARAWAY,
|
|
|
|
MISSION_RAMCAR_CLOSE,
|
|
|
|
MISSION_BLOCKCAR_FARAWAY,
|
|
|
|
MISSION_BLOCKCAR_CLOSE,
|
|
|
|
MISSION_BLOCKCAR_HANDBRAKESTOP,
|
|
|
|
};
|
|
|
|
|
2020-12-07 00:36:40 +01:00
|
|
|
enum eCarTempAction
|
2019-07-06 00:44:49 +02:00
|
|
|
{
|
|
|
|
TEMPACT_NONE,
|
|
|
|
TEMPACT_WAIT,
|
|
|
|
TEMPACT_REVERSE,
|
|
|
|
TEMPACT_HANDBRAKETURNLEFT,
|
|
|
|
TEMPACT_HANDBRAKETURNRIGHT,
|
|
|
|
TEMPACT_HANDBRAKESTRAIGHT,
|
|
|
|
TEMPACT_TURNLEFT,
|
|
|
|
TEMPACT_TURNRIGHT,
|
|
|
|
TEMPACT_GOFORWARD,
|
|
|
|
TEMPACT_SWERVELEFT,
|
|
|
|
TEMPACT_SWERVERIGHT
|
|
|
|
};
|
|
|
|
|
2020-12-07 00:36:40 +01:00
|
|
|
enum eCarDrivingStyle
|
2019-07-06 00:44:49 +02:00
|
|
|
{
|
|
|
|
DRIVINGSTYLE_STOP_FOR_CARS,
|
|
|
|
DRIVINGSTYLE_SLOW_DOWN_FOR_CARS,
|
|
|
|
DRIVINGSTYLE_AVOID_CARS,
|
|
|
|
DRIVINGSTYLE_PLOUGH_THROUGH,
|
|
|
|
DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS
|
|
|
|
};
|
|
|
|
|
|
|
|
class CAutoPilot {
|
|
|
|
public:
|
2019-09-02 18:04:09 +02:00
|
|
|
int32 m_nCurrentRouteNode;
|
|
|
|
int32 m_nNextRouteNode;
|
|
|
|
int32 m_nPrevRouteNode;
|
2019-08-06 23:32:19 +02:00
|
|
|
uint32 m_nTimeEnteredCurve;
|
2019-08-11 19:11:54 +02:00
|
|
|
uint32 m_nTimeToSpendOnCurrentCurve;
|
2019-07-06 00:44:49 +02:00
|
|
|
uint32 m_nCurrentPathNodeInfo;
|
|
|
|
uint32 m_nNextPathNodeInfo;
|
|
|
|
uint32 m_nPreviousPathNodeInfo;
|
2019-08-11 19:11:54 +02:00
|
|
|
uint32 m_nAntiReverseTimer;
|
2019-10-12 12:42:34 +02:00
|
|
|
uint32 m_nTimeToStartMission;
|
2019-07-06 00:44:49 +02:00
|
|
|
int8 m_nPreviousDirection;
|
2019-08-06 23:32:19 +02:00
|
|
|
int8 m_nCurrentDirection;
|
2019-07-06 00:44:49 +02:00
|
|
|
int8 m_nNextDirection;
|
2019-07-14 13:49:27 +02:00
|
|
|
int8 m_nCurrentLane;
|
2019-08-11 19:11:54 +02:00
|
|
|
int8 m_nNextLane;
|
2020-12-07 00:36:40 +01:00
|
|
|
uint8 m_nDrivingStyle;
|
|
|
|
uint8 m_nCarMission;
|
|
|
|
uint8 m_nTempAction;
|
2019-08-11 19:11:54 +02:00
|
|
|
uint32 m_nTimeTempAction;
|
2019-07-06 00:44:49 +02:00
|
|
|
float m_fMaxTrafficSpeed;
|
|
|
|
uint8 m_nCruiseSpeed;
|
2019-08-25 15:47:22 +02:00
|
|
|
uint8 m_bSlowedDownBecauseOfCars : 1;
|
2019-08-11 19:11:54 +02:00
|
|
|
uint8 m_bSlowedDownBecauseOfPeds : 1;
|
2019-09-02 18:04:09 +02:00
|
|
|
uint8 m_bStayInCurrentLevel : 1;
|
|
|
|
uint8 m_bStayInFastLane : 1;
|
2019-10-06 13:25:13 +02:00
|
|
|
uint8 m_bIgnorePathfinding : 1;
|
2019-07-06 00:44:49 +02:00
|
|
|
CVector m_vecDestinationCoors;
|
2019-09-11 20:42:34 +02:00
|
|
|
CPathNode *m_aPathFindNodesInfo[NUM_PATH_NODES_IN_AUTOPILOT];
|
|
|
|
int16 m_nPathFindNodesCount;
|
2019-07-06 00:44:49 +02:00
|
|
|
CVehicle *m_pTargetCar;
|
2019-07-09 23:49:44 +02:00
|
|
|
|
|
|
|
CAutoPilot(void) {
|
|
|
|
m_nPrevRouteNode = 0;
|
|
|
|
m_nNextRouteNode = m_nPrevRouteNode;
|
|
|
|
m_nCurrentRouteNode = m_nNextRouteNode;
|
2019-08-06 23:32:19 +02:00
|
|
|
m_nTimeEnteredCurve = 0;
|
2019-08-11 19:11:54 +02:00
|
|
|
m_nTimeToSpendOnCurrentCurve = 1000;
|
2019-07-09 23:49:44 +02:00
|
|
|
m_nPreviousPathNodeInfo = 0;
|
|
|
|
m_nNextPathNodeInfo = m_nPreviousPathNodeInfo;
|
|
|
|
m_nCurrentPathNodeInfo = m_nNextPathNodeInfo;
|
|
|
|
m_nNextDirection = 1;
|
2019-08-06 23:32:19 +02:00
|
|
|
m_nCurrentDirection = m_nNextDirection;
|
2019-08-11 19:11:54 +02:00
|
|
|
m_nCurrentLane = m_nNextLane = 0;
|
2019-07-09 23:49:44 +02:00
|
|
|
m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
|
|
|
m_nCarMission = MISSION_NONE;
|
2019-08-11 19:11:54 +02:00
|
|
|
m_nTempAction = TEMPACT_NONE;
|
2019-07-09 23:49:44 +02:00
|
|
|
m_nCruiseSpeed = 10;
|
|
|
|
m_fMaxTrafficSpeed = 10.0f;
|
2019-08-11 19:11:54 +02:00
|
|
|
m_bSlowedDownBecauseOfPeds = false;
|
2019-08-25 15:47:22 +02:00
|
|
|
m_bSlowedDownBecauseOfCars = false;
|
2019-07-09 23:49:44 +02:00
|
|
|
m_nPathFindNodesCount = 0;
|
|
|
|
m_pTargetCar = 0;
|
|
|
|
m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
2019-08-11 19:11:54 +02:00
|
|
|
m_nAntiReverseTimer = m_nTimeToStartMission;
|
2019-09-02 18:04:09 +02:00
|
|
|
m_bStayInFastLane = false;
|
2019-07-09 23:49:44 +02:00
|
|
|
}
|
2019-08-11 19:11:54 +02:00
|
|
|
|
|
|
|
void ModifySpeed(float);
|
2019-09-11 20:42:34 +02:00
|
|
|
void RemoveOnePathNode();
|
2020-05-02 17:02:17 +02:00
|
|
|
#ifdef COMPATIBLE_SAVES
|
|
|
|
void Save(uint8*& buf);
|
|
|
|
void Load(uint8*& buf);
|
|
|
|
#endif
|
|
|
|
|
2019-07-06 00:44:49 +02:00
|
|
|
};
|
2020-05-10 15:54:37 +02:00
|
|
|
|
2020-05-10 17:49:33 +02:00
|
|
|
VALIDATE_SIZE(CAutoPilot, 0x70);
|