diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/AnimViewer.cpp | 19 | ||||
-rw-r--r-- | src/core/Cam.cpp | 20 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 6 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 4 | ||||
-rw-r--r-- | src/core/Pools.cpp | 10 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 47 | ||||
-rw-r--r-- | src/core/World.cpp | 18 |
7 files changed, 60 insertions, 64 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index b4763627..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); @@ -369,10 +369,11 @@ CAnimViewer::Update(void) if (pad->NewState.Triangle) { #ifdef PED_SKIN if(IsClumpSkinned(pTarget->GetClump())) - ((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->AnimatePedColModelSkinned(pTarget->GetClump()); + ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump()); else #endif - CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump())); + CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(), + RpClumpGetFrame(pTarget->GetClump())); AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); CMessages::AddMessage(gUString, 100, 0); } diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index b760ae28..e33e6bb0 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4639,7 +4639,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, uint8 camSetArrPos = 0; // We may need those later - bool isPlane = car->m_modelIndex == MI_DODO; + bool isPlane = car->GetModelIndex() == MI_DODO; bool isHeli = false; bool isBike = false; bool isCar = car->IsCar() && !isPlane && !isHeli && !isBike; @@ -4650,9 +4650,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, uint8 nextDirectionIsForward = !(pad->GetLookBehindForCar() || pad->GetLookBehindForPed() || pad->GetLookLeft() || pad->GetLookRight()) && DirectionWasLooking == LOOKING_FORWARD; - if (car->m_modelIndex == MI_FIRETRUCK) { + if (car->GetModelIndex() == MI_FIRETRUCK) { camSetArrPos = 7; - } else if (car->m_modelIndex == MI_RCBANDIT) { + } else if (car->GetModelIndex() == MI_RCBANDIT) { camSetArrPos = 5; } else if (car->IsBoat()) { camSetArrPos = 4; @@ -4851,7 +4851,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // This is also original LCS and SA bug, or some attempt to fix lag. We'll never know // if (car->m_vecMoveSpeed.MagnitudeSqr() < sq(0.2f)) - if (car->m_modelIndex != MI_FIRETRUCK) { + if (car->GetModelIndex() != MI_FIRETRUCK) { // if (!isBike || GetMysteriousWheelRelatedThingBike(car) > 3) // if (!isHeli && (!isPlane || car->GetWheelsOnGround())) { @@ -4907,7 +4907,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, bool correctAlpha = true; // if (SA checks if we aren't in work car, why?) { - if (!isCar || car->m_modelIndex != MI_YARDIE) { + if (!isCar || car->GetModelIndex() != MI_YARDIE) { correctAlpha = false; } else { @@ -5186,13 +5186,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // gTargetCoordsForLookingBehind = TargetCoors; // SA code from CAutomobile::TankControl/FireTruckControl. - if (car->m_modelIndex == MI_RHINO || car->m_modelIndex == MI_FIRETRUCK) { + if (car->GetModelIndex() == MI_RHINO || car->GetModelIndex() == MI_FIRETRUCK) { float &carGunLR = ((CAutomobile*)car)->m_fCarGunLR; CVector hi = Multiply3x3(Front, car->GetMatrix()); // III/VC's firetruck turret angle is reversed - float angleToFace = (car->m_modelIndex == MI_FIRETRUCK ? -hi.Heading() : hi.Heading()); + float angleToFace = (car->GetModelIndex() == MI_FIRETRUCK ? -hi.Heading() : hi.Heading()); if (angleToFace <= carGunLR + PI) { if (angleToFace < carGunLR - PI) @@ -5202,7 +5202,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } float neededTurn = angleToFace - carGunLR; - float turnPerFrame = CTimer::GetTimeStep() * (car->m_modelIndex == MI_FIRETRUCK ? 0.05f : 0.015f); + float turnPerFrame = CTimer::GetTimeStep() * (car->GetModelIndex() == MI_FIRETRUCK ? 0.05f : 0.015f); if (neededTurn <= turnPerFrame) { if (neededTurn < -turnPerFrame) angleToFace = carGunLR - turnPerFrame; @@ -5210,7 +5210,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, angleToFace = turnPerFrame + carGunLR; } - if (car->m_modelIndex == MI_RHINO && carGunLR != angleToFace) { + if (car->GetModelIndex() == MI_RHINO && carGunLR != angleToFace) { DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_TANK_TURRET_ROTATE, Abs(angleToFace - carGunLR)); } carGunLR = angleToFace; @@ -5222,7 +5222,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } // Because firetruk turret also has Y movement - if (car->m_modelIndex == MI_FIRETRUCK) { + if (car->GetModelIndex() == MI_FIRETRUCK) { float &carGunUD = ((CAutomobile*)car)->m_fCarGunUD; float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 06eb5a34..ab09d72f 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -235,7 +235,7 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot) #ifndef MIAMI if(mi->GetColModel()){ #else - if(mi->GetColModel() && mi->m_bOwnsColModel){ + if(mi->GetColModel() && mi->DoesOwnColModel()){ #endif LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname); }else{ @@ -506,7 +506,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){ @@ -1481,7 +1481,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/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 0cd69119..ec6d3023 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -354,7 +354,7 @@ CPlayerInfo::Process(void) bool startTaxiTimer = true; if (m_bUnusedTaxiThing && m_pPed->bInVehicle) { CVehicle *veh = m_pPed->m_pMyVehicle; - if ((veh->m_modelIndex == MI_TAXI || veh->m_modelIndex == MI_CABBIE || veh->m_modelIndex == MI_BORGNINE) + if ((veh->GetModelIndex() == MI_TAXI || veh->GetModelIndex() == MI_CABBIE || veh->GetModelIndex() == MI_BORGNINE) && veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) { for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) { timePassed -= 1000; @@ -407,7 +407,7 @@ CPlayerInfo::Process(void) if (m_pPed->bInVehicle) { if (!m_pRemoteVehicle) { CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity; - if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->m_modelIndex)) { + if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->GetModelIndex())) { CVehicle *veh = m_pPed->m_pMyVehicle; if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 4306cf09..bc65f6b6 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -223,21 +223,21 @@ INITSAVEBUF #ifdef COMPATIBLE_SAVES if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { WriteSaveBuf<uint32>(buf, pVehicle->m_vehType); - WriteSaveBuf<int16>(buf, pVehicle->m_modelIndex); + WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex()); WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle)); pVehicle->Save(buf); } #else if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); - WriteSaveBuf(buf, pVehicle->m_modelIndex); + WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); memcpy(buf, pVehicle, sizeof(CAutomobile)); SkipSaveBuf(buf, sizeof(CAutomobile)); } if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); - WriteSaveBuf(buf, pVehicle->m_modelIndex); + WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); memcpy(buf, pVehicle, sizeof(CBoat)); SkipSaveBuf(buf, sizeof(CBoat)); @@ -279,7 +279,7 @@ INITSAVEBUF bool bHasBeenDamaged = pObject->bHasBeenDamaged; bool bUseVehicleColours = pObject->bUseVehicleColours; CCompressedMatrixNotAligned tmp; - WriteSaveBuf(buf, pObject->m_modelIndex); + WriteSaveBuf(buf, pObject->GetModelIndex()); WriteSaveBuf(buf, GetObjectRef(pObject)); tmp.CompressFromFullMatrix(pObject->GetMatrix()); WriteSaveBuf(buf, tmp); @@ -397,7 +397,7 @@ INITSAVEBUF continue; if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) { WriteSaveBuf(buf, pPed->m_nPedType); - WriteSaveBuf(buf, pPed->m_modelIndex); + WriteSaveBuf(buf, pPed->GetModelIndex()); WriteSaveBuf(buf, GetPedRef(pPed)); #ifdef COMPATIBLE_SAVES pPed->Save(buf); 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; diff --git a/src/core/World.cpp b/src/core/World.cpp index befdfad4..09170f54 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -758,7 +758,7 @@ CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList &list, const CEntity *pEntity = (CEntity *)pNode->item; if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); - if(modelId == pEntity->m_modelIndex) { + if (modelId == pEntity->GetModelIndex()) { float fMagnitude = 0.0f; if(bCheck2DOnly) fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); @@ -953,14 +953,13 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad float distance = diff.Magnitude(); if(e->GetBoundRadius() + radius > distance) { - CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(); + CColModel *eCol = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), *eCol, gaTempSphereColPoints, nil, nil); if(collidedSpheres != 0 || - (e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR && - e->m_modelIndex != MI_DODO && + (e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR && e->GetModelIndex() != MI_DODO && radius + eCol->boundingBox.max.x > distance)) { return e; } @@ -1823,7 +1822,7 @@ CWorld::RepositionCertainDynamicObjects() void CWorld::RepositionOneObject(CEntity *pEntity) { - int16 modelId = pEntity->m_modelIndex; + int16 modelId = pEntity->GetModelIndex(); if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || @@ -2026,8 +2025,7 @@ CWorld::Process(void) if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; if(movingEnt->GetStatus() == STATUS_PLAYER) { - printf("STUCK: Final Step: Player Entity %d Is Stuck\n", - movingEnt->m_modelIndex); + printf("STUCK: Final Step: Player Entity %d Is Stuck\n", movingEnt->GetModelIndex()); movingEnt->m_vecMoveSpeed *= 0.3f; movingEnt->ApplyMoveSpeed(); movingEnt->ApplyTurnSpeed(); @@ -2119,13 +2117,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { if(pEntity->bIsStatic) { if(pEntity->IsObject()) { - if(fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { - if(IsGlass(pObject->m_modelIndex)) { + if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) { + if (IsGlass(pObject->GetModelIndex())) { CGlass::WindowRespondsToExplosion(pObject, position); } else { pObject->bIsStatic = false; pObject->AddToMovingList(); - int16 modelId = pEntity->m_modelIndex; + int16 modelId = pEntity->GetModelIndex(); if(modelId != MI_FIRE_HYDRANT || pObject->bHasBeenDamaged) { if(pEntity->IsObject() && |