summaryrefslogtreecommitdiffstats
path: root/src/core/Streaming.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/Streaming.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index f1aa4cc5..d212dd05 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -553,7 +553,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(mi->IsSimple()){
success = CFileLoader::LoadAtomicFile(stream, streamId);
- }else if(mi->m_type == MITYPE_VEHICLE){
+ } else if (mi->GetModelType() == MITYPE_VEHICLE) {
// load vehicles in two parts
CModelInfo::GetModelInfo(streamId)->AddRef();
success = CFileLoader::StartLoadClumpFile(stream, streamId);
@@ -634,7 +634,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(streamId < STREAM_OFFSET_TXD){
// Model
// Vehicles and Peds not in loaded list
- if(mi->m_type != MITYPE_VEHICLE && mi->m_type != MITYPE_PED){
+ if (mi->GetModelType() != MITYPE_VEHICLE && mi->GetModelType() != MITYPE_PED) {
CSimpleModelInfo *smi = (CSimpleModelInfo*)mi;
// Set fading for some objects
@@ -1080,7 +1080,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){
e->DeleteRwObject();
- if(mi->m_refCount == 0)
+ if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex());
}
}
@@ -1093,7 +1093,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){
e->DeleteRwObject();
- if(mi->m_refCount == 0)
+ if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex());
}
}
@@ -1106,7 +1106,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered && ((CObject*)e)->ObjectCreatedBy == GAME_OBJECT){
e->DeleteRwObject();
- if(mi->m_refCount == 0)
+ if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex());
}
}
@@ -1119,7 +1119,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){
e->DeleteRwObject();
- if(mi->m_refCount == 0)
+ if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex());
}
}
@@ -1211,7 +1211,7 @@ CStreaming::RemoveBigBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){
e->DeleteRwObject();
- if(mi->m_refCount == 0)
+ if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex());
}
}
@@ -1229,8 +1229,7 @@ CStreaming::RemoveLoadedVehicle(void)
ms_lastVehicleDeleted = 0;
id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 &&
- (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 &&
- CModelInfo::GetModelInfo(id)->m_refCount == 0 &&
+ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0 &&
ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED)
goto found;
}
@@ -1251,7 +1250,7 @@ CStreaming::RemoveLeastUsedModel(void)
for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){
streamId = si - ms_aInfoForModel;
if(streamId < STREAM_OFFSET_TXD){
- if(CModelInfo::GetModelInfo(streamId)->m_refCount == 0){
+ if (CModelInfo::GetModelInfo(streamId)->GetNumRefs() == 0) {
RemoveModel(streamId);
return true;
}
@@ -1277,7 +1276,7 @@ CStreaming::RemoveAllUnusedModels(void)
for(i = NUM_DEFAULT_MODELS; i < MODELINFOSIZE; i++){
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED &&
ms_aInfoForModel[i].m_flags & STREAMFLAGS_DONT_REMOVE &&
- CModelInfo::GetModelInfo(i)->m_refCount == 0){
+ CModelInfo::GetModelInfo(i)->GetNumRefs() == 0) {
RemoveModel(i);
ms_aInfoForModel[i].m_loadState = STREAMSTATE_NOTLOADED;
}
@@ -1368,8 +1367,7 @@ CStreaming::AddToLoadedVehiclesList(int32 modelId)
for(i = 0; i < MAXVEHICLESLOADED; i++){
id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 &&
- (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 &&
- CModelInfo::GetModelInfo(id)->m_refCount == 0)
+ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0)
goto found;
ms_lastVehicleDeleted++;
if(ms_lastVehicleDeleted == MAXVEHICLESLOADED)
@@ -1443,7 +1441,7 @@ void
CStreaming::SetModelIsDeletable(int32 id)
{
ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE;
- if((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->m_type != MITYPE_VEHICLE) &&
+ if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){
if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
RemoveModel(id);
@@ -1462,7 +1460,7 @@ void
CStreaming::SetMissionDoesntRequireModel(int32 id)
{
ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_SCRIPTOWNED;
- if((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->m_type != MITYPE_VEHICLE) &&
+ if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_DONT_REMOVE) == 0){
if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
RemoveModel(id);
@@ -1877,8 +1875,8 @@ CStreaming::RequestModelStream(int32 ch)
// Can't load certain combinations of files together
if(streamId < STREAM_OFFSET_TXD){
- if(havePed && CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_PED ||
- haveBigFile && CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_VEHICLE ||
+ if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED ||
+ haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE ||
!TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
break;
}else{
@@ -1897,9 +1895,9 @@ CStreaming::RequestModelStream(int32 ch)
break;
}
if(streamId < STREAM_OFFSET_TXD){
- if(CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_PED)
+ if (CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED)
havePed = 1;
- if(CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_VEHICLE)
+ if (CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE)
haveBigFile = 1;
}else{
if(size > 200)
@@ -1957,8 +1955,7 @@ CStreaming::ProcessLoadingChannel(int32 ch)
continue;
cdsize = ms_aInfoForModel[id].GetCdSize();
- if(id < STREAM_OFFSET_TXD &&
- CModelInfo::GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
+ if(id < STREAM_OFFSET_TXD && CModelInfo::GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
ms_numVehiclesLoaded >= desiredNumVehiclesLoaded &&
!RemoveLoadedVehicle() &&
((ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 || GetAvailableVehicleSlot() == -1)){
@@ -2231,7 +2228,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
if(!e->bStreamingDontDelete && !e->bIsSubway &&
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
- if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
+ if (mi->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())) {
lodDistSq = sq(mi->GetLargestLodDistance());
lodDistSq = Min(lodDistSq, sq(STREAM_DIST));
pos = CVector2D(e->GetPosition());
@@ -2263,7 +2260,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list)
if(!e->bStreamingDontDelete && !e->bIsSubway &&
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
- if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff()))
+ if (mi->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff()))
#ifdef GTA_ZONECULL
if(CRenderer::IsEntityCullZoneVisible(e))
#endif
@@ -2631,7 +2628,7 @@ CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
if(!e->bStreamingDontDelete && !e->bImBeingRendered &&
e->m_rwObject && ms_aInfoForModel[e->GetModelIndex()].m_next){
e->DeleteRwObject();
- if(CModelInfo::GetModelInfo(e->GetModelIndex())->m_refCount == 0){
+ if (CModelInfo::GetModelInfo(e->GetModelIndex())->GetNumRefs() == 0) {
RemoveModel(e->GetModelIndex());
if(ms_memoryUsed < mem)
return true;
@@ -2652,7 +2649,7 @@ CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem)
if(!e->bStreamingDontDelete && !e->bImBeingRendered &&
e->m_rwObject && !e->IsVisible() && ms_aInfoForModel[e->GetModelIndex()].m_next){
e->DeleteRwObject();
- if(CModelInfo::GetModelInfo(e->GetModelIndex())->m_refCount == 0){
+ if (CModelInfo::GetModelInfo(e->GetModelIndex())->GetNumRefs() == 0) {
RemoveModel(e->GetModelIndex());
if(ms_memoryUsed < mem)
return true;