summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/BaseModelInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/modelinfo/BaseModelInfo.h')
-rw-r--r--src/modelinfo/BaseModelInfo.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index 2d1dc8ac..c9ea13bb 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -2,7 +2,7 @@
struct CColModel;
-#define MAX_MODEL_NAME (21)
+#define MAX_MODEL_NAME (24)
enum ModelInfoType
{
@@ -23,11 +23,19 @@ class C2dEffect;
class CBaseModelInfo
{
protected:
- char m_name[MAX_MODEL_NAME];
+ uint32 m_unk1;
+ uint32 m_unk2;
+ uint32 m_nameKey;
+ union {
+ char *m_name; // if not using chunks
+ void *m_chunk; // else
+ };
uint8 m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
+public: // need this in colstore
CColModel *m_colModel;
+protected:
int16 m_2dEffectsID;
int16 m_objectId;
uint16 m_refCount;
@@ -35,7 +43,11 @@ protected:
public:
CBaseModelInfo(ModelInfoType type);
+#ifdef FIX_BUGS
+ virtual ~CBaseModelInfo() { delete []m_name; }
+#else
virtual ~CBaseModelInfo() {}
+#endif
virtual void Shutdown(void);
virtual void DeleteRwObject(void) = 0;
virtual RwObject *CreateInstance(void) = 0;
@@ -45,13 +57,24 @@ public:
virtual void ConvertAnimFileIndex(void) {}
virtual int GetAnimFileIndex(void) { return -1; }
+ virtual void LoadModel(void *model, const void *chunk) = 0;
+ virtual void DeleteChunk(void);
+ // this writes the modelinfo struct, possibly including actual RW models
+ virtual void Write(base::cRelocatableChunkWriter &writer);
+ // 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
+ virtual void RcWriteThis(base::cRelocatableChunkWriter &writer) = 0;
+ virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer) = 0;
+
// one day it becomes virtual
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; }
char *GetModelName(void) { return m_name; }
- void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
+ void SetModelName(const char *name);
+ uint32 GetNameHashKey() { return m_nameKey; }
void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; }
@@ -65,7 +88,9 @@ public:
void RemoveRef(void);
void SetTexDictionary(const char *name);
void AddTexDictionaryRef(void);
+ void AddTexDictionaryRefGu(void);
void RemoveTexDictionaryRef(void);
+ void RemoveTexDictionaryRefGu(void);
void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n);