summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Vehicle.h
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-07-11 02:48:36 +0200
committerGitHub <noreply@github.com>2019-07-11 02:48:36 +0200
commitaa449b6fe162d8960351c5fe164a9120b8572652 (patch)
treefa82496d356ac2b77ffa1ab00684b0150907f009 /src/vehicles/Vehicle.h
parentfixfixfix (diff)
parentMerge pull request #129 from erorcun/erorcun (diff)
downloadre3-aa449b6fe162d8960351c5fe164a9120b8572652.tar
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.gz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.bz2
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.lz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.xz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.zst
re3-aa449b6fe162d8960351c5fe164a9120b8572652.zip
Diffstat (limited to 'src/vehicles/Vehicle.h')
-rw-r--r--src/vehicles/Vehicle.h107
1 files changed, 87 insertions, 20 deletions
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 39a56fe0..c293b8a6 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -69,6 +69,58 @@ enum eDoors
DOOR_REAR_RIGHT
};
+enum ePanels
+{
+ VEHPANEL_FRONT_LEFT,
+ VEHPANEL_FRONT_RIGHT,
+ VEHPANEL_REAR_LEFT,
+ VEHPANEL_REAR_RIGHT,
+ VEHPANEL_WINDSCREEN,
+ VEHBUMPER_FRONT,
+ VEHBUMPER_REAR,
+};
+
+enum eLights
+{
+ VEHLIGHT_FRONT_LEFT,
+ VEHLIGHT_FRONT_RIGHT,
+ VEHLIGHT_REAR_LEFT,
+ VEHLIGHT_REAR_RIGHT,
+};
+
+enum eWheels
+{
+ VEHWHEEL_FRONT_LEFT,
+ VEHWHEEL_FRONT_RIGHT,
+ VEHWHEEL_REAR_LEFT,
+ VEHWHEEL_REAR_RIGHT,
+};
+
+enum
+{
+ CAR_PIECE_WHEEL_LF = 13,
+ CAR_PIECE_WHEEL_LR,
+ CAR_PIECE_WHEEL_RF,
+ CAR_PIECE_WHEEL_RR,
+};
+
+enum tWheelState
+{
+ WHEEL_STATE_0 = 0,
+ WHEEL_STATE_1 = 1, // constant velocity
+ WHEEL_STATE_2 = 2, // normal
+ WHEEL_STATE_STATIC = 3, // not moving
+};
+
+enum eFlightModel
+{
+ FLIGHT_MODEL_DODO,
+ // not used in III
+ FLIGHT_MODEL_RCPLANE,
+ FLIGHT_MODEL_HELI,
+ FLIGHT_MODEL_SEAPLANE
+};
+
class CVehicle : public CPhysical
{
public:
@@ -88,7 +140,7 @@ public:
int8 m_nGettingOutFlags;
uint8 m_nNumMaxPassengers;
char field_1CD[19];
- CEntity *m_pCurSurface;
+ CEntity *m_pCurGroundEntity;
CFire *m_pCarFire;
float m_fSteerAngle;
float m_fGasPedal;
@@ -115,19 +167,19 @@ public:
uint8 m_veh_flagB80 : 1;
uint8 m_veh_flagC1 : 1;
- uint8 m_veh_flagC2 : 1;
+ uint8 bIsDamaged : 1; // This vehicle has been damaged and is displaying all its components
uint8 m_veh_flagC4 : 1;
uint8 m_veh_flagC8 : 1;
uint8 m_veh_flagC10 : 1;
uint8 m_veh_flagC20 : 1;
- uint8 m_veh_flagC40 : 1;
+ uint8 bCanBeDamaged : 1; // Set to FALSE during cut scenes to avoid explosions
uint8 m_veh_flagC80 : 1;
uint8 m_veh_flagD1 : 1;
uint8 m_veh_flagD2 : 1;
- uint8 m_veh_flagD4 : 1;
- uint8 m_veh_flagD8 : 1;
- uint8 bRecordedForReplay : 1;
+ uint8 bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car?
+ uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
+ uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
uint8 m_veh_flagD20 : 1;
uint8 m_veh_flagD40 : 1;
uint8 m_veh_flagD80 : 1;
@@ -144,7 +196,7 @@ public:
uint32 m_nTimeOfDeath;
int16 field_214;
int16 m_nBombTimer; // goes down with each frame
- CPed *m_pWhoDetonatedMe;
+ CPed *m_pWhoSetMeOnFire;
float field_21C;
float field_220;
eCarLock m_nDoorLock;
@@ -154,11 +206,9 @@ public:
int8 field_22B;
uint8 m_nCarHornTimer;
int8 field_22D;
- uint8 m_nSirenOrAlarm;
+ bool m_bSirenOrAlarm;
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
+ CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car
float m_fSteerRatio;
eVehicleType m_vehType;
@@ -167,9 +217,11 @@ public:
static void operator delete(void*, size_t);
static void operator delete(void*, int);
+ CVehicle(void) {} // FAKE
+ CVehicle(uint8 CreatedBy);
~CVehicle(void);
// from CEntity
- void SetModelIndex(uint32 i);
+ void SetModelIndex(uint32 id);
bool SetupLighting(void);
void RemoveLighting(bool);
void FlagToDestroyWhenNextProcessed(void) {}
@@ -197,6 +249,13 @@ public:
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
+
+ void FlyingControl(eFlightModel flightModel);
+ void ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
+ int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus);
+ void ExtinguishCarFire(void);
+ void ProcessDelayedExplosion(void);
+ float ProcessWheelRotation(tWheelState state, const CVector &fwd, const CVector &speed, float radius);
bool IsLawEnforcementVehicle(void);
void ChangeLawEnforcerState(uint8 enable);
bool UsesSiren(uint32 id);
@@ -225,16 +284,24 @@ 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_pCurGroundEntity) == 0x1E0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
+
+inline uint8 GetVehDoorFlag(int32 carnode) {
+ switch (carnode) {
+ case CAR_DOOR_LF:
+ return 1;
+ case CAR_DOOR_LR:
+ return 2;
+ case CAR_DOOR_RF:
+ return 4;
+ case CAR_DOOR_RR:
+ return 8;
+ default:
+ return 0;
+ }
+}