summaryrefslogtreecommitdiffstats
path: root/src/entities/Vehicle.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-05 14:34:41 +0200
committerGitHub <noreply@github.com>2019-07-05 14:34:41 +0200
commit9d13ab28a8a625a60a38729129c8d2c8e02e7b8f (patch)
tree86d117096a709da2f395c3c6145fc1f7791e3140 /src/entities/Vehicle.h
parentMore AudioManager (diff)
parentimplemented some CVehicle functions (diff)
downloadre3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.gz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.bz2
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.lz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.xz
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.tar.zst
re3-9d13ab28a8a625a60a38729129c8d2c8e02e7b8f.zip
Diffstat (limited to 'src/entities/Vehicle.h')
-rw-r--r--src/entities/Vehicle.h249
1 files changed, 158 insertions, 91 deletions
diff --git a/src/entities/Vehicle.h b/src/entities/Vehicle.h
index 8739e5db..b69c828f 100644
--- a/src/entities/Vehicle.h
+++ b/src/entities/Vehicle.h
@@ -7,13 +7,21 @@ class CFire;
struct tHandlingData;
enum {
+ RANDOM_VEHICLE = 1,
+ MISSION_VEHICLE = 2,
+ PARKED_VEHICLE = 3,
+ PERMANENT_VEHICLE = 4,
+};
+
+
+enum {
GETTING_IN_OUT_FL = 1,
GETTING_IN_OUT_RL = 2,
GETTING_IN_OUT_FR = 4,
GETTING_IN_OUT_RR = 8
};
-enum eCarLock : uint8 {
+enum eCarLock {
CARLOCK_NOT_USED,
CARLOCK_UNLOCKED,
CARLOCK_LOCKED,
@@ -24,78 +32,82 @@ enum eCarLock : uint8 {
CARLOCK_SKIP_SHUT_DOORS
};
-enum eVehicleModel : int32
+// TODO: where is this used? Is Vehicle.h the right file?
+enum eVehicleModel
{
- LANDSTAL = 0x0,
- IDAHO = 0x1,
- STINGER = 0x2,
- LINERUN = 0x3,
- PEREN = 0x4,
- SENTINEL = 0x5,
- PATRIOT = 0x6,
- FIRETRUK = 0x7,
- TRASH = 0x8,
- STRETCH = 0x9,
- MANANA = 0xA,
- INFERNUS = 0xB,
- BLISTA = 0xC,
- PONY = 0xD,
- MULE = 0xE,
- CHEETAH = 0xF,
- AMBULAN = 0x10,
- FBICAR = 0x11,
- MOONBEAM = 0x12,
- ESPERANT = 0x13,
- TAXI = 0x14,
- KURUMA = 0x15,
- BOBCAT = 0x16,
- MRWHOOP = 0x17,
- BFINJECT = 0x18,
- CORPSE = 0x19,
- POLICE = 0x1A,
- ENFORCER = 0x1B,
- SECURICA = 0x1C,
- BANSHEE = 0x1D,
- PREDATOR = 0x1E,
- BUS = 0x1F,
- RHINO = 0x20,
- BARRACKS = 0x21,
- TRAIN = 0x22,
- CHOPPER = 0x23,
- DODO = 0x24,
- COACH = 0x25,
- CABBIE = 0x26,
- STALLION = 0x27,
- RUMPO = 0x28,
- RCBANDIT = 0x29,
- BELLYUP = 0x2A,
- MRWONGS = 0x2B,
- MAFIA = 0x2C,
- YARDIE = 0x2D,
- YAKUZA = 0x2E,
- DIABLOS = 0x2F,
- COLUMB = 0x30,
- HOODS = 0x31,
- AIRTRAIN = 0x32,
- DEADDODO = 0x33,
- SPEEDER = 0x34,
- REEFER = 0x35,
- PANLANT = 0x36,
- FLATBED = 0x37,
- YANKEE = 0x38,
- ESCAPE = 0x39,
- BORGNINE = 0x3A,
- TOYZ = 0x3B,
- GHOST = 0x3C,
- CAR151 = 0x3D,
- CAR152 = 0x3E,
- CAR153 = 0x3F,
- CAR154 = 0x40,
- CAR155 = 0x41,
- CAR156 = 0x42,
- CAR157 = 0x43,
- CAR158 = 0x44,
- CAR159 = 0x45,
+ LANDSTAL,
+ IDAHO,
+ STINGER,
+ LINERUN,
+ PEREN,
+ SENTINEL,
+ PATRIOT,
+ FIRETRUK,
+ TRASH,
+ STRETCH,
+ MANANA,
+ INFERNUS,
+ BLISTA,
+ PONY,
+ MULE,
+ CHEETAH,
+ AMBULAN,
+ FBICAR,
+ MOONBEAM,
+ ESPERANT,
+ TAXI,
+ KURUMA,
+ BOBCAT,
+ MRWHOOP,
+ BFINJECT,
+ CORPSE,
+ POLICE,
+ ENFORCER,
+ SECURICA,
+ BANSHEE,
+ PREDATOR,
+ BUS,
+ RHINO,
+ BARRACKS,
+ TRAIN,
+ CHOPPER,
+ DODO,
+ COACH,
+ CABBIE,
+ STALLION,
+ RUMPO,
+ RCBANDIT,
+ BELLYUP,
+ MRWONGS,
+ MAFIA,
+ YARDIE,
+ YAKUZA,
+ DIABLOS,
+ COLUMB,
+ HOODS,
+ AIRTRAIN,
+ DEADDODO,
+ SPEEDER,
+ REEFER,
+ PANLANT,
+ FLATBED,
+ YANKEE,
+ ESCAPE,
+ BORGNINE,
+ TOYZ,
+ GHOST,
+ CAR151,
+ CAR152,
+ CAR153,
+ CAR154,
+ CAR155,
+ CAR156,
+ CAR157,
+ CAR158,
+ CAR159,
+};
+
+enum eDoors {
};
class CVehicle : public CPhysical
@@ -103,10 +115,13 @@ class CVehicle : public CPhysical
public:
// 0x128
tHandlingData *m_handling;
+
+ // CAutoPilot
uint8 stuff1[112];
+
uint8 m_currentColour1;
uint8 m_currentColour2;
- uint8 m_anExtras[2];
+ uint8 m_aExtras[2];
int16 m_nAlarmState; // m_nWantedStarsOnEnter on DK22
int16 m_nMissionValue;
CPed *pDriver;
@@ -122,23 +137,27 @@ public:
float m_fSteerAngle;
float m_fGasPedal;
float m_fBreakPedal;
- uint8 m_nCreatedBy; // eVehicleCreatedBy
- uint8 bIsLawEnforcer : 1;
- uint8 bIsAmbulanceOnDuty : 1;
- uint8 bIsFiretruckOnDuty : 1;
- uint8 m_veh_flagA8 : 1;
- uint8 m_veh_flagA10 : 1;
- uint8 m_veh_flagA20 : 1;
- uint8 m_veh_flagA40 : 1;
- uint8 m_veh_flagA80 : 1;
- uint8 bIsVan : 1;
- uint8 bIsBus : 1;
- uint8 bIsBig : 1;
- uint8 bIsLow : 1;
+ uint8 VehicleCreatedBy;
+
+ // cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CVehicle.h from R*
+ uint8 bIsLawEnforcer: 1; // Is this guy chasing the player at the moment
+ uint8 bIsAmbulanceOnDuty: 1; // Ambulance trying to get to an accident
+ uint8 bIsFireTruckOnDuty: 1; // Firetruck trying to get to a fire
+ uint8 bIsLocked: 1; // Is this guy locked by the script (cannot be removed)
+ uint8 bEngineOn: 1; // For sound purposes. Parked cars have their engines switched off (so do destroyed cars)
+ uint8 bIsHandbrakeOn: 1; // How's the handbrake doing ?
+ uint8 bLightsOn: 1; // Are the lights switched on ?
+ uint8 bFreebies: 1; // Any freebies left in this vehicle ?
+
+ uint8 bIsVan: 1; // Is this vehicle a van (doors at back of vehicle)
+ uint8 bIsBus: 1; // Is this vehicle a bus
+ uint8 bIsBig: 1; // Is this vehicle a bus
+ uint8 bLowVehicle: 1; // Need this for sporty type cars to use low getting-in/out anims
uint8 m_veh_flagB10 : 1;
uint8 m_veh_flagB20 : 1;
uint8 m_veh_flagB40 : 1;
uint8 m_veh_flagB80 : 1;
+
uint8 m_veh_flagC1 : 1;
uint8 m_veh_flagC2 : 1;
uint8 m_veh_flagC4 : 1;
@@ -147,6 +166,7 @@ public:
uint8 m_veh_flagC20 : 1;
uint8 m_veh_flagC40 : 1;
uint8 m_veh_flagC80 : 1;
+
uint8 m_veh_flagD1 : 1;
uint8 m_veh_flagD2 : 1;
uint8 m_veh_flagD4 : 1;
@@ -155,8 +175,9 @@ public:
uint8 m_veh_flagD20 : 1;
uint8 m_veh_flagD40 : 1;
uint8 m_veh_flagD80 : 1;
+
int8 field_1F9;
- uint8 m_nAmmoInClip[1]; // Used to make the guns on boat do a reload (20 by default)
+ uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 field_1FB;
int8 field_1FC[4];
float m_fHealth; // 1000.0f = full health. 0 -> explode
@@ -179,6 +200,7 @@ public:
int8 field_22D;
uint8 m_nSirenOrAlarm;
int8 field_22F;
+ // TODO: this is an array
CStoredCollPoly m_frontCollPoly; // poly which is under front part of car
CStoredCollPoly m_rearCollPoly; // poly which is under rear part of car
float m_fSteerRatio;
@@ -190,8 +212,29 @@ public:
static void operator delete(void*, int);
~CVehicle(void);
+ // from CEntity
+ void SetModelIndex(uint32 i);
+ bool SetupLighting(void);
+ void RemoveLighting(bool);
+ void FlagToDestroyWhenNextProcessed(void) {}
- void dtor(void) { this->CVehicle::~CVehicle(); }
+ virtual void ProcessControlInputs(uint8) {}
+ virtual void GetComponentWorldPosition(int32 component, CVector &pos) {}
+ virtual bool IsComponentPresent(int32 component) { return false; }
+ virtual void SetComponentRotation(int32 component, CVector rotation) {}
+ virtual void OpenDoor(int32, eDoors door, float) {}
+ virtual void ProcessOpenDoor(uint32, uint32, float) {}
+ virtual bool IsDoorReady(eDoors door) { return false; }
+ virtual bool IsDoorFullyOpen(eDoors door) { return false; }
+ virtual bool IsDoorClosed(eDoors door) { return false; }
+ virtual bool IsDoorMissing(eDoors door) { return false; }
+ virtual void RemoveRefsToVehicle(CEntity *ent) {}
+ virtual void BlowUpCar(CEntity *ent) {}
+ virtual bool SetUpWheelColModel(CColModel *colModel) { return false; }
+ virtual void BurstTyre(uint8 tyre) {}
+ virtual bool IsRoomForPedToLeaveCar(uint32, CVector *) { return false;}
+ virtual float GetHeightAboveRoad(void);
+ virtual void PlayCarHorn(void) {}
bool IsCar(void) { return m_vehType == VEHICLE_TYPE_CAR; }
bool IsBoat(void) { return m_vehType == VEHICLE_TYPE_BOAT; }
@@ -199,10 +242,26 @@ public:
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
bool IsLawEnforcementVehicle(void);
- void ChangeLawEnforcerState(bool enable);
- void RemovePassenger(CPed *);
- void RemoveDriver(void);
+ void ChangeLawEnforcerState(uint8 enable);
+ bool UsesSiren(uint32 id);
+ bool IsVehicleNormal(void);
+ bool CarHasRoof(void);
bool IsUpsideDown(void);
+ bool IsOnItsSide(void);
+ bool CanBeDeleted(void);
+ bool CanPedOpenLocks(CPed *ped);
+ bool CanPedEnterCar(void);
+ bool CanPedExitCar(void);
+ // do these two actually return something?
+ CPed *SetUpDriver(void);
+ CPed *SetupPassenger(int n);
+ void SetDriver(CPed *driver);
+ bool AddPassenger(CPed *passenger);
+ bool AddPassenger(CPed *passenger, uint8 n);
+ void RemovePassenger(CPed *passenger);
+ void RemoveDriver(void);
+ void ProcessCarAlarm(void);
+ bool IsSphereTouchingVehicle(float sx, float sy, float sz, float radius);
static bool &bWheelsOnlyCheat;
static bool &bAllDodosCheat;
@@ -210,8 +269,16 @@ public:
static bool &bCheat4;
static bool &bCheat5;
static bool &m_bDisableMouseSteering;
+
+
+ void dtor(void) { CVehicle::~CVehicle(); }
+ void SetModelIndex_(uint32 id) { CVehicle::SetModelIndex(id); }
+ bool SetupLighting_(void) { return CVehicle::SetupLighting(); }
+ void RemoveLighting_(bool reset) { CVehicle::RemoveLighting(reset); }
+ float GetHeightAboveRoad_(void) { return CVehicle::GetHeightAboveRoad(); }
};
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
+static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");