From d7a28c4d2b80a82646f15b4fdbce7a26aeb2eaa8 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 11 Aug 2021 08:35:01 +0300 Subject: Fix a bunch of CModelInfo::GetModelInfo->GetColModel calls --- src/collision/Collision.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/renderer/Renderer.cpp | 4 ++-- src/vehicles/CarGen.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp index 0ffcd09a..f39f3f35 100644 --- a/src/collision/Collision.cpp +++ b/src/collision/Collision.cpp @@ -101,7 +101,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/Garages.cpp b/src/control/Garages.cpp index 34ed11eb..b24c9122 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1986,7 +1986,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 46eee71f..02afb7d8 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -60,7 +60,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; @@ -217,7 +217,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) 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 numRoadblockVehicles = Min(6, (int16)(distBetween / fModelRadius)); for (int16 i = 0; i < numRoadblockVehicles; i++) { @@ -231,7 +231,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) tmp.RotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + 3.1416f); tmp.SetTranslateOnly(offset * forward + pos); tmp.GetPosition().z += 0.6f; - float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f; + float fModelRadius = CModelInfo::GetColModel(vehicleId)->boundingSphere.radius - 0.25f; int16 colliding = 0; CWorld::FindObjectsKindaColliding(tmp.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 0e403c49..5b5825eb 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3073,7 +3073,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) CTheScripts::ReadTextLabelFromScript(&m_nIp, label); int zoneToCheck = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_DEFAULT); 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::GetNavigationZone(zoneToCheck); UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, pZone)); diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index faf11387..dab82c3e 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -485,7 +485,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, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); } break; @@ -509,7 +509,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, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); } break; diff --git a/src/core/World.cpp b/src/core/World.cpp index 841aab40..549c2cc0 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -365,7 +365,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP 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, ignoreShootThrough)) @@ -465,7 +465,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, false, poly)) entity = e; @@ -666,7 +666,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, false)) return false; @@ -971,7 +971,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 535445c5..fbe63a1a 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2204,7 +2204,7 @@ CPed::ProcessControl(void) Say(SOUND_PED_DAMAGE); } - CColModel* collidingCol = CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(); + CColModel *collidingCol = CModelInfo::GetColModel(collidingVeh->m_modelIndex); CVector colMinVec = collidingCol->boundingBox.min; CVector colMaxVec = collidingCol->boundingBox.max; @@ -2896,8 +2896,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 && !bJustCheckCollision) return 0; @@ -3414,7 +3414,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; @@ -4963,7 +4963,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) { @@ -9183,7 +9183,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg) return; CVector forward(0.09f * ped->GetForward() + ped->GetPosition()); - forward.z += CModelInfo::GetModelInfo(ped->GetModelIndex())->GetColModel()->spheres[2].center.z + 0.35f; + forward.z += CModelInfo::GetColModel(ped->GetModelIndex())->spheres[2].center.z + 0.35f; CEntity *obstacle = CWorld::TestSphereAgainstWorld(forward, 0.25f, nil, true, true, false, true, false, false); if (!obstacle) { diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp index 49e8e611..96e3a329 100644 --- a/src/renderer/Renderer.cpp +++ b/src/renderer/Renderer.cpp @@ -134,7 +134,7 @@ CRenderer::RenderOneRoad(CEntity *e) #endif #ifndef MASTER if(gbShowCollisionPolys || gbShowCollisionPolysReflections || gbShowCollisionPolysNoShadows) - 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 { @@ -157,7 +157,7 @@ CRenderer::RenderOneNonRoad(CEntity *e) #ifndef MASTER if(gbShowCollisionPolys || gbShowCollisionPolysReflections || gbShowCollisionPolysNoShadows){ 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 diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 29d0c5c7..bce8cdab 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -202,7 +202,7 @@ bool CCarGenerator::CheckForBlockage(int32 mi) { int16 entities; CEntity* pEntities[8]; - CColModel* pColModel = CModelInfo::GetModelInfo(mi)->GetColModel(); + CColModel* pColModel = CModelInfo::GetColModel(mi); CWorld::FindObjectsKindaColliding(CVector(m_vecPos), pColModel->boundingSphere.radius, 1, &entities, 8, pEntities, false, true, true, false, false); for (int i = 0; i < entities; i++) { if (m_vecPos.z + pColModel->boundingBox.min.z < pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.max.z + 1.0f && -- cgit v1.2.3