modelinfo bits

This commit is contained in:
aap 2021-08-24 19:16:17 +02:00
parent b89dd7f0e3
commit 5f7de20cde
4 changed files with 9 additions and 7 deletions

View file

@ -132,7 +132,7 @@ GetModelFromName(const char *name)
}
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
for (i = 0; i < MODELINFOSIZE; i++) {
for (i = 0; i < CModelInfo::GetNumModelInfos(); i++) {
mi = CModelInfo::GetModelInfo(i);
if (mi && mi->GetRwObject()
&& RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&

View file

@ -92,7 +92,7 @@ CAnimViewer::Initialise(void) {
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
CFileLoader::LoadLevel("DATA\\ANIMVIEWER.DAT");
CStreaming::Init();
for(int i = 0; i < MODELINFOSIZE; i++)
for(int i = 0; i < CModelInfo::GetNumModelInfos(); i++)
if(CModelInfo::GetModelInfo(i))
CModelInfo::GetModelInfo(i)->ConvertAnimFileIndex();
CStreaming::LoadInitialPeds();
@ -166,7 +166,7 @@ LastPedModelId(int modelId)
{
CBaseModelInfo *model;
for(;;){
assert(modelId < MODELINFOSIZE);
assert(modelId < CModelInfo::GetNumModelInfos());
model = CModelInfo::GetModelInfo(modelId);
if (model && model->GetModelType() == MITYPE_PED)
break;
@ -180,7 +180,7 @@ FirstCarModelId(int modelId)
{
CBaseModelInfo *model;
for(;;){
assert(modelId < MODELINFOSIZE);
assert(modelId < CModelInfo::GetNumModelInfos());
model = CModelInfo::GetModelInfo(modelId);
if (model && model->GetModelType() == MITYPE_VEHICLE)
break;
@ -200,7 +200,7 @@ NextModelId(int modelId, int wantedChange)
while(tryCount != 0) {
modelId += wantedChange;
if (modelId < 0 || modelId >= MODELINFOSIZE) {
if (modelId < 0 || modelId >= CModelInfo::GetNumModelInfos()) {
tryCount--;
wantedChange = -wantedChange;
} else if (modelId != 5 && modelId != 6 && modelId != 405) {

View file

@ -180,7 +180,7 @@ CStreaming::Init2(void)
// init stream info, mark things that are already loaded
for(i = 0; i < MODELINFOSIZE; i++){
for(i = 0; i < CModelInfo::GetNumModelInfos(); i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject()){
ms_aInfoForModel[i].m_loadState = STREAMSTATE_LOADED;

View file

@ -25,10 +25,11 @@ class CModelInfo
static CStore<CVehicleModelInfo, VEHICLEMODELSIZE> ms_vehicleModelStore;
static CStore<C2dEffect, TWODFXSIZE> ms_2dEffectStore;
public:
// these fields are in the resource image
int32 resNumModelInfos;
CBaseModelInfo **resModelInfoPtrs;
public:
static void Initialise(void);
static void ShutDown(void);
@ -43,6 +44,7 @@ public:
static C2dEffect *Get2dEffect(int32 id) { return &gp2dEffects[id]; }
static int32 Get2dEffectIndex(C2dEffect *effect) { return effect - gp2dEffects; }
static int32 GetNumModelInfos(void) { return msNumModelInfos; }
static CBaseModelInfo *GetModelInfo(const char *name, int *id);
static CBaseModelInfo *GetModelInfo(int id){
if(id < 0 || id >= msNumModelInfos)