New feature: riot shields protect against damage from some directions.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23452&start=0&

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8434 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-07-29 21:18:13 +00:00
parent 8a82802932
commit 11729a132e
22 changed files with 498 additions and 19 deletions
+44
View File
@@ -1571,6 +1571,28 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo
return( FALSE );
}
// Flugente: do we have a riot shield equipped?
if ( pSoldier->IsRiotShieldEquipped( ) )
{
UINT8 attackdir_inverse = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sBombGridNo );
// if the shield faces the direction of the attack, block it
if ( attackdir_inverse == pSoldier->ubDirection || attackdir_inverse == gOneCCDirection[pSoldier->ubDirection] || attackdir_inverse == gOneCDirection[pSoldier->ubDirection] )
{
INT32 damage = sWoundAmt;
INT32 breathdamage = sBreathAmt;
DamageRiotShield( pSoldier, damage, breathdamage );
sWoundAmt = damage;
sBreathAmt = breathdamage;
if ( sWoundAmt == 0 && sBreathAmt == 0 )
{
return FALSE;
}
}
}
// Lesh: if flashbang
// check if soldier is outdoor and situated farther that half explosion radius and not underground
usHalfExplosionRadius = Explosive[Item[usItem].ubClassIndex].ubRadius / 2;
@@ -4238,6 +4260,9 @@ void HandleExplosionQueue( void )
}
}
// Flugente: riot shields
extern void ShowRiotShield( SOLDIERTYPE* pSoldier );
// Flugente: show warnings around armed timebombs both in map and inventories
void HandleExplosionWarningAnimations( )
{
@@ -4315,6 +4340,25 @@ void HandleExplosionWarningAnimations( )
}
}
}
// show riot shields
SOLDIERTYPE* pSoldier;
UINT16 cnt = gTacticalStatus.Team[0].bFirstID;
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt, pSoldier++ )
{
if ( pSoldier && pSoldier->bActive && pSoldier->bInSector )
{
if ( (pSoldier->ubDirection == EAST ||
pSoldier->ubDirection == SOUTHEAST ||
pSoldier->ubDirection == SOUTH ||
pSoldier->ubDirection == SOUTHWEST ||
pSoldier->ubDirection == NORTHEAST)
&& pSoldier->IsRiotShieldEquipped( ) )
{
ShowRiotShield( pSoldier );
}
}
}
}
void DecayBombTimers( void )