summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/modelinfo/BaseModelInfo.cpp4
-rw-r--r--src/modelinfo/BaseModelInfo.h7
-rw-r--r--src/modelinfo/ModelInfo.cpp16
-rw-r--r--src/modelinfo/ModelInfo.h3
-rw-r--r--src/modelinfo/SimpleModelInfo.cpp18
-rw-r--r--src/modelinfo/SimpleModelInfo.h5
6 files changed, 46 insertions, 7 deletions
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp
index ed1928af..a2779107 100644
--- a/src/modelinfo/BaseModelInfo.cpp
+++ b/src/modelinfo/BaseModelInfo.cpp
@@ -15,7 +15,7 @@ CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
m_txdSlot = -1;
m_type = type;
m_num2dEffects = 0;
- m_freeCol = false;
+ m_bOwnsColModel = false;
}
void
@@ -31,7 +31,7 @@ CBaseModelInfo::Shutdown(void)
void
CBaseModelInfo::DeleteCollisionModel(void)
{
- if(m_colModel && m_freeCol){
+ if(m_colModel && m_bOwnsColModel){
if(m_colModel)
delete m_colModel;
m_colModel = nil;
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index 061ebee6..9f828e7f 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -30,7 +30,7 @@ protected:
int16 m_txdSlot;
ModelInfoType m_type;
uint8 m_num2dEffects;
- bool m_freeCol;
+ bool m_bOwnsColModel;
public:
CBaseModelInfo(ModelInfoType type);
@@ -49,9 +49,10 @@ public:
}
char *GetName(void) { return m_name; }
void SetName(const char *name) { strncpy(m_name, name, 24); }
- void SetColModel(CColModel *col, bool free = false){
- m_colModel = col; m_freeCol = free; }
+ void SetColModel(CColModel *col, bool owns = false){
+ m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; }
+ bool DoesOwnColModel(void) { return m_bOwnsColModel; }
void DeleteCollisionModel(void);
void ClearTexDictionary(void) { m_txdSlot = -1; }
short GetObjectID(void) { return m_objectId; }
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index da09bdfa..62deae2b 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -200,6 +200,20 @@ CModelInfo::GetModelInfo(const char *name, int *id)
return nil;
}
+#ifdef MIAMI
+CBaseModelInfo*
+CModelInfo::GetModelInfo(const char *name, int minIndex, int maxIndex)
+{
+ 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;
+}
+#endif
+
bool
CModelInfo::IsBoatModel(int32 id)
{
@@ -214,6 +228,7 @@ CModelInfo::IsBikeModel(int32 id)
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
}
+#ifndef MIAMI
void
CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
{
@@ -230,6 +245,7 @@ CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
}
}
}
+#endif
void
CModelInfo::ConstructMloClumps()
diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h
index 65cfa4e7..dadc8f8b 100644
--- a/src/modelinfo/ModelInfo.h
+++ b/src/modelinfo/ModelInfo.h
@@ -42,6 +42,9 @@ public:
static CBaseModelInfo *GetModelInfo(int id){
return ms_modelInfoPtrs[id];
}
+#ifdef MIAMI
+ static CBaseModelInfo *GetModelInfo(const char *name, int minIndex, int maxIndex);
+#endif
static bool IsBoatModel(int32 id);
static bool IsBikeModel(int32 id);
diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp
index 2fb2adeb..63b057da 100644
--- a/src/modelinfo/SimpleModelInfo.cpp
+++ b/src/modelinfo/SimpleModelInfo.cpp
@@ -95,6 +95,12 @@ CSimpleModelInfo::IncreaseAlpha(void)
}
float
+CSimpleModelInfo::GetLodDistance(int i)
+{
+ return m_lodDistances[i] * TheCamera.LODDistMultiplier;
+}
+
+float
CSimpleModelInfo::GetNearDistance(void)
{
return m_lodDistances[2] * TheCamera.LODDistMultiplier;
@@ -119,11 +125,21 @@ CSimpleModelInfo::GetAtomicFromDistance(float dist)
if(m_isDamaged)
i = m_firstDamaged;
for(; i < m_numAtomics; i++)
- if(dist < m_lodDistances[i] *TheCamera.LODDistMultiplier)
+ if(dist < m_lodDistances[i] * TheCamera.LODDistMultiplier)
return m_atomics[i];
return nil;
}
+#ifdef MIAMI
+RpAtomic*
+CSimpleModelInfo::GetFirstAtomicFromDistance(float dist)
+{
+ if(dist < m_lodDistances[0] * TheCamera.LODDistMultiplier)
+ return m_atomics[0];
+ return nil;
+}
+#endif
+
void
CSimpleModelInfo::FindRelatedModel(void)
{
diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h
index 4435732c..451a9c00 100644
--- a/src/modelinfo/SimpleModelInfo.h
+++ b/src/modelinfo/SimpleModelInfo.h
@@ -36,10 +36,13 @@ public:
void IncreaseAlpha(void);
void SetAtomic(int n, RpAtomic *atomic);
void SetLodDistances(float *dist);
- float GetLodDistance(int i) { return m_lodDistances[i]; }
+ float GetLodDistance(int i);
float GetNearDistance(void);
float GetLargestLodDistance(void);
RpAtomic *GetAtomicFromDistance(float dist);
+#ifdef MIAMI
+ RpAtomic *GetFirstAtomicFromDistance(float dist); // inline
+#endif
void FindRelatedModel(void);
void SetupBigBuilding(void);