Fix a bunch of CModelInfo::GetModelInfo->GetColModel calls

This commit is contained in:
Sergeanur 2021-08-09 18:14:19 +03:00
parent 8ea411e4c5
commit 1f98f01dcb
11 changed files with 24 additions and 24 deletions

View file

@ -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;
}

View file

@ -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. */

View file

@ -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()

View file

@ -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) {

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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()){

View file

@ -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());
}