summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/FileLoader.cpp2
-rw-r--r--src/modelinfo/SimpleModelInfo.h2
-rw-r--r--src/modelinfo/TimeModelInfo.cpp29
-rw-r--r--src/modelinfo/TimeModelInfo.h9
-rw-r--r--src/modelinfo/WeaponModelInfo.cpp22
-rw-r--r--src/modelinfo/WeaponModelInfo.h10
6 files changed, 64 insertions, 10 deletions
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index eed12e58..10f504c9 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -809,7 +809,7 @@ CFileLoader::LoadTimeObject(const char *line)
mi->m_firstDamaged = damaged;
mi->SetTimes(timeOn, timeOff);
mi->SetTexDictionary(txd);
- other = mi->FindOtherTimeModel();
+ other = mi->FindOtherTimeModel(model);
if(other)
other->SetOtherTimeModel(id);
MatchModelString(model, id);
diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h
index 11f95633..f9191944 100644
--- a/src/modelinfo/SimpleModelInfo.h
+++ b/src/modelinfo/SimpleModelInfo.h
@@ -57,7 +57,7 @@ public:
virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
- virtual void SetAtomic(int n, RpAtomic *atomic); // TODO: remove this
+ /*virtual*/ void SetAtomic(int n, RpAtomic *atomic);
void Init(void);
void IncreaseAlpha(void);
diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp
index 0db5fb78..85b59e43 100644
--- a/src/modelinfo/TimeModelInfo.cpp
+++ b/src/modelinfo/TimeModelInfo.cpp
@@ -3,15 +3,20 @@
#include "Camera.h"
#include "ModelInfo.h"
#include "General.h"
+#include "KeyGen.h"
+
+base::cRelocatableChunkClassInfo CTimeModelInfo::msClassInfo("CTimeModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
+CTimeModelInfo CTimeModelInfo::msClassInstance;
+
CTimeModelInfo*
-CTimeModelInfo::FindOtherTimeModel(void)
+CTimeModelInfo::FindOtherTimeModel(const char *modelname)
{
char name[40];
char *p;
int i;
- strcpy(name, GetModelName());
+ strcpy(name, modelname);
// change _nt to _dy
if(p = strstr(name, "_nt"))
strncpy(p, "_dy", 4);
@@ -21,13 +26,29 @@ CTimeModelInfo::FindOtherTimeModel(void)
else
return nil;
+ uint32 nameKey = CKeyGen::GetUppercaseKey(name);
+
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
- if (mi && mi->GetModelType() == MITYPE_TIME &&
- !CGeneral::faststrncmp(name, mi->GetModelName(), MAX_MODEL_NAME)){
+ if (mi && mi->GetModelType() == MITYPE_TIME && nameKey == mi->GetNameHashKey()){
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;
}
}
return nil;
}
+
+
+void
+CTimeModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
+
+void
+CTimeModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h
index 6e3c64fb..67273b21 100644
--- a/src/modelinfo/TimeModelInfo.h
+++ b/src/modelinfo/TimeModelInfo.h
@@ -7,14 +7,21 @@ class CTimeModelInfo : public CSimpleModelInfo
int32 m_timeOn;
int32 m_timeOff;
int32 m_otherTimeModelID;
+
+ static base::cRelocatableChunkClassInfo msClassInfo;
+ static CTimeModelInfo msClassInstance;
+
public:
CTimeModelInfo(void) : CSimpleModelInfo(MITYPE_TIME) { m_otherTimeModelID = -1; }
+ virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
+ virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
+
int32 GetTimeOn(void) { return m_timeOn; }
int32 GetTimeOff(void) { return m_timeOff; }
void SetTimes(int32 on, int32 off) { m_timeOn = on; m_timeOff = off; }
int32 GetOtherTimeModel(void) { return m_otherTimeModelID; }
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
- CTimeModelInfo *FindOtherTimeModel(void);
+ CTimeModelInfo *FindOtherTimeModel(const char *name);
};
//static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
diff --git a/src/modelinfo/WeaponModelInfo.cpp b/src/modelinfo/WeaponModelInfo.cpp
index d9294c3f..1d194ec4 100644
--- a/src/modelinfo/WeaponModelInfo.cpp
+++ b/src/modelinfo/WeaponModelInfo.cpp
@@ -4,6 +4,9 @@
#include "AnimManager.h"
#include "VisibilityPlugins.h"
+base::cRelocatableChunkClassInfo CWeaponModelInfo::msClassInfo("CWeaponModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
+CWeaponModelInfo CWeaponModelInfo::msClassInstance;
+
void
CWeaponModelInfo::SetAnimFile(const char *file)
{
@@ -35,19 +38,34 @@ CWeaponModelInfo::Init(void)
void
CWeaponModelInfo::SetWeaponInfo(int32 weaponId)
{
- m_atomics[2] = (RpAtomic*)weaponId;
+ m_relatedModel = (CSimpleModelInfo*)weaponId;
}
eWeaponType
CWeaponModelInfo::GetWeaponInfo(void)
{
- return (eWeaponType)(uintptr)m_atomics[2];
+ return (eWeaponType)(uintptr)m_relatedModel;
}
+/*
void
CWeaponModelInfo::SetAtomic(int n, RpAtomic *atomic)
{
CSimpleModelInfo::SetAtomic(n, atomic);
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderWeaponCB);
}
+*/
+
+void
+CWeaponModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
+void
+CWeaponModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
diff --git a/src/modelinfo/WeaponModelInfo.h b/src/modelinfo/WeaponModelInfo.h
index 548bf8a6..8dc9baf1 100644
--- a/src/modelinfo/WeaponModelInfo.h
+++ b/src/modelinfo/WeaponModelInfo.h
@@ -9,13 +9,21 @@ class CWeaponModelInfo : public CSimpleModelInfo
int32 m_animFileIndex;
char *m_animFileName;
};
+
+ static base::cRelocatableChunkClassInfo msClassInfo;
+ static CWeaponModelInfo msClassInstance;
+
public:
CWeaponModelInfo(void) : CSimpleModelInfo(MITYPE_WEAPON) { m_animFileIndex = -1; }
virtual void SetAnimFile(const char *file);
virtual void ConvertAnimFileIndex(void);
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
- virtual void SetAtomic(int n, RpAtomic *atomic);
+
+ virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
+ virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
+
+ //virtual void SetAtomic(int n, RpAtomic *atomic);
void Init(void);
void SetWeaponInfo(int32 weaponId);