1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-29 09:07:06 +00:00
re3/src/modelinfo/BaseModelInfo.h

100 lines
3.2 KiB
C
Raw Normal View History

2019-05-15 14:52:37 +00:00
#pragma once
struct CColModel;
2019-05-15 14:52:37 +00:00
2021-01-23 23:07:45 +00:00
#define MAX_MODEL_NAME (24)
2020-04-11 18:01:39 +00:00
2020-12-07 00:59:17 +00:00
enum ModelInfoType
2019-05-15 14:52:37 +00: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 14:52:37 +00:00
};
class C2dEffect;
class CBaseModelInfo
{
protected:
2021-01-23 23:07:45 +00:00
uint32 m_unk1;
uint32 m_unk2;
uint32 m_nameKey;
2021-01-23 23:07:45 +00:00
union {
char *m_name; // if not using chunks
void *m_chunk; // else
};
2020-12-07 00:59:17 +00:00
uint8 m_type;
2020-05-07 19:55:54 +00:00
uint8 m_num2dEffects;
bool m_bOwnsColModel;
2021-01-23 11:40:23 +00:00
public: // need this in colstore
2019-05-15 14:52:37 +00:00
CColModel *m_colModel;
2021-01-23 11:40:23 +00:00
protected:
2020-05-07 19:55:54 +00:00
int16 m_2dEffectsID;
2019-05-15 14:52:37 +00:00
int16 m_objectId;
uint16 m_refCount;
int16 m_txdSlot;
2020-05-05 12:06:55 +00:00
public:
CBaseModelInfo(ModelInfoType type);
#ifdef FIX_BUGS
virtual ~CBaseModelInfo() { delete []m_name; }
#else
2019-05-15 14:52:37 +00:00
virtual ~CBaseModelInfo() {}
#endif
2019-05-15 14:52:37 +00:00
virtual void Shutdown(void);
virtual void DeleteRwObject(void) = 0;
virtual RwObject *CreateInstance(void) = 0;
virtual RwObject *CreateInstance(RwMatrix *) = 0;
2019-05-15 14:52:37 +00:00
virtual RwObject *GetRwObject(void) = 0;
2020-05-07 19:55:54 +00:00
virtual void SetAnimFile(const char *file) {}
virtual void ConvertAnimFileIndex(void) {}
virtual int GetAnimFileIndex(void) { return -1; }
2019-05-15 14:52:37 +00:00
2021-01-24 14:06:55 +00:00
virtual void LoadModel(void *model, const void *chunk) = 0;
2021-01-23 23:07:45 +00:00
virtual void DeleteChunk(void);
2021-01-24 12:40:33 +00:00
// this writes the modelinfo struct, possibly including actual RW models
2021-01-23 23:07:45 +00:00
virtual void Write(base::cRelocatableChunkWriter &writer);
2021-01-24 12:40:33 +00:00
// this writes the RW models
virtual void *WriteModel(base::cRelocatableChunkWriter &writer) { return nil; } // = 0; // this is not in the vtable for some reason???
// these allocate the space for a modelinfo struct and patch the vtable pointer
2021-01-24 14:06:55 +00:00
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer) = 0;
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer) = 0;
2021-01-23 23:07:45 +00:00
2020-05-05 12:06:55 +00:00
// one day it becomes virtual
2020-12-07 00:59:17 +00:00
uint8 GetModelType() const { return m_type; }
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; }
2021-01-08 19:53:11 +00:00
char *GetModelName(void) { return m_name; }
void SetModelName(const char *name);
uint32 GetNameHashKey() { return m_nameKey; }
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);
2021-01-23 23:07:45 +00:00
void AddTexDictionaryRefGu(void);
2019-05-15 14:52:37 +00:00
void RemoveTexDictionaryRef(void);
2021-01-23 23:07:45 +00:00
void RemoveTexDictionaryRefGu(void);
2019-05-15 14:52:37 +00:00
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
};