From 1f98f01dcb006783755bd58fa458bb515626b2dd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 9 Aug 2021 18:14:19 +0300 Subject: Fix a bunch of CModelInfo::GetModelInfo->GetColModel calls --- src/collision/Collision.cpp | 2 +- src/control/CarCtrl.cpp | 2 +- src/control/Garages.cpp | 2 +- src/control/RoadBlocks.cpp | 6 +++--- src/control/Script.cpp | 2 +- src/core/Radar.cpp | 4 ++-- src/core/World.cpp | 8 ++++---- src/peds/Ped.cpp | 12 ++++++------ src/peds/Population.cpp | 2 +- src/renderer/Renderer.cpp | 4 ++-- src/vehicles/CarGen.cpp | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp index 9d656581..832d773e 100644 --- a/src/collision/Collision.cpp +++ b/src/collision/Collision.cpp @@ -130,7 +130,7 @@ GetCollisionInSectorList(CPtrList &list) for(node = list.first; node; node = node->next){ e = (CEntity*)node->item; - level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level; + level = CModelInfo::GetColModel(e->GetModelIndex())->level; if(level != LEVEL_GENERIC) return (eLevelName)level; } diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 37312b89..ca83603f 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -354,7 +354,7 @@ CCarCtrl::GenerateOneRandomCar() pVehicle->m_bSirenOrAlarm = true; pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId; pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad; - CColBox* boundingBox = &CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel()->boundingBox; + CColBox* boundingBox = &CModelInfo::GetColModel(pVehicle->GetModelIndex())->boundingBox; float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2; float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D(); /* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */ diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 245e961d..bb919eae 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2023,7 +2023,7 @@ void CGarages::GivePlayerDetonator() float CGarages::FindDoorHeightForMI(int32 mi) { - return CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.max.z - CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.min.z - 0.1f; + return CModelInfo::GetColModel(mi)->boundingBox.max.z - CModelInfo::GetColModel(mi)->boundingBox.min.z - 0.1f; } void CGarage::TidyUpGarage() diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index c22bebaa..4c3307c5 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -51,7 +51,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle(); if (!pEntityToAttack) pEntityToAttack = (CEntity*)FindPlayerPed(); - CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel(); + CColModel* pPoliceColModel = CModelInfo::GetColModel(MI_POLICE); float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius; for (int32 i = 0; i < 2; i++) { const int32 roadBlockIndex = i + 2 * roadBlockType; @@ -130,7 +130,7 @@ CRoadBlocks::GenerateRoadBlocks(void) vehicleId = MI_ENFORCER; if (!CStreaming::HasModelLoaded(vehicleId)) vehicleId = MI_POLICE; - CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel(); + CColModel *pVehicleColModel = CModelInfo::GetColModel(vehicleId); float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f; int16 radius = (int16)(fMapObjectRadius / fModelRadius); if (radius >= 6) @@ -152,7 +152,7 @@ CRoadBlocks::GenerateRoadBlocks(void) else offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f); CMatrix vehicleMatrix = mapObject->GetMatrix() * offsetMatrix; - float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f; + float fModelRadius = CModelInfo::GetColModel(vehicleId)->boundingSphere.radius - 0.25f; int16 colliding = 0; CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); if (!colliding) { diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 4501c27f..f1c8b348 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2814,7 +2814,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) CTheScripts::ReadTextLabelFromScript(&m_nIp, label); int zoneToCheck = CTheZones::FindZoneByLabelAndReturnIndex(label); if (zoneToCheck != -1) - m_nIp += KEY_LENGTH_IN_SCRIPT; /* why only if zone != 1? */ + m_nIp += KEY_LENGTH_IN_SCRIPT; /* why only if zone != -1? */ CVector pos = pPlayer->GetPos(); CZone* pZone = CTheZones::GetZone(zoneToCheck); UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, pZone)); diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 011c8464..d74ce007 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -447,7 +447,7 @@ void CRadar::Draw3dMarkers() CEntity *entity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); - pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f; + pos.z += 1.2f * CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 2.5f; C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5); } break; @@ -471,7 +471,7 @@ void CRadar::Draw3dMarkers() CEntity *entity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); - pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f; + pos.z += CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 1.0f + 1.0f; C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5); } break; diff --git a/src/core/World.cpp b/src/core/World.cpp index 6e8314f4..1c34a633 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -358,7 +358,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP } else colmodel = nil; } else if(e->bUsesCollision) - colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); + colmodel = CModelInfo::GetColModel(e->GetModelIndex()); if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, mindist, ignoreSeeThrough)) @@ -444,7 +444,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) { e->m_scanCode = GetCurrentScanCode(); - colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); + colmodel = CModelInfo::GetColModel(e->GetModelIndex()); if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, mindist, ignoreSeeThrough, poly)) entity = e; @@ -645,7 +645,7 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo if(e != pIgnoreEntity && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { - colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); + colmodel = CModelInfo::GetColModel(e->GetModelIndex()); if(CCollision::TestLineOfSight(line, e->GetMatrix(), *colmodel, ignoreSeeThrough)) return false; @@ -955,7 +955,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad float distance = diff.Magnitude(); if(e->GetBoundRadius() + radius > distance) { - CColModel *eCol = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); + CColModel *eCol = CModelInfo::GetColModel(e->GetModelIndex()); int collidedSpheres = CCollision::ProcessColModels(sphereMat, OurColModel, e->GetMatrix(), *eCol, gaTempSphereColPoints, nil, nil); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 3ccae5d0..96c1d094 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2308,7 +2308,7 @@ CPed::ProcessControl(void) } else { DMAudio.PlayOneShot(collidingVeh->m_audioEntityId, SOUND_CAR_PED_COLLISION, m_fDamageImpulse); if (IsPlayer()) { - CColModel *collidingCol = CModelInfo::GetModelInfo(collidingVeh->GetModelIndex())->GetColModel(); + CColModel *collidingCol = CModelInfo::GetColModel(collidingVeh->GetModelIndex()); CVector colMinVec = collidingCol->boundingBox.min; CVector colMaxVec = collidingCol->boundingBox.max; @@ -3061,8 +3061,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) CColPoint intersectionPoint; CColLine ourLine; - CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel(); - CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel(); + CColModel *ourCol = CModelInfo::GetColModel(GetModelIndex()); + CColModel *hisCol = CModelInfo::GetColModel(collidingEnt->GetModelIndex()); if (!bUsesCollision) return 0; @@ -3556,7 +3556,7 @@ void CPed::SetDirectionToWalkAroundObject(CEntity *obj) { float distLimitForTimer = 8.0f; - CColModel *objCol = CModelInfo::GetModelInfo(obj->GetModelIndex())->GetColModel(); + CColModel *objCol = CModelInfo::GetColModel(obj->GetModelIndex()); CVector objColMin = objCol->boundingBox.min; CVector objColMax = objCol->boundingBox.max; CVector objColCenter = (objColMin + objColMax) / 2.0f; @@ -4886,7 +4886,7 @@ CPed::PreRender(void) if (CWeather::Rain > 0.3f && TheCamera.SoundDistUp > 15.0f) { if ((TheCamera.GetPosition() - GetPosition()).Magnitude() < 25.0f) { bool doSplashUp = true; - CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel(); + CColModel *ourCol = CModelInfo::GetColModel(GetModelIndex()); CVector speed = FindPlayerSpeed(); if (Abs(speed.x) <= 0.05f && Abs(speed.y) <= 0.05f) { @@ -8044,7 +8044,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg) return; CVector forward(0.15f * ped->GetForward() + ped->GetPosition()); - forward.z += CModelInfo::GetModelInfo(ped->GetModelIndex())->GetColModel()->spheres->center.z + 0.25f; + forward.z += CModelInfo::GetColModel(ped->GetModelIndex())->spheres->center.z + 0.25f; CEntity *obstacle = CWorld::TestSphereAgainstWorld(forward, 0.25f, nil, true, true, false, true, false, false); if (!obstacle) { diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index fcabff91..5c80702f 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -999,7 +999,7 @@ bool CPopulation::TestRoomForDummyObject(CObject *obj) { int16 collidingObjs; - CWorld::FindObjectsKindaColliding(obj->m_objectMatrix.GetPosition(), CModelInfo::GetModelInfo(obj->GetModelIndex())->GetColModel()->boundingSphere.radius, + CWorld::FindObjectsKindaColliding(obj->m_objectMatrix.GetPosition(), CModelInfo::GetColModel(obj->GetModelIndex())->boundingSphere.radius, false, &collidingObjs, 2, nil, false, true, true, false, false); return collidingObjs == 0; diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp index 25effc81..334f3954 100644 --- a/src/renderer/Renderer.cpp +++ b/src/renderer/Renderer.cpp @@ -158,7 +158,7 @@ CRenderer::RenderOneRoad(CEntity *e) if(gbDontRenderBuildings) return; if(gbShowCollisionPolys) - CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex()); + CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetColModel(e->GetModelIndex()), e->GetModelIndex()); else #endif { @@ -191,7 +191,7 @@ CRenderer::RenderOneNonRoad(CEntity *e) #ifndef MASTER if(gbShowCollisionPolys){ if(!e->IsVehicle()){ - CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex()); + CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetColModel(e->GetModelIndex()), e->GetModelIndex()); return; } }else if(e->IsBuilding()){ diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 22b2fc60..ebb767dd 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -172,8 +172,8 @@ void CCarGenerator::Setup(float x, float y, float z, float angle, int32 mi, int1 m_nTimer = CTimer::GetTimeInMilliseconds() + 1; m_nUsesRemaining = 0; m_bIsBlocking = false; - m_vecInf = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.min; - m_vecSup = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.max; + m_vecInf = CModelInfo::GetColModel(m_nModelIndex)->boundingBox.min; + m_vecSup = CModelInfo::GetColModel(m_nModelIndex)->boundingBox.max; m_fSize = Max(m_vecInf.Magnitude(), m_vecSup.Magnitude()); } -- cgit v1.2.3