summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/ModelInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modelinfo/ModelInfo.cpp')
-rw-r--r--src/modelinfo/ModelInfo.cpp104
1 files changed, 55 insertions, 49 deletions
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index 4ee8e72b..961efa84 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -4,18 +4,17 @@
#include "TempColModels.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
-#include "Frontend.h"
+
+// --MIAMI: file done
CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE];
CStore<CSimpleModelInfo, SIMPLEMODELSIZE> CModelInfo::ms_simpleModelStore;
-CStore<CMloModelInfo, MLOMODELSIZE> CModelInfo::ms_mloModelStore;
-CStore<CInstance, MLOINSTANCESIZE> CModelInfo::ms_mloInstanceStore;
CStore<CTimeModelInfo, TIMEMODELSIZE> CModelInfo::ms_timeModelStore;
+CStore<CWeaponModelInfo, WEAPONMODELSIZE> CModelInfo::ms_weaponModelStore;
CStore<CClumpModelInfo, CLUMPMODELSIZE> CModelInfo::ms_clumpModelStore;
CStore<CPedModelInfo, PEDMODELSIZE> CModelInfo::ms_pedModelStore;
CStore<CVehicleModelInfo, VEHICLEMODELSIZE> CModelInfo::ms_vehicleModelStore;
-CStore<CXtraCompsModelInfo, XTRACOMPSMODELSIZE> CModelInfo::ms_xtraCompsModelStore;
CStore<C2dEffect, TWODFXSIZE> CModelInfo::ms_2dEffectStore;
void
@@ -24,14 +23,20 @@ CModelInfo::Initialise(void)
int i;
CSimpleModelInfo *m;
+ debug("sizeof SimpleModelStore %d\n", sizeof(ms_simpleModelStore));
+ debug("sizeof TimeModelStore %d\n", sizeof(ms_timeModelStore));
+ debug("sizeof WeaponModelStore %d\n", sizeof(ms_weaponModelStore));
+ debug("sizeof ClumpModelStore %d\n", sizeof(ms_clumpModelStore));
+ debug("sizeof VehicleModelStore %d\n", sizeof(ms_vehicleModelStore));
+ debug("sizeof PedModelStore %d\n", sizeof(ms_pedModelStore));
+ debug("sizeof 2deffectsModelStore %d\n", sizeof(ms_2dEffectStore));
+
for(i = 0; i < MODELINFOSIZE; i++)
ms_modelInfoPtrs[i] = nil;
ms_2dEffectStore.clear();
- ms_mloInstanceStore.clear();
- ms_xtraCompsModelStore.clear();
ms_simpleModelStore.clear();
ms_timeModelStore.clear();
- ms_mloModelStore.clear();
+ ms_weaponModelStore.clear();
ms_clumpModelStore.clear();
ms_pedModelStore.clear();
ms_vehicleModelStore.clear();
@@ -91,29 +96,23 @@ CModelInfo::ShutDown(void)
int i;
for(i = 0; i < ms_simpleModelStore.allocPtr; i++)
ms_simpleModelStore.store[i].Shutdown();
- for(i = 0; i < ms_mloInstanceStore.allocPtr; i++)
- ms_mloInstanceStore.store[i].Shutdown();
for(i = 0; i < ms_timeModelStore.allocPtr; i++)
ms_timeModelStore.store[i].Shutdown();
+ for(i = 0; i < ms_weaponModelStore.allocPtr; i++)
+ ms_weaponModelStore.store[i].Shutdown();
for(i = 0; i < ms_clumpModelStore.allocPtr; i++)
ms_clumpModelStore.store[i].Shutdown();
for(i = 0; i < ms_vehicleModelStore.allocPtr; i++)
ms_vehicleModelStore.store[i].Shutdown();
for(i = 0; i < ms_pedModelStore.allocPtr; i++)
ms_pedModelStore.store[i].Shutdown();
- for(i = 0; i < ms_xtraCompsModelStore.allocPtr; i++)
- ms_xtraCompsModelStore.store[i].Shutdown();
- for(i = 0; i < ms_mloInstanceStore.allocPtr; i++)
- ms_mloInstanceStore.store[i].Shutdown();
for(i = 0; i < ms_2dEffectStore.allocPtr; i++)
ms_2dEffectStore.store[i].Shutdown();
ms_2dEffectStore.clear();
ms_simpleModelStore.clear();
- ms_mloInstanceStore.clear();
- ms_mloModelStore.clear();
- ms_xtraCompsModelStore.clear();
ms_timeModelStore.clear();
+ ms_weaponModelStore.clear();
ms_pedModelStore.clear();
ms_clumpModelStore.clear();
ms_vehicleModelStore.clear();
@@ -129,23 +128,21 @@ CModelInfo::AddSimpleModel(int id)
return modelinfo;
}
-CMloModelInfo *
-CModelInfo::AddMloModel(int id)
+CTimeModelInfo*
+CModelInfo::AddTimeModel(int id)
{
- CMloModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_mloModelStore.alloc();
+ CTimeModelInfo *modelinfo;
+ modelinfo = CModelInfo::ms_timeModelStore.alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
- modelinfo->m_clump = nil;
- modelinfo->firstInstance = 0;
- modelinfo->lastInstance = 0;
+ modelinfo->Init();
return modelinfo;
}
-CTimeModelInfo*
-CModelInfo::AddTimeModel(int id)
+CWeaponModelInfo*
+CModelInfo::AddWeaponModel(int id)
{
- CTimeModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_timeModelStore.alloc();
+ CWeaponModelInfo *modelinfo;
+ modelinfo = CModelInfo::ms_weaponModelStore.alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -201,6 +198,21 @@ CModelInfo::GetModelInfo(const char *name, int *id)
return nil;
}
+CBaseModelInfo*
+CModelInfo::GetModelInfo(const char *name, int minIndex, int maxIndex)
+{
+ if (minIndex > maxIndex)
+ return 0;
+
+ CBaseModelInfo *modelinfo;
+ for(int i = minIndex; i <= maxIndex; i++){
+ modelinfo = CModelInfo::ms_modelInfoPtrs[i];
+ if(modelinfo && !CGeneral::faststricmp(modelinfo->GetName(), name))
+ return modelinfo;
+ }
+ return nil;
+}
+
bool
CModelInfo::IsBoatModel(int32 id)
{
@@ -215,31 +227,25 @@ CModelInfo::IsBikeModel(int32 id)
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
}
-void
-CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
-{
- ISLAND_LOADING_IS(LOW)
- {
- int i;
- CBaseModelInfo *mi;
- CColModel *colmodel;
-
- for (i = 0; i < MODELINFOSIZE; i++) {
- mi = GetModelInfo(i);
- if (mi) {
- colmodel = mi->GetColModel();
- if (colmodel && colmodel->level != LEVEL_GENERIC && colmodel->level != level)
- colmodel->RemoveCollisionVolumes();
- }
- }
- }
+bool
+CModelInfo::IsCarModel(int32 id)
+{
+ return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
+ ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_CAR;
}
-void
-CModelInfo::ConstructMloClumps()
+bool
+CModelInfo::IsHeliModel(int32 id)
{
- for (int i = 0; i < ms_mloModelStore.allocPtr; i++)
- ms_mloModelStore.store[i].ConstructClump();
+ return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
+ ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_HELI;
+}
+
+bool
+CModelInfo::IsPlaneModel(int32 id)
+{
+ return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
+ ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_PLANE;
}
void