mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 20:20:02 +00:00
more CRoadBlocks::GenerateRoadBlocks improvements
This commit is contained in:
parent
28fb1bdde7
commit
68f8a6a9ed
|
@ -112,14 +112,11 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
||||||
numRoadBlocks = maxRoadBlocks;
|
numRoadBlocks = maxRoadBlocks;
|
||||||
for (; nRoadblockNode < numRoadBlocks; nRoadblockNode++) {
|
for (; nRoadblockNode < numRoadBlocks; nRoadblockNode++) {
|
||||||
CTreadable *mapObject = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[nRoadblockNode]];
|
CTreadable *mapObject = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[nRoadblockNode]];
|
||||||
CVector2D direction = FindPlayerCoors() - mapObject->GetPosition();
|
CVector2D vecDistance = FindPlayerCoors() - mapObject->GetPosition();
|
||||||
if (!((direction.x > -80.0f && direction.x < 80.0f) && (direction.y > -80.0f && direction.y < 80.0f))) {
|
if (vecDistance.x > -80.0f && vecDistance.x < 80.0f &&
|
||||||
CRoadBlocks::InOrOut[nRoadblockNode] = false;
|
vecDistance.y > -80.0f && vecDistance.y < 80.0f &&
|
||||||
}
|
vecDistance.Magnitude() < 80.0f) {
|
||||||
else if (direction.Magnitude() >= 80.0f) {
|
if (!CRoadBlocks::InOrOut[nRoadblockNode]) {
|
||||||
CRoadBlocks::InOrOut[nRoadblockNode] = false;
|
|
||||||
}
|
|
||||||
else if (!CRoadBlocks::InOrOut[nRoadblockNode]) {
|
|
||||||
CRoadBlocks::InOrOut[nRoadblockNode] = true;
|
CRoadBlocks::InOrOut[nRoadblockNode] = true;
|
||||||
if (FindPlayerVehicle() && (CGeneral::GetRandomNumber() & 0x7F) < FindPlayerPed()->m_pWanted->m_RoadblockDensity) {
|
if (FindPlayerVehicle() && (CGeneral::GetRandomNumber() & 0x7F) < FindPlayerPed()->m_pWanted->m_RoadblockDensity) {
|
||||||
CWanted *pPlayerWanted = FindPlayerPed()->m_pWanted;
|
CWanted *pPlayerWanted = FindPlayerPed()->m_pWanted;
|
||||||
|
@ -137,14 +134,15 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
||||||
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
||||||
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
|
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
|
||||||
if (radius > 0 && radius < 6) {
|
if (radius > 0 && radius < 6) {
|
||||||
CVector2D directionToCamera = TheCamera.m_matrix.GetPosition() - mapObject->m_matrix.GetPosition();
|
CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->m_matrix.GetPosition();
|
||||||
float fDotProduct = DotProduct2D(directionToCamera, mapObject->m_matrix.GetUp());
|
float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp());
|
||||||
float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
|
float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
|
||||||
for (int16 i = 0; i < radius; i++) {
|
for (int16 i = 0; i < radius; i++) {
|
||||||
uint8 nRoadblockType = fDotProduct < 0.0f;
|
uint8 nRoadblockType = fDotProduct < 0.0f;
|
||||||
if (CGeneral::GetRandomNumber() & 1) {
|
if (CGeneral::GetRandomNumber() & 1) {
|
||||||
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
|
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
nRoadblockType = !nRoadblockType;
|
nRoadblockType = !nRoadblockType;
|
||||||
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
|
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +181,8 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
||||||
pVehicle->bCreateRoadBlockPeds = true;
|
pVehicle->bCreateRoadBlockPeds = true;
|
||||||
pVehicle->m_nRoadblockType = nRoadblockType;
|
pVehicle->m_nRoadblockType = nRoadblockType;
|
||||||
pVehicle->m_nRoadblockNode = nRoadblockNode;
|
pVehicle->m_nRoadblockNode = nRoadblockNode;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
delete pVehicle;
|
delete pVehicle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,6 +190,9 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
CRoadBlocks::InOrOut[nRoadblockNode] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue