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.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
new file mode 100644
index 00000000..fadea18a
--- /dev/null
+++ b/src/modelinfo/BaseModelInfo.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#include "Collision.h"
+
+enum ModeInfoType : uint8
+{
+ MITYPE_NA = 0,
+ MITYPE_SIMPLE = 1,
+ MITYPE_MLO = 2,
+ MITYPE_TIME = 3,
+ MITYPE_CLUMP = 4,
+ MITYPE_VEHICLE = 5,
+ MITYPE_PED = 6,
+ MITYPE_XTRACOMPS = 7,
+};
+static_assert(sizeof(ModeInfoType) == 1, "ModeInfoType: error");
+
+class C2dEffect;
+
+class CBaseModelInfo
+{
+protected:
+ // TODO?: make more things protected
+ char m_name[24];
+ CColModel *m_colModel;
+ C2dEffect *m_twodEffects;
+ int16 m_objectId;
+public:
+ uint16 m_refCount;
+ int16 m_txdSlot;
+ ModeInfoType m_type;
+ uint8 m_num2dEffects;
+ bool m_freeCol;
+
+ CBaseModelInfo(ModeInfoType type);
+ 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;
+
+ bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
+ char *GetName(void) { return m_name; }
+ void SetName(const char *name) { strncpy(m_name, name, 24); }
+ void SetColModel(CColModel *col, bool free = false){
+ m_colModel = col; m_freeCol = free; }
+ CColModel *GetColModel(void) { return m_colModel; }
+ void DeleteCollisionModel(void);
+ void ClearTexDictionary(void) { m_txdSlot = -1; }
+ short GetObjectID(void) { return m_objectId; }
+ void SetObjectID(short id) { m_objectId = id; }
+ 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);
+
+ void Shutdown_(void) { this->CBaseModelInfo::Shutdown(); }
+};
+
+static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");