mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New background property: if <croucheddefense> is set, enemy CTH is modified if they fire on us while we are crouched against thick cover (size >= 2) in the direction of the shot.
Backgrounds.xml tag was added in GameDir r2267. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7933 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -19049,6 +19049,57 @@ FLOAT SOLDIERTYPE::GetBodyWeight()
|
||||
return 80.0f;
|
||||
}
|
||||
|
||||
// Flugente: are we crouched against cover from a specific direction? WARNING: This does not suffice to determine our cover!
|
||||
BOOLEAN SOLDIERTYPE::IsCrouchedAgainstCoverFromDir( UINT8 aDirection )
|
||||
{
|
||||
// we must be active
|
||||
if ( !bActive )
|
||||
return FALSE;
|
||||
|
||||
// only valid directions, please
|
||||
if ( aDirection >= NUM_WORLD_DIRECTIONS )
|
||||
return FALSE;
|
||||
|
||||
// only possible if crouched
|
||||
if ( gAnimControl[this->usAnimState].ubEndHeight != ANIM_CROUCH )
|
||||
return FALSE;
|
||||
|
||||
// we must be in a sector
|
||||
if ( !bInSector )
|
||||
return FALSE;
|
||||
|
||||
// this is odd - invalid GridNo...
|
||||
if ( TileIsOutOfBounds( this->sGridNo ) )
|
||||
return FALSE;
|
||||
|
||||
// not in a car...
|
||||
if ( this->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER) )
|
||||
return FALSE;
|
||||
|
||||
// we test whether we are crouched against cover in a specific direction, so determine the gridno to test
|
||||
INT32 covergridno = NewGridNo( this->sGridNo, DirectionInc( aDirection ) );
|
||||
|
||||
// this is odd - invalid GridNo...
|
||||
if ( TileIsOutOfBounds( covergridno ) )
|
||||
return FALSE;
|
||||
|
||||
// people don't count
|
||||
if ( WhoIsThere2( covergridno, this->pathing.bLevel ) != NOBODY )
|
||||
return FALSE;
|
||||
|
||||
// if we can sit there, then it's obviously not dense enough to for us to cover againt it
|
||||
if ( IsLocationSittable( covergridno, this->pathing.bLevel ) )
|
||||
return FALSE;
|
||||
|
||||
INT8 adjacenttileheight = GetTallestStructureHeight( covergridno, this->pathing.bLevel );
|
||||
|
||||
if ( adjacenttileheight >= 2 )
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT8 bBandaged; //,savedOurTurn;
|
||||
|
||||
Reference in New Issue
Block a user