SilentPatch/SilentPatchSA/VehicleSA.h

193 lines
7.9 KiB
C
Raw Normal View History

2014-05-31 00:14:47 +06:00
#ifndef __VEHICLE
#define __VEHICLE
2014-08-03 19:38:53 +06:00
#include "GeneralSA.h"
2014-06-23 06:37:03 +06:00
#include "ModelInfoSA.h"
2014-05-31 00:14:47 +06:00
enum eVehicleType
{
VEHICLE_AUTOMOBILE,
VEHICLE_MTRUCK,
VEHICLE_QUAD,
VEHICLE_HELI,
VEHICLE_PLANE,
VEHICLE_BOAT,
VEHICLE_TRAIN,
VEHICLE_FHELI,
VEHICLE_FPLANE,
VEHICLE_BIKE,
VEHICLE_BMX,
VEHICLE_TRAILER
};
2014-05-31 00:14:47 +06:00
struct CVehicleFlags
{
//0x428
unsigned char bIsLawEnforcer: 1; // Is this guy chasing the player at the moment
unsigned char bIsAmbulanceOnDuty: 1; // Ambulance trying to get to an accident
unsigned char bIsFireTruckOnDuty: 1; // Firetruck trying to get to a fire
unsigned char bIsLocked: 1; // Is this guy locked by the script (cannot be removed)
unsigned char bEngineOn: 1; // For sound purposes. Parked cars have their engines switched off (so do destroyed cars)
unsigned char bIsHandbrakeOn: 1; // How's the handbrake doing ?
unsigned char bLightsOn: 1; // Are the lights switched on ?
unsigned char bFreebies: 1; // Any freebies left in this vehicle ?
//0x429
unsigned char bIsVan: 1; // Is this vehicle a van (doors at back of vehicle)
unsigned char bIsBus: 1; // Is this vehicle a bus
unsigned char bIsBig: 1; // Is this vehicle big
unsigned char bLowVehicle: 1; // Need this for sporty type cars to use low getting-in/out anims
unsigned char bComedyControls: 1; // Will make the car hard to control (hopefully in a funny way)
unsigned char bWarnedPeds: 1; // Has scan and warn peds of danger been processed?
unsigned char bCraneMessageDone: 1; // A crane message has been printed for this car allready
// unsigned char bExtendedRange: 1; // This vehicle needs to be a bit further away to get deleted
unsigned char bTakeLessDamage: 1; // This vehicle is stronger (takes about 1/4 of damage)
//0x42A
unsigned char bIsDamaged: 1; // This vehicle has been damaged and is displaying all its components
unsigned char bHasBeenOwnedByPlayer : 1;// To work out whether stealing it is a crime
unsigned char bFadeOut: 1; // Fade vehicle out
unsigned char bIsBeingCarJacked: 1;
unsigned char bCreateRoadBlockPeds : 1;// If this vehicle gets close enough we will create peds (coppers or gang members) round it
unsigned char bCanBeDamaged: 1; // Set to FALSE during cut scenes to avoid explosions
// unsigned char bUsingSpecialColModel : 1;
// Is player vehicle using special collision model, stored in player strucure
unsigned char bOccupantsHaveBeenGenerated : 1; // Is true if the occupants have already been generated. (Shouldn't happen again)
unsigned char bGunSwitchedOff: 1; // Level designers can use this to switch off guns on boats
//0x42B
unsigned char bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car?
unsigned char bIsCarParkVehicle: 1; // Car has been created using the special CAR_PARK script command
unsigned char bHasAlreadyBeenRecorded : 1; // Used for replays
unsigned char bPartOfConvoy: 1;
unsigned char bHeliMinimumTilt: 1; // This heli should have almost no tilt really
unsigned char bAudioChangingGear: 1; // sounds like vehicle is changing gear
unsigned char bIsDrowning: 1; // is vehicle occupants taking damage in water (i.e. vehicle is dead in water)
unsigned char bTyresDontBurst: 1; // If this is set the tyres are invincible
//0x42C
unsigned char bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc)
unsigned char bRestingOnPhysical: 1; // Dont go static cause car is sitting on a physical object that might get removed
unsigned char bParking : 1;
unsigned char bCanPark : 1;
unsigned char bFireGun: 1; // Does the ai of this vehicle want to fire it's gun?
unsigned char bDriverLastFrame: 1; // Was there a driver present last frame ?
unsigned char bNeverUseSmallerRemovalRange: 1;// Some vehicles (like planes) we don't want to remove just behind the camera.
unsigned char bIsRCVehicle: 1; // Is this a remote controlled (small) vehicle. True whether the player or AI controls it.
//0x42D
unsigned char bAlwaysSkidMarks: 1; // This vehicle leaves skidmarks regardless of the wheels' states.
unsigned char bEngineBroken: 1; // Engine doesn't work. Player can get in but the vehicle won't drive
unsigned char bVehicleCanBeTargetted : 1;// The ped driving this vehicle can be targetted, (for Torenos plane mission)
unsigned char bPartOfAttackWave: 1; // This car is used in an attack during a gang war
unsigned char bWinchCanPickMeUp: 1; // This car cannot be picked up by any ropes.
unsigned char bImpounded: 1; // Has this vehicle been in a police impounding garage
unsigned char bVehicleCanBeTargettedByHS : 1;// Heat seeking missiles will not target this vehicle.
unsigned char bSirenOrAlarm: 1; // Set to TRUE if siren or alarm active, else FALSE
//0x42E
unsigned char bHasGangLeaningOn: 1;
unsigned char bGangMembersForRoadBlock : 1;// Will generate gang members if NumPedsForRoadBlock > 0
unsigned char bDoesProvideCover: 1; // If this is false this particular vehicle can not be used to take cover behind.
unsigned char bMadDriver: 1; // This vehicle is driving like a lunatic
unsigned char bUpgradedStereo: 1; // This vehicle has an upgraded stereo
unsigned char bConsideredByPlayer: 1; // This vehicle is considered by the player to enter
unsigned char bPetrolTankIsWeakPoint : 1;// If false shootong the petrol tank will NOT Blow up the car
unsigned char bDisableParticles: 1; // Disable particles from this car. Used in garage.
//0x42F
unsigned char bHasBeenResprayed: 1; // Has been resprayed in a respray garage. Reset after it has been checked.
unsigned char bUseCarCheats: 1; // If this is true will set the car cheat stuff up in ProcessControl()
unsigned char bDontSetColourWhenRemapping : 1;// If the texture gets remapped we don't want to change the colour with it.
unsigned char bUsedForReplay: 1; // This car is controlled by replay and should be removed when replay is done.
};
class CBouncingPanel
{
public:
short m_nNodeIndex;
short m_nBouncingType;
float m_fBounceRange;
CVector field_8;
CVector m_vecBounceVector;
};
2014-05-31 00:14:47 +06:00
class NOVMT CVehicle : public CPhysical
{
protected:
BYTE __pad1[752];
CVehicleFlags m_nVehicleFlags;
BYTE __pad2[160];
signed int m_nTimeTillWeNeedThisCar;
BYTE __pad4[56];
CEntity* pDamagingEntity;
2014-06-23 06:37:03 +06:00
BYTE __pad3[116];
char padpad, padpad2, padpad3;
signed char PlateDesign;
RwTexture* PlateTexture;
BYTE __pad5[20];
2014-05-31 00:14:47 +06:00
public:
CVehicleFlags& GetVehicleFlags()
{ return m_nVehicleFlags; }
CEntity* GetDamagingEntity()
{ return pDamagingEntity; }
virtual void Render() override;
2014-06-23 06:37:03 +06:00
bool CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo);
void CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo);
2014-06-23 19:08:48 +06:00
//void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
2014-06-23 06:37:03 +06:00
2014-06-23 18:54:36 +06:00
bool IsLawEnforcementVehicle();
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
2014-05-31 00:14:47 +06:00
};
class NOVMT CAutomobile : public CVehicle
{
public:
BYTE paddd[168];
RwFrame* m_pCarNode[25];
CBouncingPanel m_aBouncingPanel[3];
BYTE padding[320];
float m_fRotorSpeed;
BYTE __moarpad[312];
2014-05-31 00:14:47 +06:00
public:
void Fix_SilentPatch();
void ResetFrames();
2014-05-31 00:14:47 +06:00
};
class NOVMT CHeli : public CAutomobile
{
public:
2014-08-03 19:38:53 +06:00
inline void Render_Stub()
{ CHeli::Render(); }
2014-05-31 00:14:47 +06:00
virtual void Render() override;
};
class NOVMT CPlane : public CAutomobile
{
public:
BYTE __pad[60];
float m_fPropellerSpeed;
public:
2014-08-03 19:38:53 +06:00
inline void Render_Stub()
{ CPlane::Render(); }
2014-05-31 00:14:47 +06:00
virtual void Render() override;
void Fix_SilentPatch();
2014-05-31 00:14:47 +06:00
};
2015-05-06 02:29:15 +05:00
void ReadRotorFixExceptions(const wchar_t* pPath);
static_assert(sizeof(CBouncingPanel) == 0x20, "Wrong size: CBouncingPanel");
2014-05-31 00:14:47 +06:00
static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");
#endif