summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-10 11:34:26 +0200
committeraap <aap@papnet.eu>2020-05-10 11:34:26 +0200
commit58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5 (patch)
tree70341f2c6e95da7534ae22b2c979f1f55210a1bf /src/modelinfo
parentCClumpModelInfo; little fixes (diff)
downloadre3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar.gz
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar.bz2
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar.lz
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar.xz
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.tar.zst
re3-58d9e9cd5912ca68375c4bd3e57d98d30a8f32a5.zip
Diffstat (limited to 'src/modelinfo')
-rw-r--r--src/modelinfo/ClumpModelInfo.cpp2
-rw-r--r--src/modelinfo/SimpleModelInfo.cpp25
-rw-r--r--src/modelinfo/SimpleModelInfo.h4
3 files changed, 21 insertions, 10 deletions
diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp
index 2a4927a2..82241d04 100644
--- a/src/modelinfo/ClumpModelInfo.cpp
+++ b/src/modelinfo/ClumpModelInfo.cpp
@@ -7,6 +7,8 @@
#include "ModelInfo.h"
#include "AnimManager.h"
+//--MIAMI: file done
+
void
CClumpModelInfo::DeleteRwObject(void)
{
diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp
index 22024a54..a7e6d56c 100644
--- a/src/modelinfo/SimpleModelInfo.cpp
+++ b/src/modelinfo/SimpleModelInfo.cpp
@@ -3,6 +3,9 @@
#include "General.h"
#include "Camera.h"
#include "ModelInfo.h"
+#include "AnimManager.h"
+
+//--MIAMI: file done
#define LOD_DISTANCE (300.0f)
@@ -18,6 +21,8 @@ CSimpleModelInfo::DeleteRwObject(void)
RwFrameDestroy(f);
m_atomics[i] = nil;
RemoveTexDictionaryRef();
+ if(GetAnimFileIndex() != -1)
+ CAnimManager::RemoveAnimBlockRef(GetAnimFileIndex());
}
}
@@ -75,10 +80,14 @@ CSimpleModelInfo::SetAtomic(int n, RpAtomic *atomic)
{
AddTexDictionaryRef();
m_atomics[n] = atomic;
- if(m_ignoreLight){
- RpGeometry *geo = RpAtomicGetGeometry(atomic);
+ if(GetAnimFileIndex() != -1)
+ CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
+ RpGeometry *geo = RpAtomicGetGeometry(atomic);
+ if(m_ignoreLight)
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) & ~rpGEOMETRYLIGHT);
- }
+ if(RpGeometryGetFlags(geo) & rpGEOMETRYNORMALS &&
+ RpGeometryGetNumTriangles(geo) > 200)
+ debug("%s has %d polys\n", m_name, RpGeometryGetNumTriangles(geo));
}
void
@@ -143,11 +152,11 @@ CSimpleModelInfo::GetFirstAtomicFromDistance(float dist)
}
void
-CSimpleModelInfo::FindRelatedModel(void)
+CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID)
{
int i;
CBaseModelInfo *mi;
- for(i = 0; i < MODELINFOSIZE; i++){
+ for(i = minID; i <= maxID; i++){
mi = CModelInfo::GetModelInfo(i);
if(mi && mi != this &&
!CGeneral::faststrcmp(GetName()+3, mi->GetName()+3)){
@@ -161,12 +170,12 @@ CSimpleModelInfo::FindRelatedModel(void)
#define NEAR_DRAW_DIST 0.0f // 100.0f in liberty city
void
-CSimpleModelInfo::SetupBigBuilding(void)
+CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID)
{
CSimpleModelInfo *related;
- if(m_lodDistances[0] > LOD_DISTANCE && m_atomics[2] == nil){
+ if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){
m_isBigBuilding = 1;
- FindRelatedModel();
+ FindRelatedModel(minID, maxID);
related = GetRelatedModel();
if(related){
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;
diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h
index 2ebe9284..55d6149c 100644
--- a/src/modelinfo/SimpleModelInfo.h
+++ b/src/modelinfo/SimpleModelInfo.h
@@ -48,8 +48,8 @@ public:
float GetLargestLodDistance(void);
RpAtomic *GetAtomicFromDistance(float dist);
RpAtomic *GetFirstAtomicFromDistance(float dist);
- void FindRelatedModel(void);
- void SetupBigBuilding(void);
+ void FindRelatedModel(int32 minID, int32 maxID);
+ void SetupBigBuilding(int32 minID, int32 maxID);
void SetNumAtomics(int n) { m_numAtomics = n; }
CSimpleModelInfo *GetRelatedModel(void){