- roofs can also collapse if walla are destroyed with anti-materiel rifles

- Fix: roofs at the centre of an explosion always collapsed

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7618 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-10-27 22:36:52 +00:00
parent c47ad1214e
commit 4e1c24c2d0
2 changed files with 81 additions and 19 deletions
+17 -1
View File
@@ -1789,7 +1789,7 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason,
// don't hurt this structure, it's used for hit detection only!
return( FALSE );
}
if ( (pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_INDESTRUCTABLE_METAL) || (pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_INDESTRUCTABLE_STONE) )
{
return( FALSE );
@@ -1825,6 +1825,11 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason,
ubDamage = 0;
}
// Flugente: is there a wall at the loation we are damaging?
BOOLEAN fWallHere = FALSE;
if ( FindStructure( sGridNo, STRUCTURE_WALL ) )
fWallHere = TRUE;
// OK, Let's check our reason
if ( ubReason == STRUCTURE_DAMAGE_GUNFIRE || ubReason == STRUCTURE_DAMAGE_VEHICLE_TRAUMA )
{
@@ -1883,6 +1888,17 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason,
//Since the structure is being damaged, set the map element that a structure is damaged
gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED;
// if we destroyed something, the roof might get damaged too
// recompile = TRUE means that we destroyed soemthing
if ( fWallHere && recompile )
{
HandleRoofDestruction( sGridNo, damage * 0.75f );
HandleRoofDestruction( NewGridNo( sGridNo, DirectionInc( NORTH ) ), damage * 0.75f );
HandleRoofDestruction( NewGridNo( sGridNo, DirectionInc( EAST ) ), damage * 0.75f );
HandleRoofDestruction( NewGridNo( sGridNo, DirectionInc( WEST ) ), damage * 0.75f );
HandleRoofDestruction( NewGridNo( sGridNo, DirectionInc( SOUTH ) ), damage * 0.75f );
}
}
// anv: if we ram something with vehicle we have to destroy it, or else vehicle and structure will be drawn at the same tile