Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-05-10 12:37:43 +03:00
commit 1f3f82eedc
4 changed files with 22 additions and 11 deletions

View file

@ -642,7 +642,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
for(id = minID; id <= maxID; id++){ for(id = minID; id <= maxID; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id); CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsBuilding()) if(mi && mi->IsBuilding())
mi->SetupBigBuilding(); mi->SetupBigBuilding(minID, maxID);
} }
} }

View file

@ -7,6 +7,8 @@
#include "ModelInfo.h" #include "ModelInfo.h"
#include "AnimManager.h" #include "AnimManager.h"
//--MIAMI: file done
void void
CClumpModelInfo::DeleteRwObject(void) CClumpModelInfo::DeleteRwObject(void)
{ {

View file

@ -3,6 +3,9 @@
#include "General.h" #include "General.h"
#include "Camera.h" #include "Camera.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "AnimManager.h"
//--MIAMI: file done
#define LOD_DISTANCE (300.0f) #define LOD_DISTANCE (300.0f)
@ -18,6 +21,8 @@ CSimpleModelInfo::DeleteRwObject(void)
RwFrameDestroy(f); RwFrameDestroy(f);
m_atomics[i] = nil; m_atomics[i] = nil;
RemoveTexDictionaryRef(); RemoveTexDictionaryRef();
if(GetAnimFileIndex() != -1)
CAnimManager::RemoveAnimBlockRef(GetAnimFileIndex());
} }
} }
@ -75,10 +80,14 @@ CSimpleModelInfo::SetAtomic(int n, RpAtomic *atomic)
{ {
AddTexDictionaryRef(); AddTexDictionaryRef();
m_atomics[n] = atomic; m_atomics[n] = atomic;
if(m_ignoreLight){ if(GetAnimFileIndex() != -1)
RpGeometry *geo = RpAtomicGetGeometry(atomic); CAnimManager::AddAnimBlockRef(GetAnimFileIndex());
RpGeometry *geo = RpAtomicGetGeometry(atomic);
if(m_ignoreLight)
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) & ~rpGEOMETRYLIGHT); RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) & ~rpGEOMETRYLIGHT);
} if(RpGeometryGetFlags(geo) & rpGEOMETRYNORMALS &&
RpGeometryGetNumTriangles(geo) > 200)
debug("%s has %d polys\n", m_name, RpGeometryGetNumTriangles(geo));
} }
void void
@ -143,11 +152,11 @@ CSimpleModelInfo::GetFirstAtomicFromDistance(float dist)
} }
void void
CSimpleModelInfo::FindRelatedModel(void) CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID)
{ {
int i; int i;
CBaseModelInfo *mi; CBaseModelInfo *mi;
for(i = 0; i < MODELINFOSIZE; i++){ for(i = minID; i <= maxID; i++){
mi = CModelInfo::GetModelInfo(i); mi = CModelInfo::GetModelInfo(i);
if(mi && mi != this && if(mi && mi != this &&
!CGeneral::faststrcmp(GetName()+3, mi->GetName()+3)){ !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 #define NEAR_DRAW_DIST 0.0f // 100.0f in liberty city
void void
CSimpleModelInfo::SetupBigBuilding(void) CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID)
{ {
CSimpleModelInfo *related; CSimpleModelInfo *related;
if(m_lodDistances[0] > LOD_DISTANCE && m_atomics[2] == nil){ if(m_lodDistances[0] > LOD_DISTANCE && GetRelatedModel() == nil){
m_isBigBuilding = 1; m_isBigBuilding = 1;
FindRelatedModel(); FindRelatedModel(minID, maxID);
related = GetRelatedModel(); related = GetRelatedModel();
if(related){ if(related){
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier; m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;

View file

@ -48,8 +48,8 @@ public:
float GetLargestLodDistance(void); float GetLargestLodDistance(void);
RpAtomic *GetAtomicFromDistance(float dist); RpAtomic *GetAtomicFromDistance(float dist);
RpAtomic *GetFirstAtomicFromDistance(float dist); RpAtomic *GetFirstAtomicFromDistance(float dist);
void FindRelatedModel(void); void FindRelatedModel(int32 minID, int32 maxID);
void SetupBigBuilding(void); void SetupBigBuilding(int32 minID, int32 maxID);
void SetNumAtomics(int n) { m_numAtomics = n; } void SetNumAtomics(int n) { m_numAtomics = n; }
CSimpleModelInfo *GetRelatedModel(void){ CSimpleModelInfo *GetRelatedModel(void){