diff options
Diffstat (limited to '')
-rw-r--r-- | src/control/SceneEdit.cpp | 5 | ||||
-rw-r--r-- | src/control/Script.cpp | 2 | ||||
-rw-r--r-- | src/core/AnimViewer.cpp | 14 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 4 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 47 | ||||
-rw-r--r-- | src/entities/Building.cpp | 2 | ||||
-rw-r--r-- | src/entities/Entity.cpp | 6 | ||||
-rw-r--r-- | src/modelinfo/BaseModelInfo.h | 7 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 4 | ||||
-rw-r--r-- | src/modelinfo/TimeModelInfo.cpp | 2 | ||||
-rw-r--r-- | src/objects/Object.cpp | 2 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 16 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 10 | ||||
-rw-r--r-- | src/rw/VisibilityPlugins.cpp | 4 |
14 files changed, 62 insertions, 63 deletions
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index cf6cc4f6..c8b4242e 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -84,12 +84,11 @@ static int32 NextValidModelId(int32 mi, int32 step) CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo; if (!pInfo) continue; - if (pInfo->m_type == MITYPE_PED + if (pInfo->GetModelType() == MITYPE_PED #ifdef FIX_BUGS && !(i >= MI_SPECIAL01 && i <= MI_SPECIAL04) #endif - || - pInfo->m_type == MITYPE_VEHICLE && + || pInfo->GetModelType() == MITYPE_VEHICLE && #ifdef FIX_BUGS (pVehicleInfo->m_vehicleType == VEHICLE_TYPE_CAR || pVehicleInfo->m_vehicleType == VEHICLE_TYPE_BOAT)) #else // && and || priority failure it seems, also crashes on special models diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 7906b3e7..2bb945d3 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -8074,7 +8074,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) continue; // desperatly want to believe this was inlined :| CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(model); - assert(pInfo->m_type == MITYPE_VEHICLE); + assert(pInfo->GetModelType() == MITYPE_VEHICLE); CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo; if (pVehicleInfo->m_vehicleType != VEHICLE_TYPE_CAR) { switch (model) { 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; diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp index aad2d402..3c096636 100644 --- a/src/entities/Building.cpp +++ b/src/entities/Building.cpp @@ -12,7 +12,7 @@ CBuilding::ReplaceWithNewModel(int32 id) { DeleteRwObject(); - if(CModelInfo::GetModelInfo(m_modelIndex)->m_refCount == 0) + if (CModelInfo::GetModelInfo(m_modelIndex)->GetNumRefs() == 0) CStreaming::RemoveModel(m_modelIndex); m_modelIndex = id; diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 2a6211d6..4e4c9dbc 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -452,7 +452,7 @@ CEntity::PreRender(void) break; } - if(CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects != 0) + if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0) ProcessLightsForEntity(); } @@ -611,7 +611,7 @@ CEntity::AddSteamsFromGround(CVector *unused) C2dEffect *effect; CVector pos; - n = CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects; + n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); for(i = 0; i < n; i++){ effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); if(effect->type != EFFECT_PARTICLE) @@ -654,7 +654,7 @@ CEntity::ProcessLightsForEntity(void) flashTimer2 = 0; flashTimer3 = 0; - n = CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects; + n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects(); for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){ effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index 0c4bf934..f767e0e7 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -22,18 +22,17 @@ class C2dEffect; class CBaseModelInfo { protected: - // TODO?: make more things protected char m_name[MAX_MODEL_NAME]; CColModel *m_colModel; C2dEffect *m_twodEffects; int16 m_objectId; -public: uint16 m_refCount; int16 m_txdSlot; ModeInfoType m_type; uint8 m_num2dEffects; bool m_freeCol; +public: CBaseModelInfo(ModeInfoType type); virtual ~CBaseModelInfo() {} virtual void Shutdown(void); @@ -42,6 +41,8 @@ public: virtual RwObject *CreateInstance(void) = 0; virtual RwObject *GetRwObject(void) = 0; + // one day it becomes virtual + ModeInfoType GetModelType() const { return m_type; } bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; } bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE || m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck @@ -64,6 +65,8 @@ public: void Init2dEffects(void); void Add2dEffect(C2dEffect *fx); C2dEffect *Get2dEffect(int n); + uint8 GetNum2dEffects() const { return m_num2dEffects; } + uint16 GetNumRefs() const { return m_refCount; } }; static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index c1ae692f..da09bdfa 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -203,14 +203,14 @@ CModelInfo::GetModelInfo(const char *name, int *id) bool CModelInfo::IsBoatModel(int32 id) { - return GetModelInfo(id)->m_type == MITYPE_VEHICLE && + return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE && ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT; } bool CModelInfo::IsBikeModel(int32 id) { - return GetModelInfo(id)->m_type == MITYPE_VEHICLE && + return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE && ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE; } diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp index fec3f6e5..d4f92293 100644 --- a/src/modelinfo/TimeModelInfo.cpp +++ b/src/modelinfo/TimeModelInfo.cpp @@ -22,7 +22,7 @@ CTimeModelInfo::FindOtherTimeModel(void) for(i = 0; i < MODELINFOSIZE; i++){ CBaseModelInfo *mi = CModelInfo::GetModelInfo(i); - if(mi && mi->m_type == MITYPE_TIME && + if (mi && mi->GetModelType() == MITYPE_TIME && strncmp(name, mi->GetName(), 24) == 0){ m_otherTimeModelID = i; return (CTimeModelInfo*)mi; diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 1587749d..ab1290b0 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -125,7 +125,7 @@ CObject::Render(void) if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){ CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nRefModelIndex); - assert(mi->m_type == MITYPE_VEHICLE); + assert(mi->GetModelType() == MITYPE_VEHICLE); mi->SetVehicleColour(m_colour1, m_colour2); } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 97a436fb..56a18dab 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -8870,8 +8870,8 @@ CPed::LookForInterestingNodes(void) for (ptrNode = sector->m_lists[ENTITYLIST_VEHICLES].first; ptrNode && !found; ptrNode = ptrNode->next) { CVehicle *veh = (CVehicle*)ptrNode->item; model = veh->GetModelInfo(); - if (model->m_num2dEffects != 0) { - for (int e = 0; e < model->m_num2dEffects; e++) { + if (model->GetNum2dEffects() != 0) { + for (int e = 0; e < model->GetNum2dEffects(); e++) { effect = model->Get2dEffect(e); if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { objMat = &veh->GetMatrix(); @@ -8888,8 +8888,8 @@ CPed::LookForInterestingNodes(void) for (ptrNode = sector->m_lists[ENTITYLIST_OBJECTS].first; ptrNode && !found; ptrNode = ptrNode->next) { CObject *obj = (CObject*)ptrNode->item; model = CModelInfo::GetModelInfo(obj->GetModelIndex()); - if (model->m_num2dEffects != 0) { - for (int e = 0; e < model->m_num2dEffects; e++) { + if (model->GetNum2dEffects() != 0) { + for (int e = 0; e < model->GetNum2dEffects(); e++) { effect = model->Get2dEffect(e); if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { objMat = &obj->GetMatrix(); @@ -8906,8 +8906,8 @@ CPed::LookForInterestingNodes(void) for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS].first; ptrNode && !found; ptrNode = ptrNode->next) { CBuilding *building = (CBuilding*)ptrNode->item; model = CModelInfo::GetModelInfo(building->GetModelIndex()); - if (model->m_num2dEffects != 0) { - for (int e = 0; e < model->m_num2dEffects; e++) { + if (model->GetNum2dEffects() != 0) { + for (int e = 0; e < model->GetNum2dEffects(); e++) { effect = model->Get2dEffect(e); if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { objMat = &building->GetMatrix(); @@ -8924,8 +8924,8 @@ CPed::LookForInterestingNodes(void) for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first; ptrNode && !found; ptrNode = ptrNode->next) { CBuilding *building = (CBuilding*)ptrNode->item; model = CModelInfo::GetModelInfo(building->GetModelIndex()); - if (model->m_num2dEffects != 0) { - for (int e = 0; e < model->m_num2dEffects; e++) { + if (model->GetNum2dEffects() != 0) { + for (int e = 0; e < model->GetNum2dEffects(); e++) { effect = model->Get2dEffect(e); if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { objMat = &building->GetMatrix(); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 4325b78a..07cfe780 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -334,7 +334,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent) float dist; bool request = true; - if(mi->m_type == MITYPE_TIME){ + if (mi->GetModelType() == MITYPE_TIME) { ti = (CTimeModelInfo*)mi; other = ti->GetOtherTimeModel(); if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){ @@ -350,7 +350,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent) request = false; } }else{ - if(mi->m_type != MITYPE_SIMPLE){ + if (mi->GetModelType() != MITYPE_SIMPLE) { if(FindPlayerVehicle() == ent && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ // Player's vehicle in first person mode @@ -482,7 +482,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent) CTimeModelInfo *ti; int32 other; - if(mi->m_type == MITYPE_TIME){ + if (mi->GetModelType() == MITYPE_TIME) { ti = (CTimeModelInfo*)mi; other = ti->GetOtherTimeModel(); // Hide objects not in time range if possible @@ -490,7 +490,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent) if(!CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())) return 0; // Draw like normal - }else if(mi->m_type == MITYPE_VEHICLE) + } else if (mi->GetModelType() == MITYPE_VEHICLE) return ent->IsVisible(); float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude(); @@ -507,7 +507,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent) // But if it is a time object, we'd rather draw the wrong // non-LOD than the right LOD. - if(nonLOD->m_type == MITYPE_TIME){ + if (nonLOD->GetModelType() == MITYPE_TIME) { ti = (CTimeModelInfo*)nonLOD; other = ti->GetOtherTimeModel(); if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject()) diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 0bed30e4..b1a101e3 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -718,7 +718,7 @@ CVisibilityPlugins::SetAtomicModelInfo(RpAtomic *atomic, { AtomicExt *ext = ATOMICEXT(atomic); ext->modelInfo = modelInfo; - switch(modelInfo->m_type) + switch (modelInfo->GetModelType()) case MITYPE_SIMPLE: case MITYPE_TIME: if(modelInfo->m_normalCull) @@ -828,7 +828,7 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo SetFrameHierarchyId(RpClumpGetFrame(clump), (int32)modelInfo); // Unused - switch(modelInfo->m_type){ + switch (modelInfo->GetModelType()) { // ignore MLO case MITYPE_VEHICLE: vmi = (CVehicleModelInfo*)modelInfo; |