mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
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:
@@ -9674,16 +9674,17 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
|
||||
|
||||
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 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 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) ||
|
||||
( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher) ) &&
|
||||
!pSoldier->usGLDelayMode )
|
||||
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)) &&
|
||||
!pSoldier->usGLDelayMode &&
|
||||
!gGameExternalOptions.fDelayedGrenadeExplosion)
|
||||
{
|
||||
pSoldier->usGLDelayMode = 1;
|
||||
}
|
||||
|
||||
+10
-11
@@ -2262,15 +2262,15 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
// modify by a bit of luck
|
||||
bMinMissRadius = __max( (bMinMissRadius - Random(2)), 0);
|
||||
bMinMissRadius = __min( (bMinMissRadius + Random(2)), bMaxRadius);
|
||||
bMinMissRadius = __max( (bMinMissRadius - (INT8)Random(2)), 0);
|
||||
bMinMissRadius = __min( (bMinMissRadius + (INT8)Random(2)), bMaxRadius);
|
||||
|
||||
bMaxMissRadius = __max( (bMaxMissRadius - Random(2)), 0);
|
||||
bMaxMissRadius = __min( (bMaxMissRadius + Random(2)), bMaxRadius);
|
||||
bMaxMissRadius = __max( (bMaxMissRadius - (INT8)Random(2)), 0);
|
||||
bMaxMissRadius = __min( (bMaxMissRadius + (INT8)Random(2)), bMaxRadius);
|
||||
|
||||
// min miss radius cannot be greater than max miss radius
|
||||
bMinMissRadius = __min( bMinMissRadius, bMaxMissRadius);
|
||||
@@ -2581,16 +2581,16 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
|
||||
// ATE: Make sure number of objects is 1...
|
||||
pObj->ubNumberOfObjects = 1;
|
||||
|
||||
if ( Item[ pObj->usItem ].usItemClass & IC_GRENADE )
|
||||
if (Item[pObj->usItem].usItemClass & IC_GRENADE)
|
||||
{
|
||||
fCheckForDuds = TRUE;
|
||||
|
||||
if( CanDelayGrenadeExplosion(pObj->usItem) && ( Item[pObj->usItem].ubCursor == TOSSCURS || Item[pObj->usItem].glgrenade ))
|
||||
if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || Item[pObj->usItem].glgrenade))
|
||||
{
|
||||
fCanDelayExplosion = TRUE;
|
||||
}
|
||||
|
||||
if( (*pObj)[0]->data.sObjectFlag & DELAYED_GRENADE_EXPLOSION )
|
||||
if ((*pObj)[0]->data.sObjectFlag & DELAYED_GRENADE_EXPLOSION)
|
||||
{
|
||||
fDelayedExplosion = TRUE;
|
||||
}
|
||||
@@ -2630,9 +2630,8 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
|
||||
// Flugente: explosion does not happen instantly if grenade
|
||||
// is not in water and
|
||||
// either has a bad status or is a delayed grenade
|
||||
if ( !pObject->fInWater &&
|
||||
( !fGoodStatus ||
|
||||
( fCanDelayExplosion && gGameExternalOptions.fDelayedGrenadeExplosion && fDelayedExplosion) ) )
|
||||
if (!pObject->fInWater &&
|
||||
(!fGoodStatus || fCanDelayExplosion && (gGameExternalOptions.fDelayedGrenadeExplosion || fDelayedExplosion)))
|
||||
{
|
||||
// didn't go off!
|
||||
fDoImpact = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user