diff options
author | Walied K. Yassen <walied.developer@hotmail.com> | 2020-11-29 08:52:43 +0200 |
---|---|---|
committer | Walied K. Yassen <walied.developer@hotmail.com> | 2020-11-29 08:53:54 +0200 |
commit | afe70003f4c48683c287ca3d16662cc710f8602e (patch) | |
tree | 6e1aa717ef537bbc23bb8a3217698246b82a180e /src/objects | |
parent | 03ef438a7283fde341cc4938936ba882c3609993 (diff) |
Fix MI_RCBOMB gravity force and treat MI_PETROLPUMP2 as explosive
Diffstat (limited to 'src/objects')
-rw-r--r-- | src/objects/Object.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 2319c0d9..9322418f 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -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 |