re3/src/modelinfo/TimeModelInfo.cpp

55 lines
1.3 KiB
C++
Raw Permalink Normal View History

2019-05-15 16:52:37 +02:00
#include "common.h"
2020-04-17 15:31:11 +02:00
2019-05-15 16:52:37 +02:00
#include "Camera.h"
#include "ModelInfo.h"
2020-12-25 14:18:48 +01:00
#include "General.h"
2021-01-24 14:06:16 +01:00
#include "KeyGen.h"
base::cRelocatableChunkClassInfo CTimeModelInfo::msClassInfo("CTimeModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
CTimeModelInfo CTimeModelInfo::msClassInstance;
2019-05-15 16:52:37 +02:00
CTimeModelInfo*
2021-01-24 14:06:16 +01:00
CTimeModelInfo::FindOtherTimeModel(const char *modelname)
2019-05-15 16:52:37 +02:00
{
char name[40];
char *p;
int i;
2021-01-24 14:06:16 +01:00
strcpy(name, modelname);
2019-05-15 16:52:37 +02:00
// change _nt to _dy
if(p = strstr(name, "_nt"))
strncpy(p, "_dy", 4);
// change _dy to _nt
else if(p = strstr(name, "_dy"))
strncpy(p, "_nt", 4);
else
return nil;
2021-01-24 14:06:16 +01:00
uint32 nameKey = CKeyGen::GetUppercaseKey(name);
2019-05-15 16:52:37 +02:00
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
2021-01-24 14:06:16 +01:00
if (mi && mi->GetModelType() == MITYPE_TIME && nameKey == mi->GetNameHashKey()){
2019-05-15 16:52:37 +02:00
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;
}
}
return nil;
}
2021-01-24 14:06:16 +01:00
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);
}