2019-05-19 19:28:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Vehicle.h"
|
2019-07-07 16:36:55 +00:00
|
|
|
#include "DamageManager.h"
|
|
|
|
#include "Door.h"
|
2019-07-06 17:44:00 +00:00
|
|
|
|
2019-07-08 19:37:47 +00:00
|
|
|
class CObject;
|
|
|
|
|
2019-07-29 17:18:03 +00:00
|
|
|
enum eCarNodes
|
|
|
|
{
|
|
|
|
CAR_WHEEL_RF = 1,
|
|
|
|
CAR_WHEEL_RM,
|
|
|
|
CAR_WHEEL_RB,
|
|
|
|
CAR_WHEEL_LF,
|
|
|
|
CAR_WHEEL_LM,
|
|
|
|
CAR_WHEEL_LB,
|
|
|
|
CAR_BUMP_FRONT,
|
|
|
|
CAR_BUMP_REAR,
|
|
|
|
CAR_WING_RF,
|
|
|
|
CAR_WING_RR,
|
|
|
|
CAR_DOOR_RF,
|
|
|
|
CAR_DOOR_RR,
|
|
|
|
CAR_WING_LF,
|
|
|
|
CAR_WING_LR,
|
|
|
|
CAR_DOOR_LF,
|
|
|
|
CAR_DOOR_LR,
|
|
|
|
CAR_BONNET,
|
|
|
|
CAR_BOOT,
|
|
|
|
CAR_WINDSCREEN,
|
|
|
|
NUM_CAR_NODES,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum eCarPositions
|
|
|
|
{
|
|
|
|
CAR_POS_HEADLIGHTS,
|
|
|
|
CAR_POS_TAILLIGHTS,
|
|
|
|
CAR_POS_FRONTSEAT,
|
|
|
|
CAR_POS_BACKSEAT,
|
|
|
|
CAR_POS_EXHAUST = 9,
|
|
|
|
};
|
|
|
|
|
2019-07-17 21:58:06 +00:00
|
|
|
// These are used for all the wheel arrays
|
|
|
|
// DON'T confuse with VEHWHEEL, which are vehicle components
|
|
|
|
enum {
|
|
|
|
CARWHEEL_FRONT_LEFT,
|
|
|
|
CARWHEEL_REAR_LEFT,
|
|
|
|
CARWHEEL_FRONT_RIGHT,
|
|
|
|
CARWHEEL_REAR_RIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum eBombType
|
|
|
|
{
|
|
|
|
CARBOMB_NONE,
|
|
|
|
CARBOMB_TIMED,
|
|
|
|
CARBOMB_ONIGNITION,
|
|
|
|
CARBOMB_REMOTE,
|
|
|
|
CARBOMB_TIMEDACTIVE,
|
|
|
|
CARBOMB_ONIGNITIONACTIVE,
|
|
|
|
};
|
2019-07-16 17:48:50 +00:00
|
|
|
|
2019-08-10 15:15:22 +00:00
|
|
|
enum {
|
|
|
|
CAR_DOOR_FLAG_UNKNOWN = 0x0,
|
|
|
|
CAR_DOOR_FLAG_LF = 0x1,
|
|
|
|
CAR_DOOR_FLAG_LR = 0x2,
|
|
|
|
CAR_DOOR_FLAG_RF = 0x4,
|
|
|
|
CAR_DOOR_FLAG_RR = 0x8
|
|
|
|
};
|
|
|
|
|
2019-05-19 19:28:10 +00:00
|
|
|
class CAutomobile : public CVehicle
|
|
|
|
{
|
|
|
|
public:
|
2019-06-02 15:13:56 +00:00
|
|
|
// 0x288
|
2019-07-06 17:44:00 +00:00
|
|
|
CDamageManager Damage;
|
|
|
|
CDoor Doors[6];
|
|
|
|
RwFrame *m_aCarNodes[NUM_CAR_NODES];
|
|
|
|
CColPoint m_aWheelColPoints[4];
|
2019-07-07 11:09:11 +00:00
|
|
|
float m_aSuspensionSpringRatio[4];
|
|
|
|
float m_aSuspensionSpringRatioPrev[4];
|
2019-07-17 21:58:06 +00:00
|
|
|
float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented
|
2019-07-08 06:46:42 +00:00
|
|
|
float field_49C;
|
2019-07-06 17:44:00 +00:00
|
|
|
bool m_aWheelSkidmarkMuddy[4];
|
|
|
|
bool m_aWheelSkidmarkBloody[4];
|
|
|
|
float m_aWheelRotation[4];
|
|
|
|
float m_aWheelPosition[4];
|
|
|
|
float m_aWheelSpeed[4];
|
2019-07-08 06:46:42 +00:00
|
|
|
uint8 field_4D8;
|
2019-07-16 17:48:50 +00:00
|
|
|
uint8 m_bombType : 3;
|
2019-07-08 06:46:42 +00:00
|
|
|
uint8 bTaxiLight : 1;
|
2020-05-24 13:14:56 +00:00
|
|
|
uint8 bDriverLastFrame : 1; // for bombs
|
2019-10-27 09:51:09 +00:00
|
|
|
uint8 bFixedColour : 1;
|
|
|
|
uint8 bBigWheels : 1;
|
2019-07-24 21:06:48 +00:00
|
|
|
uint8 bWaterTight : 1; // no damage for non-player peds
|
2019-07-18 19:41:20 +00:00
|
|
|
uint8 bNotDamagedUpsideDown : 1;
|
|
|
|
uint8 bMoreResistantToDamage : 1;
|
2019-07-19 11:58:19 +00:00
|
|
|
CEntity *m_pBombRigger;
|
2019-07-19 09:57:12 +00:00
|
|
|
int16 field_4E0;
|
2019-07-26 12:27:13 +00:00
|
|
|
uint16 m_hydraulicState;
|
2019-07-06 17:44:00 +00:00
|
|
|
uint32 m_nBusDoorTimerEnd;
|
|
|
|
uint32 m_nBusDoorTimerStart;
|
2019-07-07 11:09:11 +00:00
|
|
|
float m_aSuspensionSpringLength[4];
|
2019-07-06 17:44:00 +00:00
|
|
|
float m_aSuspensionLineLength[4];
|
|
|
|
float m_fHeightAboveRoad;
|
2019-07-17 21:58:06 +00:00
|
|
|
float m_fTraction;
|
2019-07-16 15:03:37 +00:00
|
|
|
float m_fVelocityChangeForAudio;
|
2019-07-19 09:57:12 +00:00
|
|
|
float m_randomValues[6]; // used for what?
|
2019-07-18 13:41:09 +00:00
|
|
|
float m_fFireBlowUpTimer;
|
2019-07-06 17:44:00 +00:00
|
|
|
CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
|
|
|
|
CVector m_aGroundOffset[4]; // from ground object to colpoint
|
2019-07-16 17:48:50 +00:00
|
|
|
CEntity *m_pSetOnFireEntity;
|
2019-07-23 14:39:30 +00:00
|
|
|
float m_weaponDoorTimerLeft; // still don't know what exactly this is
|
|
|
|
float m_weaponDoorTimerRight;
|
2019-06-24 22:42:23 +00:00
|
|
|
float m_fCarGunLR;
|
2019-07-06 17:44:00 +00:00
|
|
|
float m_fCarGunUD;
|
2019-07-27 09:53:51 +00:00
|
|
|
float m_fPropellerRotation;
|
2019-07-06 17:44:00 +00:00
|
|
|
uint8 stuff4[4];
|
|
|
|
uint8 m_nWheelsOnGround;
|
2019-07-17 21:58:06 +00:00
|
|
|
uint8 m_nDriveWheelsOnGround;
|
|
|
|
uint8 m_nDriveWheelsOnGroundPrev;
|
2019-10-12 14:06:15 +00:00
|
|
|
float m_fGasPedalAudio;
|
2019-07-17 21:58:06 +00:00
|
|
|
tWheelState m_aWheelState[4];
|
2019-06-24 22:42:23 +00:00
|
|
|
|
2020-04-16 12:30:47 +00:00
|
|
|
static bool m_sAllTaxiLights;
|
2019-07-08 06:46:42 +00:00
|
|
|
|
2019-07-29 17:18:03 +00:00
|
|
|
CAutomobile(int32 id, uint8 CreatedBy);
|
2019-07-08 06:46:42 +00:00
|
|
|
|
|
|
|
// from CEntity
|
|
|
|
void SetModelIndex(uint32 id);
|
|
|
|
void ProcessControl(void);
|
|
|
|
void Teleport(CVector v);
|
|
|
|
void PreRender(void);
|
|
|
|
void Render(void);
|
|
|
|
|
2019-07-09 07:57:44 +00:00
|
|
|
// from CPhysical
|
|
|
|
int32 ProcessEntityCollision(CEntity *ent, CColPoint *colpoints);
|
|
|
|
|
2019-07-08 06:46:42 +00:00
|
|
|
// from CVehicle
|
|
|
|
void ProcessControlInputs(uint8);
|
|
|
|
void GetComponentWorldPosition(int32 component, CVector &pos);
|
|
|
|
bool IsComponentPresent(int32 component);
|
|
|
|
void SetComponentRotation(int32 component, CVector rotation);
|
2019-07-08 19:37:47 +00:00
|
|
|
void OpenDoor(int32 component, eDoors door, float openRatio);
|
2019-07-08 06:46:42 +00:00
|
|
|
void ProcessOpenDoor(uint32, uint32, float);
|
|
|
|
bool IsDoorReady(eDoors door);
|
|
|
|
bool IsDoorFullyOpen(eDoors door);
|
|
|
|
bool IsDoorClosed(eDoors door);
|
|
|
|
bool IsDoorMissing(eDoors door);
|
|
|
|
void RemoveRefsToVehicle(CEntity *ent);
|
|
|
|
void BlowUpCar(CEntity *ent);
|
|
|
|
bool SetUpWheelColModel(CColModel *colModel);
|
|
|
|
void BurstTyre(uint8 tyre);
|
2019-07-26 18:11:11 +00:00
|
|
|
bool IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset);
|
2019-07-08 06:46:42 +00:00
|
|
|
float GetHeightAboveRoad(void);
|
|
|
|
void PlayCarHorn(void);
|
|
|
|
|
2019-07-17 21:58:06 +00:00
|
|
|
void FireTruckControl(void);
|
|
|
|
void TankControl(void);
|
|
|
|
void HydraulicControl(void);
|
|
|
|
void VehicleDamage(float impulse, uint16 damagedPiece);
|
2019-07-16 17:48:50 +00:00
|
|
|
void ProcessBuoyancy(void);
|
2019-07-17 11:19:20 +00:00
|
|
|
void DoDriveByShootings(void);
|
|
|
|
int32 RcbanditCheckHitWheels(void);
|
2019-07-23 14:39:30 +00:00
|
|
|
int32 RcbanditCheck1CarWheels(CPtrList &list);
|
|
|
|
void PlaceOnRoadProperly(void);
|
2019-07-18 19:41:20 +00:00
|
|
|
void dmgDrawCarCollidingParticles(const CVector &pos, float amount);
|
2019-07-26 16:48:14 +00:00
|
|
|
void AddDamagedVehicleParticles(void);
|
2019-07-28 11:14:08 +00:00
|
|
|
int32 AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed);
|
2019-07-09 07:57:44 +00:00
|
|
|
void PlayHornIfNecessary(void);
|
2019-07-08 19:37:47 +00:00
|
|
|
void ResetSuspension(void);
|
2019-07-09 07:57:44 +00:00
|
|
|
void SetupSuspensionLines(void);
|
2019-07-09 16:50:35 +00:00
|
|
|
void ScanForCrimes(void);
|
|
|
|
void BlowUpCarsInPath(void);
|
2019-07-09 07:57:44 +00:00
|
|
|
bool HasCarStoppedBecauseOfLight(void);
|
|
|
|
void SetBusDoorTimer(uint32 timer, uint8 type);
|
|
|
|
void ProcessAutoBusDoors(void);
|
|
|
|
void ProcessSwingingDoor(int32 component, eDoors door);
|
2019-07-08 19:37:47 +00:00
|
|
|
void SetupDamageAfterLoad(void);
|
|
|
|
CObject *SpawnFlyingComponent(int32 component, uint32 type);
|
|
|
|
CObject *RemoveBonnetInPedCollision(void);
|
|
|
|
void SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents = false);
|
|
|
|
void SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents = false);
|
|
|
|
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false);
|
2019-07-08 06:46:42 +00:00
|
|
|
|
2019-07-08 19:37:47 +00:00
|
|
|
void Fix(void);
|
2019-07-08 06:46:42 +00:00
|
|
|
void SetComponentVisibility(RwFrame *frame, uint32 flags);
|
|
|
|
void SetupModelNodes(void);
|
|
|
|
void SetTaxiLight(bool light);
|
|
|
|
bool GetAllWheelsOffGround(void);
|
|
|
|
void HideAllComps(void);
|
|
|
|
void ShowAllComps(void);
|
|
|
|
void ReduceHornCounter(void);
|
2020-05-02 15:02:17 +00:00
|
|
|
#ifdef COMPATIBLE_SAVES
|
|
|
|
virtual void Save(uint8*& buf);
|
|
|
|
virtual void Load(uint8*& buf);
|
|
|
|
#endif
|
|
|
|
static const uint32 nSaveStructSize;
|
2019-07-08 06:46:42 +00:00
|
|
|
|
|
|
|
static void SetAllTaxiLights(bool set);
|
2019-05-19 19:28:10 +00:00
|
|
|
};
|
2020-05-02 15:02:17 +00:00
|
|
|
|
2020-05-10 15:49:33 +00:00
|
|
|
VALIDATE_SIZE(CAutomobile, 0x5A8);
|
2020-05-05 15:04:18 +00:00
|
|
|
|
2019-07-29 17:18:03 +00:00
|
|
|
inline uint8 GetCarDoorFlag(int32 carnode) {
|
|
|
|
switch (carnode) {
|
|
|
|
case CAR_DOOR_LF:
|
2019-08-10 15:15:22 +00:00
|
|
|
return CAR_DOOR_FLAG_LF;
|
2019-07-29 17:18:03 +00:00
|
|
|
case CAR_DOOR_LR:
|
2019-08-10 15:15:22 +00:00
|
|
|
return CAR_DOOR_FLAG_LR;
|
2019-07-29 17:18:03 +00:00
|
|
|
case CAR_DOOR_RF:
|
2019-08-10 15:15:22 +00:00
|
|
|
return CAR_DOOR_FLAG_RF;
|
2019-07-29 17:18:03 +00:00
|
|
|
case CAR_DOOR_RR:
|
2019-08-10 15:15:22 +00:00
|
|
|
return CAR_DOOR_FLAG_RR;
|
2019-07-29 17:18:03 +00:00
|
|
|
default:
|
2019-08-10 15:15:22 +00:00
|
|
|
return CAR_DOOR_FLAG_UNKNOWN;
|
2019-07-29 17:18:03 +00:00
|
|
|
}
|
|
|
|
}
|