2019-05-15 14:52:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-16 13:44:59 +00:00
|
|
|
struct CColModel;
|
2019-05-15 14:52:37 +00:00
|
|
|
|
2020-04-11 18:01:39 +00:00
|
|
|
#define MAX_MODEL_NAME (24)
|
|
|
|
|
2020-12-06 23:36:40 +00:00
|
|
|
enum ModelInfoType
|
2019-05-15 14:52:37 +00:00
|
|
|
{
|
|
|
|
MITYPE_NA = 0,
|
|
|
|
MITYPE_SIMPLE = 1,
|
|
|
|
MITYPE_MLO = 2,
|
|
|
|
MITYPE_TIME = 3,
|
|
|
|
MITYPE_CLUMP = 4,
|
|
|
|
MITYPE_VEHICLE = 5,
|
|
|
|
MITYPE_PED = 6,
|
|
|
|
MITYPE_XTRACOMPS = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
class C2dEffect;
|
|
|
|
|
|
|
|
class CBaseModelInfo
|
|
|
|
{
|
|
|
|
protected:
|
2020-04-11 18:01:39 +00:00
|
|
|
char m_name[MAX_MODEL_NAME];
|
2019-05-15 14:52:37 +00:00
|
|
|
CColModel *m_colModel;
|
|
|
|
C2dEffect *m_twodEffects;
|
|
|
|
int16 m_objectId;
|
|
|
|
uint16 m_refCount;
|
|
|
|
int16 m_txdSlot;
|
2020-12-06 23:36:40 +00:00
|
|
|
uint8 m_type;
|
2019-05-15 14:52:37 +00:00
|
|
|
uint8 m_num2dEffects;
|
2020-05-05 11:02:42 +00:00
|
|
|
bool m_bOwnsColModel;
|
2020-10-29 18:11:47 +00:00
|
|
|
#ifdef EXTRA_MODEL_FLAGS
|
|
|
|
public:
|
|
|
|
// from mobile
|
|
|
|
bool m_bIsDoubleSided;
|
|
|
|
bool m_bIsTree;
|
|
|
|
bool m_bCanBeIgnored; // for low-end devices
|
|
|
|
bool RenderDoubleSided(void) { return m_bIsDoubleSided || m_bIsTree; }
|
|
|
|
#endif
|
2019-05-15 14:52:37 +00:00
|
|
|
|
2020-05-05 12:06:55 +00:00
|
|
|
public:
|
2020-05-05 11:02:42 +00:00
|
|
|
CBaseModelInfo(ModelInfoType type);
|
2019-05-15 14:52:37 +00:00
|
|
|
virtual ~CBaseModelInfo() {}
|
|
|
|
virtual void Shutdown(void);
|
|
|
|
virtual void DeleteRwObject(void) = 0;
|
|
|
|
virtual RwObject *CreateInstance(void) = 0;
|
2021-01-12 22:25:12 +00:00
|
|
|
virtual RwObject *CreateInstance(RwMatrix *) = 0;
|
2019-05-15 14:52:37 +00:00
|
|
|
virtual RwObject *GetRwObject(void) = 0;
|
|
|
|
|
2020-05-05 12:06:55 +00:00
|
|
|
// one day it becomes virtual
|
2020-12-06 23:36:40 +00:00
|
|
|
uint8 GetModelType() const { return m_type; }
|
2019-05-15 14:52:37 +00:00
|
|
|
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
|
2019-06-17 08:30:02 +00:00
|
|
|
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE ||
|
|
|
|
m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck
|
|
|
|
}
|
2021-01-08 19:50:59 +00:00
|
|
|
char *GetModelName(void) { return m_name; }
|
|
|
|
void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
|
2020-05-05 11:02:42 +00:00
|
|
|
void SetColModel(CColModel *col, bool owns = false){
|
|
|
|
m_colModel = col; m_bOwnsColModel = owns; }
|
2019-05-15 14:52:37 +00:00
|
|
|
CColModel *GetColModel(void) { return m_colModel; }
|
2020-05-05 12:21:13 +00:00
|
|
|
bool DoesOwnColModel(void) { return m_bOwnsColModel; }
|
2019-05-15 14:52:37 +00:00
|
|
|
void DeleteCollisionModel(void);
|
|
|
|
void ClearTexDictionary(void) { m_txdSlot = -1; }
|
2020-12-03 15:04:59 +00:00
|
|
|
int16 GetObjectID(void) { return m_objectId; }
|
2019-06-19 16:35:51 +00:00
|
|
|
void SetObjectID(int16 id) { m_objectId = id; }
|
2020-12-03 15:04:59 +00:00
|
|
|
int16 GetTxdSlot(void) { return m_txdSlot; }
|
2019-05-15 14:52:37 +00:00
|
|
|
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 12:06:55 +00:00
|
|
|
uint8 GetNum2dEffects() const { return m_num2dEffects; }
|
|
|
|
uint16 GetNumRefs() const { return m_refCount; }
|
2019-05-15 14:52:37 +00:00
|
|
|
};
|
|
|
|
|
2020-05-10 15:49:33 +00:00
|
|
|
VALIDATE_SIZE(CBaseModelInfo, 0x30);
|