2019-05-15 14:52:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ClumpModelInfo.h"
|
|
|
|
|
|
|
|
enum {
|
2020-05-10 15:09:14 +00:00
|
|
|
NUM_FIRST_MATERIALS = 24,
|
|
|
|
NUM_SECOND_MATERIALS = 20,
|
2019-05-15 14:52:37 +00:00
|
|
|
NUM_VEHICLE_COLOURS = 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2019-07-08 06:46:42 +00:00
|
|
|
ATOMIC_FLAG_NONE = 0x0,
|
2019-05-15 14:52:37 +00:00
|
|
|
ATOMIC_FLAG_OK = 0x1,
|
|
|
|
ATOMIC_FLAG_DAM = 0x2,
|
|
|
|
ATOMIC_FLAG_LEFT = 0x4,
|
|
|
|
ATOMIC_FLAG_RIGHT = 0x8,
|
|
|
|
ATOMIC_FLAG_FRONT = 0x10,
|
|
|
|
ATOMIC_FLAG_REAR = 0x20,
|
|
|
|
ATOMIC_FLAG_DRAWLAST = 0x40,
|
|
|
|
ATOMIC_FLAG_WINDSCREEN = 0x80,
|
|
|
|
ATOMIC_FLAG_ANGLECULL = 0x100,
|
|
|
|
ATOMIC_FLAG_REARDOOR = 0x200,
|
|
|
|
ATOMIC_FLAG_FRONTDOOR = 0x400,
|
|
|
|
ATOMIC_FLAG_NOCULL = 0x800,
|
|
|
|
};
|
|
|
|
|
2019-06-24 14:57:54 +00:00
|
|
|
enum eVehicleType {
|
2019-10-25 16:39:26 +00:00
|
|
|
VEHICLE_TYPE_CAR,
|
2019-05-15 14:52:37 +00:00
|
|
|
VEHICLE_TYPE_BOAT,
|
|
|
|
VEHICLE_TYPE_TRAIN,
|
|
|
|
VEHICLE_TYPE_HELI,
|
|
|
|
VEHICLE_TYPE_PLANE,
|
|
|
|
VEHICLE_TYPE_BIKE,
|
|
|
|
NUM_VEHICLE_TYPES
|
|
|
|
};
|
|
|
|
|
2020-06-02 21:35:20 +00:00
|
|
|
enum eCarPositions
|
|
|
|
{
|
|
|
|
CAR_POS_HEADLIGHTS,
|
|
|
|
CAR_POS_TAILLIGHTS,
|
|
|
|
CAR_POS_FRONTSEAT,
|
|
|
|
CAR_POS_BACKSEAT,
|
|
|
|
CAR_POS_EXHAUST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum eBoatPositions
|
|
|
|
{
|
|
|
|
BOAT_POS_FRONTSEAT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum eTrainPositions
|
|
|
|
{
|
|
|
|
TRAIN_POS_LIGHT_FRONT,
|
|
|
|
TRAIN_POS_LIGHT_REAR,
|
|
|
|
TRAIN_POS_LEFT_ENTRY,
|
|
|
|
TRAIN_POS_MID_ENTRY,
|
|
|
|
TRAIN_POS_RIGHT_ENTRY
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ePlanePositions
|
|
|
|
{
|
|
|
|
PLANE_POS_LIGHT_LEFT,
|
|
|
|
PLANE_POS_LIGHT_RIGHT,
|
|
|
|
PLANE_POS_LIGHT_TAIL,
|
|
|
|
};
|
|
|
|
|
2019-06-24 14:57:54 +00:00
|
|
|
enum {
|
2020-05-11 20:21:18 +00:00
|
|
|
NUM_VEHICLE_POSITIONS = 5
|
2019-06-24 14:57:54 +00:00
|
|
|
};
|
|
|
|
|
2019-05-15 14:52:37 +00:00
|
|
|
class CVehicleModelInfo : public CClumpModelInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
uint8 m_lastColour1;
|
|
|
|
uint8 m_lastColour2;
|
2020-05-10 15:09:14 +00:00
|
|
|
char m_gameName[10];
|
2019-05-15 14:52:37 +00:00
|
|
|
int32 m_vehicleType;
|
2020-05-10 15:09:14 +00:00
|
|
|
float m_wheelScale;
|
2019-07-31 21:57:18 +00:00
|
|
|
union {
|
2020-05-10 15:09:14 +00:00
|
|
|
int16 m_wheelId;
|
|
|
|
int16 m_planeLodId;
|
2019-07-31 21:57:18 +00:00
|
|
|
};
|
2020-05-10 15:09:14 +00:00
|
|
|
int16 m_handlingId;
|
|
|
|
int8 m_numDoors;
|
|
|
|
int8 m_vehicleClass;
|
|
|
|
int8 m_level;
|
|
|
|
int8 m_numComps;
|
2020-05-07 15:53:38 +00:00
|
|
|
int16 m_frequency;
|
2019-05-15 14:52:37 +00:00
|
|
|
CVector m_positions[NUM_VEHICLE_POSITIONS];
|
|
|
|
uint32 m_compRules;
|
|
|
|
float m_bikeSteerAngle;
|
|
|
|
RpMaterial *m_materials1[NUM_FIRST_MATERIALS];
|
|
|
|
RpMaterial *m_materials2[NUM_SECOND_MATERIALS];
|
|
|
|
uint8 m_colours1[NUM_VEHICLE_COLOURS];
|
|
|
|
uint8 m_colours2[NUM_VEHICLE_COLOURS];
|
|
|
|
uint8 m_numColours;
|
2019-05-28 19:17:47 +00:00
|
|
|
uint8 m_lastColorVariation;
|
2019-05-15 14:52:37 +00:00
|
|
|
uint8 m_currentColour1;
|
|
|
|
uint8 m_currentColour2;
|
|
|
|
RpAtomic *m_comps[6];
|
2020-05-10 16:14:14 +00:00
|
|
|
// This is stupid, CClumpModelInfo already has it!
|
2020-05-10 15:09:14 +00:00
|
|
|
union {
|
|
|
|
int32 m_animFileIndex;
|
|
|
|
char *m_animFileName;
|
|
|
|
};
|
2019-05-15 14:52:37 +00:00
|
|
|
|
2020-04-17 05:54:14 +00:00
|
|
|
static int8 ms_compsToUse[2];
|
|
|
|
static int8 ms_compsUsed[2];
|
|
|
|
static RwRGBA ms_vehicleColourTable[256];
|
|
|
|
static RwTexture *ms_colourTextureTable[256];
|
2019-05-15 14:52:37 +00:00
|
|
|
static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES];
|
|
|
|
|
|
|
|
CVehicleModelInfo(void);
|
|
|
|
void DeleteRwObject(void);
|
|
|
|
RwObject *CreateInstance(void);
|
|
|
|
void SetClump(RpClump *);
|
2020-05-10 15:09:14 +00:00
|
|
|
void SetAnimFile(const char *file);
|
|
|
|
void ConvertAnimFileIndex(void);
|
|
|
|
int GetAnimFileIndex(void) { return m_animFileIndex; }
|
2019-05-15 14:52:37 +00:00
|
|
|
|
|
|
|
static RwFrame *CollapseFramesCB(RwFrame *frame, void *data);
|
|
|
|
static RwObject *MoveObjectsCB(RwObject *object, void *data);
|
|
|
|
static RpAtomic *HideDamagedAtomicCB(RpAtomic *atomic, void *data);
|
2019-05-28 19:17:47 +00:00
|
|
|
static RpAtomic *HideAllComponentsAtomicCB(RpAtomic *atomic, void *data);
|
2019-05-15 14:52:37 +00:00
|
|
|
static RpMaterial *HasAlphaMaterialCB(RpMaterial *material, void *data);
|
|
|
|
|
|
|
|
static RpAtomic *SetAtomicRendererCB(RpAtomic *atomic, void *data);
|
|
|
|
static RpAtomic *SetAtomicRendererCB_BigVehicle(RpAtomic *atomic, void *data);
|
|
|
|
static RpAtomic *SetAtomicRendererCB_Train(RpAtomic *atomic, void *data);
|
|
|
|
static RpAtomic *SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data);
|
|
|
|
static RpAtomic *SetAtomicRendererCB_Heli(RpAtomic *atomic, void *data);
|
2020-05-10 15:09:14 +00:00
|
|
|
static RpAtomic *SetAtomicRendererCB_RealHeli(RpAtomic *atomic, void *data);
|
2019-05-15 14:52:37 +00:00
|
|
|
void SetAtomicRenderCallbacks(void);
|
|
|
|
|
2019-06-19 23:07:57 +00:00
|
|
|
static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
|
2019-07-08 19:37:47 +00:00
|
|
|
static RwObject *ClearAtomicFlagCB(RwObject *atomic, void *data);
|
2019-05-15 14:52:37 +00:00
|
|
|
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
|
|
|
|
void PreprocessHierarchy(void);
|
|
|
|
void GetWheelPosn(int32 n, CVector &pos);
|
2020-06-02 21:35:20 +00:00
|
|
|
CVector GetFrontSeatPosn(void) { return m_positions[m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; };
|
2019-05-15 14:52:37 +00:00
|
|
|
|
|
|
|
int32 ChooseComponent(void);
|
|
|
|
int32 ChooseSecondComponent(void);
|
|
|
|
|
|
|
|
static RpMaterial *GetEditableMaterialListCB(RpMaterial *material, void *data);
|
|
|
|
static RpAtomic *GetEditableMaterialListCB(RpAtomic *atomic, void *data);
|
|
|
|
void FindEditableMaterialList(void);
|
|
|
|
void SetVehicleColour(uint8 c1, uint8 c2);
|
2019-05-28 19:17:47 +00:00
|
|
|
void ChooseVehicleColour(uint8 &col1, uint8 &col2);
|
|
|
|
void AvoidSameVehicleColour(uint8 *col1, uint8 *col2);
|
|
|
|
static void LoadVehicleColours(void);
|
|
|
|
static void DeleteVehicleColourTextures(void);
|
2019-05-15 14:52:37 +00:00
|
|
|
|
|
|
|
static RpAtomic *SetEnvironmentMapCB(RpAtomic *atomic, void *data);
|
2020-05-07 10:48:09 +00:00
|
|
|
static RpMaterial *SetDefaultEnvironmentMapCB(RpMaterial *material, void *data);
|
|
|
|
static RpMaterial *GetMatFXEffectMaterialCB(RpMaterial *material, void *data);
|
2019-05-15 14:52:37 +00:00
|
|
|
void SetEnvironmentMap(void);
|
|
|
|
static void LoadEnvironmentMaps(void);
|
|
|
|
static void ShutdownEnvironmentMaps(void);
|
|
|
|
|
2019-05-28 19:17:47 +00:00
|
|
|
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
|
2020-03-28 17:52:25 +00:00
|
|
|
static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; }
|
2019-05-15 14:52:37 +00:00
|
|
|
};
|
2020-05-10 15:09:14 +00:00
|
|
|
|
|
|
|
extern bool gbBlackCars;
|
|
|
|
extern bool gbPinkCars;
|