summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 14:06:55 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-05 14:06:55 +0200
commit4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9 (patch)
tree2f970e7b4fc457d3312b8ee3fef2d0de72f6fff8 /src/modelinfo
parentMore use of GetModelIndex (diff)
downloadre3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.gz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.bz2
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.lz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.xz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.zst
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.zip
Diffstat (limited to 'src/modelinfo')
-rw-r--r--src/modelinfo/BaseModelInfo.h7
-rw-r--r--src/modelinfo/ModelInfo.cpp4
-rw-r--r--src/modelinfo/TimeModelInfo.cpp2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index 0c4bf934..f767e0e7 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -22,18 +22,17 @@ class C2dEffect;
class CBaseModelInfo
{
protected:
- // TODO?: make more things protected
char m_name[MAX_MODEL_NAME];
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;
+public:
CBaseModelInfo(ModeInfoType type);
virtual ~CBaseModelInfo() {}
virtual void Shutdown(void);
@@ -42,6 +41,8 @@ public:
virtual RwObject *CreateInstance(void) = 0;
virtual RwObject *GetRwObject(void) = 0;
+ // one day it becomes virtual
+ ModeInfoType GetModelType() const { return m_type; }
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
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
@@ -64,6 +65,8 @@ public:
void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n);
+ uint8 GetNum2dEffects() const { return m_num2dEffects; }
+ uint16 GetNumRefs() const { return m_refCount; }
};
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index c1ae692f..da09bdfa 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -203,14 +203,14 @@ CModelInfo::GetModelInfo(const char *name, int *id)
bool
CModelInfo::IsBoatModel(int32 id)
{
- return GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
+ return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT;
}
bool
CModelInfo::IsBikeModel(int32 id)
{
- return GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
+ return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
}
diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp
index fec3f6e5..d4f92293 100644
--- a/src/modelinfo/TimeModelInfo.cpp
+++ b/src/modelinfo/TimeModelInfo.cpp
@@ -22,7 +22,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
- if(mi && mi->m_type == MITYPE_TIME &&
+ if (mi && mi->GetModelType() == MITYPE_TIME &&
strncmp(name, mi->GetName(), 24) == 0){
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;