Fixed delayed mode for grenades.

Changing delayed mode for grenade launcher only possible with DELAYED_GRENADE_EXPLOSION = FALSE.
Minor code improvements and warning fixes.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8771 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-03-14 10:39:18 +00:00
parent 3e07b01a45
commit 560219ac36
2 changed files with 15 additions and 15 deletions
+3 -2
View File
@@ -9674,7 +9674,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) void ChangeWeaponMode( SOLDIERTYPE * pSoldier )
{ {
// ATE: Don't do this if in a fire amimation..... // ATE: Don't do this if in a fire animation.....
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE )
{ {
return; return;
@@ -9683,7 +9683,8 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier )
// Flugente: if we are in a GL fire mode, switch between impact/delayed mode // Flugente: if we are in a GL fire mode, switch between impact/delayed mode
if (((pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO) || if (((pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO) ||
(Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher)) && (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher)) &&
!pSoldier->usGLDelayMode ) !pSoldier->usGLDelayMode &&
!gGameExternalOptions.fDelayedGrenadeExplosion)
{ {
pSoldier->usGLDelayMode = 1; pSoldier->usGLDelayMode = 1;
} }
+6 -7
View File
@@ -2262,15 +2262,15 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI
} }
// calculate the actual min and max miss radius based on CtH // calculate the actual min and max miss radius based on CtH
bMinMissRadius = ( (FLOAT)bMaxRadius * ( 10.0f - sqrt((FLOAT)uiHitChance) ) / 10.0f ); bMinMissRadius = (INT8)((FLOAT)bMaxRadius * (10.0f - sqrt((FLOAT)uiHitChance)) / 10.0f);
bMaxMissRadius = bMaxRadius * ( 100 - uiHitChance ) / 100; bMaxMissRadius = bMaxRadius * ( 100 - uiHitChance ) / 100;
// modify by a bit of luck // modify by a bit of luck
bMinMissRadius = __max( (bMinMissRadius - Random(2)), 0); bMinMissRadius = __max( (bMinMissRadius - (INT8)Random(2)), 0);
bMinMissRadius = __min( (bMinMissRadius + Random(2)), bMaxRadius); bMinMissRadius = __min( (bMinMissRadius + (INT8)Random(2)), bMaxRadius);
bMaxMissRadius = __max( (bMaxMissRadius - Random(2)), 0); bMaxMissRadius = __max( (bMaxMissRadius - (INT8)Random(2)), 0);
bMaxMissRadius = __min( (bMaxMissRadius + Random(2)), bMaxRadius); bMaxMissRadius = __min( (bMaxMissRadius + (INT8)Random(2)), bMaxRadius);
// min miss radius cannot be greater than max miss radius // min miss radius cannot be greater than max miss radius
bMinMissRadius = __min( bMinMissRadius, bMaxMissRadius); bMinMissRadius = __min( bMinMissRadius, bMaxMissRadius);
@@ -2631,8 +2631,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
// is not in water and // is not in water and
// either has a bad status or is a delayed grenade // either has a bad status or is a delayed grenade
if (!pObject->fInWater && if (!pObject->fInWater &&
( !fGoodStatus || (!fGoodStatus || fCanDelayExplosion && (gGameExternalOptions.fDelayedGrenadeExplosion || fDelayedExplosion)))
( fCanDelayExplosion && gGameExternalOptions.fDelayedGrenadeExplosion && fDelayedExplosion) ) )
{ {
// didn't go off! // didn't go off!
fDoImpact = FALSE; fDoImpact = FALSE;