Fix MI_RCBOMB gravity force and treat MI_PETROLPUMP2 as explosive

This commit is contained in:
Walied K. Yassen 2020-11-29 08:52:43 +02:00
parent 03ef438a72
commit afe70003f4
No known key found for this signature in database
GPG key ID: 310BA64A98BBFB41

View file

@ -107,7 +107,8 @@ CObject::ProcessControl(void)
m_vecMoveSpeed *= fTimeStep;
m_vecTurnSpeed *= fTimeStep;
}
if ((GetModelIndex() == MI_EXPLODINGBARREL || GetModelIndex() == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible
auto mi = GetModelIndex();
if ((mi == MI_EXPLODINGBARREL || mi == MI_PETROLPUMP || mi == MI_PETROLPUMP2) && bHasBeenDamaged && bIsVisible
&& (CGeneral::GetRandomNumber() & 0x1F) == 10) {
bExplosionProof = true;
bIsVisible = false;
@ -115,6 +116,13 @@ CObject::ProcessControl(void)
bAffectedByGravity = false;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
}
if (mi == MI_RCBOMB) {
float fTurnForce = -(m_fTurnMass / 20.0f);
CPhysical::ApplyTurnForce(m_vecMoveSpeed * fTurnForce, -GetForward());
float fScalar = 1.0f - m_vecMoveSpeed.MagnitudeSqr() / 5.0f;
float fScalarTimed = Pow(fScalar, CTimer::GetTimeStep());
m_vecMoveSpeed *= fScalarTimed;
}
}
void