summaryrefslogtreecommitdiffstats
path: root/src/objects
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-09-02 19:55:28 +0200
committerSergeanur <s.anureev@yandex.ua>2020-09-02 19:55:28 +0200
commitfa7334c74f7b93587f96ec8285806cae89b12858 (patch)
tree6f926b5e3f25cbb295aab56a7e5161c02204ae6f /src/objects
parentEnable Stinger (diff)
downloadre3-fa7334c74f7b93587f96ec8285806cae89b12858.tar
re3-fa7334c74f7b93587f96ec8285806cae89b12858.tar.gz
re3-fa7334c74f7b93587f96ec8285806cae89b12858.tar.bz2
re3-fa7334c74f7b93587f96ec8285806cae89b12858.tar.lz
re3-fa7334c74f7b93587f96ec8285806cae89b12858.tar.xz
re3-fa7334c74f7b93587f96ec8285806cae89b12858.tar.zst
re3-fa7334c74f7b93587f96ec8285806cae89b12858.zip
Diffstat (limited to 'src/objects')
-rw-r--r--src/objects/Stinger.cpp63
1 files changed, 30 insertions, 33 deletions
diff --git a/src/objects/Stinger.cpp b/src/objects/Stinger.cpp
index 7996db00..857791dc 100644
--- a/src/objects/Stinger.cpp
+++ b/src/objects/Stinger.cpp
@@ -101,7 +101,7 @@ CStinger::CheckForBurstTyres()
const CVector firstPos = pSpikes[0]->GetPosition();
const CVector lastPos = pSpikes[NUM_STINGER_SEGMENTS - 1]->GetPosition();
float dist = (lastPos - firstPos).Magnitude();
- if (dist > 0.1f) return;
+ if (dist < 0.1f) return;
CVehicle *vehsInRange[16];
int16 numObjects;
@@ -121,42 +121,39 @@ CStinger::CheckForBurstTyres()
pBike = (CBike*)vehsInRange[i];
if (pAutomobile == nil && pBike == nil) continue;
+
+ float maxWheelDistToSpike = sq(((CVehicleModelInfo*)CModelInfo::GetModelInfo(vehsInRange[i]->GetModelIndex()))->m_wheelScale + 0.1f);
- int wheelId = 0;
- float wheelScaleSq = sq(((CVehicleModelInfo*)CModelInfo::GetModelInfo(vehsInRange[i]->GetModelIndex()))->m_wheelScale);
-
- for (; wheelId < 4; wheelId++) {
+ for (int wheelId = 0; wheelId < 4; wheelId++) {
if ((pAutomobile != nil && pAutomobile->m_aSuspensionSpringRatioPrev[wheelId] < 1.0f) ||
- (pBike != nil && pBike->m_aSuspensionSpringRatioPrev[wheelId] < 1.0f))
- break;
- }
-
- if (wheelId >= 4) continue;
-
- CVector vecWheelPos;
- if (pAutomobile != nil)
- vecWheelPos = pAutomobile->m_aWheelColPoints[wheelId].point;
- else if (pBike != nil)
- vecWheelPos = pBike->m_aWheelColPoints[wheelId].point;
-
- for (int32 spike = 0; spike < NUM_STINGER_SEGMENTS; spike++) {
- if ((pSpikes[spike]->GetPosition() - vecWheelPos).Magnitude() < wheelScaleSq) {
- if (pBike) {
- if (wheelId < 2)
- vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true);
- else
- vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true);
- } else {
- switch (wheelId) {
- case 0: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true); break;
- case 1: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true); break;
- case 2: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RF, true); break;
- case 3: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RR, true); break;
+ (pBike != nil && pBike->m_aSuspensionSpringRatioPrev[wheelId] < 1.0f)) {
+ CVector vecWheelPos;
+ if (pAutomobile != nil)
+ vecWheelPos = pAutomobile->m_aWheelColPoints[wheelId].point;
+ else if (pBike != nil)
+ vecWheelPos = pBike->m_aWheelColPoints[wheelId].point;
+
+ for (int32 spike = 0; spike < NUM_STINGER_SEGMENTS; spike++) {
+ if ((pSpikes[spike]->GetPosition() - vecWheelPos).Magnitude() < maxWheelDistToSpike) {
+ if (pBike) {
+ if (wheelId < 2)
+ vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true);
+ else
+ vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true);
+ }
+ else {
+ switch (wheelId) {
+ case 0: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true); break;
+ case 1: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true); break;
+ case 2: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RF, true); break;
+ case 3: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RR, true); break;
+ }
+ }
+ vecWheelPos.z += 0.15f;
+ for (int j = 0; j < 4; j++)
+ CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, vecWheelPos, vehsInRange[i]->GetRight() * 0.1f);
}
}
- vecWheelPos.z += 0.15f; // BUG? doesn't that break the burst of other tires?
- for (int j = 0; j < 4; j++)
- CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, vecWheelPos, vehsInRange[i]->GetRight() * 0.1f);
}
}
}