1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-10 21:29:16 +00:00
re3/src/vehicles/Bike.h

171 lines
4.3 KiB
C
Raw Normal View History

2020-04-09 18:50:24 +00:00
#pragma once
2020-06-02 21:35:20 +00:00
#include "Vehicle.h"
2020-06-02 13:26:11 +00:00
#include "Skidmarks.h"
2020-04-09 18:50:24 +00:00
enum eBikeNodes {
BIKE_NODE_NONE,
BIKE_CHASSIS,
BIKE_FORKS_FRONT,
BIKE_FORKS_REAR,
BIKE_WHEEL_FRONT,
BIKE_WHEEL_REAR,
BIKE_MUDGUARD,
BIKE_HANDLEBARS,
BIKE_NUM_NODES
};
2020-06-02 21:35:20 +00:00
enum {
BIKEWHEEL_FRONT,
BIKEWHEEL_REAR,
};
enum {
2020-06-04 15:38:41 +00:00
BIKESUSP_F1,
BIKESUSP_F2,
BIKESUSP_R1,
BIKESUSP_R2,
};
2020-06-02 12:38:30 +00:00
class CBike : public CVehicle
{
public:
RwFrame *m_aBikeNodes[BIKE_NUM_NODES];
2020-06-02 21:35:20 +00:00
bool bLeanMatrixClean;
2020-06-02 12:38:30 +00:00
CMatrix m_leanMatrix;
2020-06-04 15:38:41 +00:00
CVector m_vecAvgSurfaceNormal;
CVector m_vecAvgSurfaceRight;
2020-06-02 12:38:30 +00:00
tBikeHandlingData *pBikeHandling;
2020-06-03 13:16:31 +00:00
AssocGroupId m_bikeAnimType;
2020-06-02 12:38:30 +00:00
uint8 m_wheelStatus[2];
CColPoint m_aWheelColPoints[4];
float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4];
float m_aWheelTimer[4];
float m_bike_unused1;
eSkidmarkType m_aWheelSkidmarkType[2];
bool m_aWheelSkidmarkBloody[2];
bool m_aWheelSkidmarkUnk[2];
float m_aWheelRotation[2];
float m_aWheelSpeed[2];
float m_aWheelPosition[2];
float m_aWheelBasePosition[2];
float m_aSuspensionSpringLength[4];
float m_aSuspensionLineLength[4];
float m_fHeightAboveRoad;
float m_fTraction;
float m_fRearForkLength;
float m_fFrontForkY;
float m_fFrontForkZ;
float m_fFrontForkSlope;
2020-06-04 15:38:41 +00:00
float m_fWheelAngle;
2020-06-02 12:38:30 +00:00
float m_fLeanLRAngle;
float m_fLeanLRAngle2;
float m_fLeanInput;
2020-06-05 20:13:31 +00:00
float m_fPedLeanAmountLR;
float m_fPedLeanAmountUD;
2020-06-02 12:38:30 +00:00
uint8 m_bike_unused2;
uint8 unused[3]; // looks like padding..but for what?
2020-06-02 13:26:11 +00:00
uint8 m_bike_flag01 : 1;
uint8 m_bike_flag02 : 1;
2020-06-04 15:38:41 +00:00
uint8 bWaterTight : 1;
2020-06-06 22:01:48 +00:00
uint8 bIsBeingPickedUp : 1;
2020-06-04 15:38:41 +00:00
uint8 bIsStanding : 1;
2020-06-04 22:24:42 +00:00
uint8 bExtraSpeed : 1; // leaning forward
2020-06-05 13:09:45 +00:00
uint8 bIsOnFire : 1;
2020-06-09 13:50:00 +00:00
uint8 bWheelieCam : 1;
2020-06-02 12:38:30 +00:00
int16 m_doingBurnout;
float m_fTireTemperature;
2020-06-04 22:24:42 +00:00
float m_fBrakeDestabilization;
float m_fVelocityChangeForAudio;
2020-06-02 12:38:30 +00:00
float m_fFireBlowUpTimer;
CPhysical *m_aGroundPhysical[4];
CVector m_aGroundOffset[4];
CEntity *m_pSetOnFireEntity;
uint8 m_nWheelsOnGround;
uint8 m_nDriveWheelsOnGround;
uint8 m_nDriveWheelsOnGroundPrev;
float m_fGasPedalAudio;
tWheelState m_aWheelState[2];
2020-06-02 21:35:20 +00:00
CBike(int32 id, uint8 CreatedBy);
// from CEntity
void SetModelIndex(uint32 id);
void ProcessControl(void);
void Teleport(CVector v);
void PreRender(void);
void Render(void);
// from CPhysical
int32 ProcessEntityCollision(CEntity *ent, CColPoint *colpoints);
// from CVehicle
void ProcessControlInputs(uint8);
void GetComponentWorldPosition(int32 component, CVector &pos);
bool IsComponentPresent(int32 component);
void SetComponentRotation(int32 component, CVector rotation);
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, bool applyForces);
bool IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset);
float GetHeightAboveRoad(void);
void PlayCarHorn(void);
2020-06-06 11:22:48 +00:00
void KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBackOn);
2020-06-04 15:38:41 +00:00
void VehicleDamage(void);
void ProcessBuoyancy(void);
void DoDriveByShootings(void);
2020-06-06 22:01:48 +00:00
void AddDamagedVehicleParticles(void);
int32 AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed);
2020-06-02 21:35:20 +00:00
void PlayHornIfNecessary(void);
void ResetSuspension(void);
void SetupSuspensionLines(void);
void CalculateLeanMatrix(void);
void GetCorrectedWorldDoorPosition(CVector &pos, CVector p1, CVector p2);
void Fix(void);
void SetupModelNodes(void);
void ReduceHornCounter(void);
2020-10-17 15:50:16 +00:00
#ifdef COMPATIBLE_SAVES
virtual void Save(uint8*& buf);
virtual void Load(uint8*& buf);
#endif
static const uint32 nSaveStructSize;
2020-06-02 12:38:30 +00:00
};
2020-09-23 20:29:56 +00:00
// These functions and function names are made up
inline int8 GetBikeDoorFlag(int32 carnode) {
2020-09-23 20:29:56 +00:00
switch (carnode) {
case CAR_DOOR_RR:
case CAR_DOOR_LR:
return CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
case CAR_DOOR_LF:
return CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}
// for m_nGettingOutFlags
inline int8 GetBikeDoorFlagInclJumpInFromFront(int32 carnode) {
switch (carnode) {
case CAR_DOOR_RR:
case CAR_DOOR_LR:
return CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
case CAR_DOOR_LF:
case CAR_WINDSCREEN:
return CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}