2019-05-15 16:52:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Collision.h"
|
|
|
|
|
2020-04-11 20:01:39 +02:00
|
|
|
#define MAX_MODEL_NAME (24)
|
|
|
|
|
2020-05-05 13:02:42 +02:00
|
|
|
enum ModelInfoType : uint8
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
2020-05-06 21:54:43 +02:00
|
|
|
MITYPE_NA,
|
|
|
|
MITYPE_SIMPLE,
|
|
|
|
MITYPE_MLO, // unused but still in enum
|
|
|
|
MITYPE_TIME,
|
|
|
|
MITYPE_WEAPON,
|
|
|
|
MITYPE_CLUMP,
|
|
|
|
MITYPE_VEHICLE,
|
|
|
|
MITYPE_PED,
|
|
|
|
MITYPE_XTRACOMPS, // unused but still in enum
|
|
|
|
MITYPE_HAND // xbox and mobile
|
2019-05-15 16:52:37 +02:00
|
|
|
};
|
2020-05-05 13:02:42 +02:00
|
|
|
static_assert(sizeof(ModelInfoType) == 1, "ModeInfoType: error");
|
2019-05-15 16:52:37 +02:00
|
|
|
|
|
|
|
class C2dEffect;
|
|
|
|
|
|
|
|
class CBaseModelInfo
|
|
|
|
{
|
|
|
|
protected:
|
2020-04-11 20:01:39 +02:00
|
|
|
char m_name[MAX_MODEL_NAME];
|
2019-05-15 16:52:37 +02:00
|
|
|
CColModel *m_colModel;
|
|
|
|
C2dEffect *m_twodEffects;
|
|
|
|
int16 m_objectId;
|
|
|
|
uint16 m_refCount;
|
|
|
|
int16 m_txdSlot;
|
2020-05-05 13:02:42 +02:00
|
|
|
ModelInfoType m_type;
|
2019-05-15 16:52:37 +02:00
|
|
|
uint8 m_num2dEffects;
|
2020-05-05 13:02:42 +02:00
|
|
|
bool m_bOwnsColModel;
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-05-05 14:06:55 +02:00
|
|
|
public:
|
2020-05-05 13:02:42 +02:00
|
|
|
CBaseModelInfo(ModelInfoType type);
|
2019-05-15 16:52:37 +02:00
|
|
|
virtual ~CBaseModelInfo() {}
|
|
|
|
virtual void Shutdown(void);
|
|
|
|
virtual void DeleteRwObject(void) = 0;
|
|
|
|
virtual RwObject *CreateInstance(RwMatrix *) = 0;
|
|
|
|
virtual RwObject *CreateInstance(void) = 0;
|
|
|
|
virtual RwObject *GetRwObject(void) = 0;
|
|
|
|
|
2020-05-05 14:06:55 +02:00
|
|
|
// one day it becomes virtual
|
2020-05-05 14:21:13 +02:00
|
|
|
ModelInfoType GetModelType() const { return m_type; }
|
2020-05-06 21:54:43 +02:00
|
|
|
bool IsBuilding(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
|
|
|
|
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME || m_type == MITYPE_WEAPON; }
|
|
|
|
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
|
2019-05-15 16:52:37 +02:00
|
|
|
char *GetName(void) { return m_name; }
|
|
|
|
void SetName(const char *name) { strncpy(m_name, name, 24); }
|
2020-05-05 13:02:42 +02:00
|
|
|
void SetColModel(CColModel *col, bool owns = false){
|
|
|
|
m_colModel = col; m_bOwnsColModel = owns; }
|
2019-05-15 16:52:37 +02:00
|
|
|
CColModel *GetColModel(void) { return m_colModel; }
|
2020-05-05 14:21:13 +02:00
|
|
|
bool DoesOwnColModel(void) { return m_bOwnsColModel; }
|
2019-05-15 16:52:37 +02:00
|
|
|
void DeleteCollisionModel(void);
|
|
|
|
void ClearTexDictionary(void) { m_txdSlot = -1; }
|
|
|
|
short GetObjectID(void) { return m_objectId; }
|
2019-06-19 18:35:51 +02:00
|
|
|
void SetObjectID(int16 id) { m_objectId = id; }
|
2019-05-15 16:52:37 +02:00
|
|
|
short GetTxdSlot(void) { return m_txdSlot; }
|
|
|
|
void AddRef(void);
|
|
|
|
void RemoveRef(void);
|
|
|
|
void SetTexDictionary(const char *name);
|
|
|
|
void AddTexDictionaryRef(void);
|
|
|
|
void RemoveTexDictionaryRef(void);
|
|
|
|
void Init2dEffects(void);
|
|
|
|
void Add2dEffect(C2dEffect *fx);
|
|
|
|
C2dEffect *Get2dEffect(int n);
|
2020-05-05 14:06:55 +02:00
|
|
|
uint8 GetNum2dEffects() const { return m_num2dEffects; }
|
|
|
|
uint16 GetNumRefs() const { return m_refCount; }
|
2019-05-15 16:52:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
|