From 2ae112fdf6b90bb4435dba34bcc2a23604e1e158 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 8 Jul 2019 21:37:47 +0200 Subject: more CAutomobile --- src/vehicles/Vehicle.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/vehicles/Vehicle.h') diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 1e70d171..e974eb88 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -88,6 +88,14 @@ enum eLights VEHLIGHT_REAR_RIGHT, }; +enum eWheels +{ + VEHWHEEL_FRONT_LEFT, + VEHWHEEL_FRONT_RIGHT, + VEHWHEEL_REAR_LEFT, + VEHWHEEL_REAR_RIGHT, +}; + enum { CAR_PIECE_WHEEL_LF = 13, @@ -142,7 +150,7 @@ public: uint8 m_veh_flagB80 : 1; uint8 m_veh_flagC1 : 1; - uint8 m_veh_flagC2 : 1; // bIsDamaged + uint8 bIsDamaged : 1; uint8 m_veh_flagC4 : 1; uint8 m_veh_flagC8 : 1; uint8 m_veh_flagC10 : 1; -- cgit v1.2.3 From 74fcbc8c0a6bbac8e8057655c5f1133e15c63656 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 9 Jul 2019 09:57:44 +0200 Subject: more CAutomobile --- src/vehicles/Vehicle.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/vehicles/Vehicle.h') diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index e974eb88..5aa0a770 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -123,7 +123,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; @@ -160,9 +160,9 @@ public: 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; + uint8 bIsCarParkVehicle : 1; + uint8 bHasAlreadyBeenRecorded : 1; uint8 m_veh_flagD20 : 1; uint8 m_veh_flagD40 : 1; uint8 m_veh_flagD80 : 1; @@ -263,7 +263,7 @@ public: }; 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"); -- cgit v1.2.3 From a65dd41da736a12866526abc1405cbaa154771a8 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 9 Jul 2019 18:50:35 +0200 Subject: yet more CAutomobile --- src/vehicles/Vehicle.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/vehicles/Vehicle.h') diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 5aa0a770..cd877da5 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -150,19 +150,19 @@ public: uint8 m_veh_flagB80 : 1; uint8 m_veh_flagC1 : 1; - uint8 bIsDamaged : 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 bVehicleColProcessed : 1; - uint8 bIsCarParkVehicle : 1; - uint8 bHasAlreadyBeenRecorded : 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; @@ -189,7 +189,7 @@ 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 -- cgit v1.2.3 From 702cd0076506dad26abc3c5239a2cfddfa7deb00 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 9 Jul 2019 23:49:44 +0200 Subject: more CVehicle --- src/vehicles/Vehicle.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/vehicles/Vehicle.h') diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index cd877da5..76ea76cb 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -104,6 +104,21 @@ enum CAR_PIECE_WHEEL_RR, }; +enum tWheelState +{ + WHEEL_STATE_1 = 1, // constant velocity + WHEEL_STATE_3 = 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: @@ -179,7 +194,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; @@ -191,9 +206,7 @@ public: int8 field_22D; 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; @@ -202,6 +215,8 @@ 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 id); @@ -232,6 +247,11 @@ 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 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); -- cgit v1.2.3 From 1aeb34f547e0be994b7c5979e68049b6d9f35d9d Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 10 Jul 2019 11:05:49 +0200 Subject: CVehicle::ProcessWheel --- src/vehicles/Vehicle.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/vehicles/Vehicle.h') diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 76ea76cb..c293b8a6 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -106,8 +106,10 @@ enum enum tWheelState { + WHEEL_STATE_0 = 0, WHEEL_STATE_1 = 1, // constant velocity - WHEEL_STATE_3 = 3, // not moving + WHEEL_STATE_2 = 2, // normal + WHEEL_STATE_STATIC = 3, // not moving }; enum eFlightModel @@ -249,6 +251,8 @@ public: 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); -- cgit v1.2.3