summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 14:06:55 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-05 14:06:55 +0200
commit4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9 (patch)
tree2f970e7b4fc457d3312b8ee3fef2d0de72f6fff8 /src/core
parentMore use of GetModelIndex (diff)
downloadre3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.gz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.bz2
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.lz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.xz
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.tar.zst
re3-4cc1bb92e74eaabe9d5ef3d20fb658d577699fa9.zip
Diffstat (limited to '')
-rw-r--r--src/core/AnimViewer.cpp14
-rw-r--r--src/core/FileLoader.cpp4
-rw-r--r--src/core/Streaming.cpp47
3 files changed, 31 insertions, 34 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 992dffb5..00d39066 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -148,7 +148,7 @@ LastPedModelId(int modelId)
CBaseModelInfo *model;
for (int i = modelId; i >= 0; i--) {
model = CModelInfo::GetModelInfo(i);
- if (model->m_type == MITYPE_PED)
+ if (model->GetModelType() == MITYPE_PED)
return i;
}
return modelId;
@@ -160,7 +160,7 @@ LastVehicleModelId(int modelId)
CBaseModelInfo* model;
for (int i = modelId; i >= 0; i--) {
model = CModelInfo::GetModelInfo(i);
- if (model->m_type == MITYPE_VEHICLE)
+ if (model->GetModelType() == MITYPE_VEHICLE)
return i;
}
return modelId;
@@ -222,7 +222,7 @@ CAnimViewer::Update(void)
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
CEntity *newEntity = nil;
- if (modelInfo->m_type == MITYPE_PED) {
+ if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
if (animId > ANIM_IDLE_STANCE)
@@ -257,7 +257,7 @@ CAnimViewer::Update(void)
if (!pTarget) {
- if (modelInfo->m_type == MITYPE_VEHICLE) {
+ if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
if (veh->m_vehicleType != VEHICLE_TYPE_CAR) {
@@ -281,7 +281,7 @@ CAnimViewer::Update(void)
newEntity->SetStatus(STATUS_ABANDONED);
}
newEntity->bIsStuck = true;
- } else if (modelInfo->m_type == MITYPE_PED) {
+ } else if (modelInfo->GetModelType() == MITYPE_PED) {
pTarget = newEntity = new CPed(PEDTYPE_CIVMALE);
newEntity->SetModelIndex(modelId);
} else {
@@ -301,9 +301,9 @@ CAnimViewer::Update(void)
}
pTarget->GetMatrix().GetPosition().z = 0.0f;
- if (modelInfo->m_type != MITYPE_PED) {
+ if (modelInfo->GetModelType() != MITYPE_PED) {
- if (modelInfo->m_type == MITYPE_VEHICLE) {
+ if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
nextModelId = LastPedModelId(modelId);
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index b7d82089..8e20d4f3 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -384,7 +384,7 @@ CFileLoader::LoadClumpFile(RwStream *stream, uint32 id)
return false;
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id);
mi->SetClump(clump);
- if(mi->m_type == MITYPE_PED && id != 0 && RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){
+ if (mi->GetModelType() == MITYPE_PED && id != 0 && RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)) {
// Read LOD ped
clump = RpClumpStreamRead(stream);
if(clump){
@@ -1325,7 +1325,7 @@ CFileLoader::ReloadObject(const char *line)
#ifdef FIX_BUGS
mi &&
#endif
- mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
+ mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
mi->SetLodDistances(dist);
SetModelInfoFlags(mi, flags);
} else {
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index a76e9038..2bd604c4 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -435,7 +435,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);
@@ -499,7 +499,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
@@ -858,7 +858,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());
}
}
@@ -871,7 +871,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());
}
}
@@ -884,7 +884,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());
}
}
@@ -897,7 +897,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());
}
}
@@ -972,7 +972,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());
}
}
@@ -990,8 +990,7 @@ CStreaming::RemoveLoadedVehicle(void)
ms_lastVehicleDeleted = 0;
id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 &&
- (ms_aInfoForModel[id].m_flags & STREAMFLAGS_NOT_IN_LIST) == 0 &&
- CModelInfo::GetModelInfo(id)->m_refCount == 0 &&
+ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_NOT_IN_LIST) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0 &&
ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED)
goto found;
}
@@ -1012,7 +1011,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;
}
@@ -1038,7 +1037,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;
}
@@ -1129,8 +1128,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_NOT_IN_LIST) == 0 &&
- CModelInfo::GetModelInfo(id)->m_refCount == 0)
+ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_NOT_IN_LIST) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0)
goto found;
ms_lastVehicleDeleted++;
if(ms_lastVehicleDeleted == MAXVEHICLESLOADED)
@@ -1202,7 +1200,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);
@@ -1221,7 +1219,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);
@@ -1599,8 +1597,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{
@@ -1619,9 +1617,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)
@@ -1679,8 +1677,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_NOT_IN_LIST) == 0 || GetAvailableVehicleSlot() == -1)){
@@ -1953,7 +1950,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());
@@ -1983,7 +1980,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()))
if(CRenderer::IsEntityCullZoneVisible(e))
RequestModel(e->GetModelIndex(), 0);
}
@@ -2349,7 +2346,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;
@@ -2370,7 +2367,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;