Merge pull request #512 from Nick007J/master

MIAMI CAutoPilot + CCarAI + multiple fixes
This commit is contained in:
Sergeanur
2020-05-05 17:14:13 +03:00
committed by GitHub
15 changed files with 402 additions and 31 deletions

View File

@ -197,8 +197,6 @@ public:
static void SetAllTaxiLights(bool set);
};
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
inline uint8 GetCarDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_LF:

View File

@ -72,8 +72,6 @@ public:
};
static_assert(sizeof(CBoat) == 0x484, "CBoat: error");
extern float MAX_WAKE_LENGTH;
extern float MIN_WAKE_INTERVAL;
extern float WAKE_LIFETIME;

View File

@ -95,4 +95,3 @@ public:
static void ActivateHeli(bool activate);
};
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");

View File

@ -63,7 +63,6 @@ public:
static bool HasCesnaBeenDestroyed(void);
static bool HasDropOffCesnaBeenShotDown(void);
};
static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");
extern float LandingPoint;
extern float TakeOffPoint;

View File

@ -91,4 +91,3 @@ public:
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail);
static void UpdateTrains(void);
};
static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");

View File

@ -98,7 +98,10 @@ CVehicle::CVehicle(uint8 CreatedBy)
bHasAlreadyBeenRecorded = false;
m_bSirenOrAlarm = 0;
m_nCarHornTimer = 0;
field_22D = 0;
m_nCarHornPattern = 0;
#ifdef MIAMI
bParking = false;
#endif
m_nAlarmState = 0;
m_nDoorLock = CARLOCK_UNLOCKED;
m_nLastWeaponDamage = -1;
@ -118,6 +121,9 @@ CVehicle::CVehicle(uint8 CreatedBy)
AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
AutoPilot.m_bStayInCurrentLevel = false;
AutoPilot.m_bIgnorePathfinding = false;
#ifdef MIAMI
AutoPilot.m_nSwitchDistance = 20;
#endif
}
CVehicle::~CVehicle()
@ -1347,3 +1353,23 @@ CVehicle::Load(uint8*& buf)
SkipSaveBuf(buf, 99);
}
#endif
#ifdef MIAMI
eVehicleAppearance
//--MIAMI: TODO, implement VC version, appearance != type
// This would work for cars, boats and bikes but not for planes and helis
CVehicle::GetVehicleAppearance(void)
{
if (IsCar())
return VEHICLE_CAR;
if (IsBoat())
return VEHICLE_BOAT;
if (IsBike())
return VEHICLE_BIKE;
if (IsPlane())
return VEHICLE_PLANE;
if (IsHeli())
return VEHICLE_HELI;
return VEHICLE_NONE;
}
#endif

View File

@ -109,6 +109,18 @@ enum eFlightModel
FLIGHT_MODEL_SEAPLANE
};
#ifdef MIAMI
enum eVehicleAppearance
{
VEHICLE_NONE,
VEHICLE_CAR,
VEHICLE_BIKE,
VEHICLE_HELI,
VEHICLE_BOAT,
VEHICLE_PLANE,
};
#endif
// Or Weapon.h?
void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage);
@ -172,6 +184,10 @@ public:
uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
#ifdef MIAMI
uint8 bParking : 1;
#endif;
int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 m_nPacManPickupsCarried;
@ -193,7 +209,7 @@ public:
uint8 m_bRainAudioCounter;
uint8 m_bRainSamplesCounter;
uint8 m_nCarHornTimer;
uint8 field_22D; // last horn?
uint8 m_nCarHornPattern; // last horn?
bool m_bSirenOrAlarm;
int8 m_comedyControlState;
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car
@ -236,6 +252,9 @@ public:
virtual void Load(uint8*& buf);
#endif
#ifdef MIAMI
eVehicleAppearance GetVehicleAppearance(void);
#endif
bool IsCar(void) { return m_vehType == VEHICLE_TYPE_CAR; }
bool IsBoat(void) { return m_vehType == VEHICLE_TYPE_BOAT; }
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
@ -274,6 +293,7 @@ public:
void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage);
void DoFixedMachineGuns(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; }
@ -290,9 +310,4 @@ public:
static bool m_bDisableMouseSteering;
};
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
static_assert(offsetof(CVehicle, m_pCurGroundEntity) == 0x1E0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);