diff options
author | saml1er <danishroar@gmail.com> | 2020-04-11 23:08:16 +0200 |
---|---|---|
committer | saml1er <danishroar@gmail.com> | 2020-04-11 23:08:16 +0200 |
commit | 60898f39f2527bcef0a2617a8e6081f361c11708 (patch) | |
tree | f3bd713bc2ca314071cff77665a4517bedd25893 | |
parent | CRoadBlocks complete (diff) | |
download | re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar.gz re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar.bz2 re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar.lz re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar.xz re3-60898f39f2527bcef0a2617a8e6081f361c11708.tar.zst re3-60898f39f2527bcef0a2617a8e6081f361c11708.zip |
-rw-r--r-- | src/control/RoadBlocks.cpp | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 6adcba6b..5f98b942 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -44,7 +44,7 @@ CRoadBlocks::Init(void) void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode) { - CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f}, + static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f}, {1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} }; CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle(); if (!pEntityToAttack) @@ -54,7 +54,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType for (int32 i = 0; i < 2; i++) { const int32 roadBlockIndex = i + 2 * roadBlockType; CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]); - int32 modelInfoId = 0; + int32 modelInfoId = MI_COP; eCopType copType = COP_STREET; switch (pVehicle->GetModelIndex()) { @@ -62,23 +62,6 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType modelInfoId = MI_FBI; copType = COP_FBI; break; - case MI_MOONBEAM: - case MI_ESPERANT: - case MI_TAXI: - case MI_KURUMA: - case MI_BOBCAT: - case MI_MRWHOOP: - case MI_BFINJECT: - case MI_CORPSE: - case MI_POLICE: - case MI_SECURICA: - case MI_BANSHEE: - case MI_PREDATOR: - case MI_BUS: - case MI_RHINO: - copType = COP_STREET; - modelInfoId = MI_COP; - break; case MI_ENFORCER: modelInfoId = MI_SWAT; copType = COP_SWAT; @@ -121,7 +104,7 @@ void CRoadBlocks::GenerateRoadBlocks(void) { CMatrix offsetMatrix; - unsigned int frame = CTimer::GetFrameCounter() & 0xF; + uint32 frame = CTimer::GetFrameCounter() & 0xF; int16 nRoadblockNode = (int16)(600 * frame) / 16; const int16 maxRoadBlocks = (int16)(600 * (frame + 1)) / 16; int16 numRoadBlocks = CRoadBlocks::NumRoadBlocks; @@ -137,11 +120,9 @@ CRoadBlocks::GenerateRoadBlocks(void) if (direction.Magnitude() < 80.0f) { CRoadBlocks::InOrOut[nRoadblockNode] = false; continue; - } - else if (!CRoadBlocks::InOrOut[nRoadblockNode]) { + } else if (!CRoadBlocks::InOrOut[nRoadblockNode]) { CRoadBlocks::InOrOut[nRoadblockNode] = true; - } - else { + } else { continue; } if (!FindPlayerVehicle()) @@ -173,8 +154,7 @@ CRoadBlocks::GenerateRoadBlocks(void) uint8 nRoadblockType = fDotProduct >= 0.0f; if (CGeneral::GetRandomNumber() & 1) { offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI); - } - else { + } else { nRoadblockType = fDotProduct < 0.0f; offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI); } @@ -208,15 +188,14 @@ CRoadBlocks::GenerateRoadBlocks(void) pVehicle->bExtendedRange = true; if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) pVehicle->m_bSirenOrAlarm = true; - if (pVehicle->m_matrix.GetForward().z <= 0.94f) { - delete pVehicle; - } - else { + if (pVehicle->m_matrix.GetForward().z > 0.94f) { CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); CWorld::Add(pVehicle); pVehicle->bCreateRoadBlockPeds = true; pVehicle->m_nRoadblockType = nRoadblockType; pVehicle->m_nRoadblockNode = nRoadblockNode; + } else { + delete pVehicle; } } } |