mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- main flashbang code added
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@462 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3549,11 +3549,48 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
|
||||
ubReason = TAKE_DAMAGE_HANDTOHAND;
|
||||
}
|
||||
// marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1
|
||||
// marke need another attacker id assignment
|
||||
// MercPtrs[ubAttackerID]->bLastAttackHit = TRUE;
|
||||
// extracting attacker´s ammo type
|
||||
else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
{
|
||||
INT8 bDeafValue;
|
||||
|
||||
bDeafValue = Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubVolume / 10;
|
||||
if ( bDeafValue == 0 )
|
||||
bDeafValue = 1;
|
||||
|
||||
// Lesh: flashbang does damage
|
||||
switch ( ubSpecial )
|
||||
{
|
||||
case FIRE_WEAPON_BLINDED_AND_DEAFENED:
|
||||
pSoldier->bDeafenedCounter = bDeafValue;
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier is blinded and deafened" );
|
||||
|
||||
// if soldier in building OR underground
|
||||
if ( InBuilding(sLocationGrid) || (gbWorldSectorZ) )
|
||||
{
|
||||
// deal max special damage
|
||||
pSoldier->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration;
|
||||
}
|
||||
else if ( NightTime() ) // if soldier outside at night
|
||||
{
|
||||
// halve effect
|
||||
pSoldier->bBlindedCounter = (INT8)Explosive[ Item[ usWeaponIndex ].ubClassIndex ].ubDuration / 2;
|
||||
if ( pSoldier->bBlindedCounter == 0 )
|
||||
pSoldier->bBlindedCounter = 1;
|
||||
pSoldier->bDeafenedCounter /= 2;
|
||||
}
|
||||
DecayIndividualOpplist( pSoldier );
|
||||
break;
|
||||
|
||||
case FIRE_WEAPON_BLINDED:
|
||||
break;
|
||||
|
||||
case FIRE_WEAPON_DEAFENED:
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier is deafened" );
|
||||
pSoldier->bDeafenedCounter = bDeafValue;
|
||||
break;
|
||||
};
|
||||
|
||||
if ( usWeaponIndex == STRUCTURE_EXPLOSION )
|
||||
{
|
||||
ubReason = TAKE_DAMAGE_STRUCTURE_EXPLOSION;
|
||||
@@ -4110,12 +4147,98 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16
|
||||
return;
|
||||
}
|
||||
|
||||
// Lesh: possible soldier behavior when affected by flashbang
|
||||
// Soldier can:
|
||||
// 1. stand as if there was no explosion at all
|
||||
// 2. crouch. represent that soldier didn't expect such blow and instinctively
|
||||
// made defensive movement to protect his body
|
||||
// 3. fall forward. again, he didn't expect that something will explode behind
|
||||
// him and deafens him
|
||||
// 4. fall backward. unexpected blast, fear, clumsy moves and soldier flies backward.
|
||||
|
||||
// Based on stance, select generic hit animation
|
||||
switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight )
|
||||
{
|
||||
case ANIM_STAND:
|
||||
if ( ubSpecial == FIRE_WEAPON_DEAFENED )
|
||||
{
|
||||
switch( Random(10) )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
// 6 of 10 - crouch
|
||||
ChangeSoldierStance( pSoldier, ANIM_CROUCH );
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
// 3 of 10 - fall forward
|
||||
BeginTyingToFall( pSoldier );
|
||||
EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||
break;
|
||||
case 9:
|
||||
// 1 of 10 - still standing
|
||||
DoGenericHit( pSoldier, 0, bDirection );
|
||||
break;
|
||||
};
|
||||
break;
|
||||
}
|
||||
else if ( ubSpecial == FIRE_WEAPON_BLINDED_AND_DEAFENED )
|
||||
{
|
||||
switch( Random(10) )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
// 5 of 10 - crouch
|
||||
ChangeSoldierStance( pSoldier, ANIM_CROUCH );
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
// 4 of 10 - fall backward (if possible) either forward
|
||||
// Check behind us!
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
||||
{
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
ChangeToFallbackAnimation( pSoldier, (INT8)bDirection );
|
||||
}
|
||||
else
|
||||
{
|
||||
BeginTyingToFall( pSoldier );
|
||||
EVENT_InitNewSoldierAnim( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
// 1 of 10 - still standing
|
||||
DoGenericHit( pSoldier, 0, bDirection );
|
||||
break;
|
||||
};
|
||||
break;
|
||||
}
|
||||
else if ( ubSpecial == FIRE_WEAPON_BLINDED )
|
||||
{
|
||||
}
|
||||
|
||||
case ANIM_CROUCH:
|
||||
|
||||
if ( ubSpecial == FIRE_WEAPON_BLINDED ||
|
||||
ubSpecial == FIRE_WEAPON_BLINDED_AND_DEAFENED ||
|
||||
ubSpecial == FIRE_WEAPON_DEAFENED )
|
||||
{
|
||||
DoGenericHit( pSoldier, 0, bDirection );
|
||||
break;
|
||||
}
|
||||
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
|
||||
@@ -4920,6 +5043,12 @@ void EVENT_BeginMercTurn( SOLDIERTYPE *pSoldier, BOOLEAN fFromRealTime, INT32 iR
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( pSoldier->bDeafenedCounter > 0 )
|
||||
{
|
||||
pSoldier->bDeafenedCounter--;
|
||||
}
|
||||
|
||||
// ATE: To get around a problem...
|
||||
// If an AI guy, and we have 0 life, and are still at higher hieght,
|
||||
// Kill them.....
|
||||
|
||||
Reference in New Issue
Block a user