diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index b91bb545..f11fc5d6 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -3500,6 +3500,28 @@ void RemoveAllUnburiedItems( INT32 sGridNo, UINT8 ubLevel ) } } +void RevealAllUnburiedItems( INT32 sGridNo, UINT8 ubLevel ) +{ + ITEM_POOL *pItemPool; + + // Check for and existing pool on the object layer + GetItemPool( sGridNo, &pItemPool, ubLevel ); + + while ( pItemPool ) + { + if ( gWorldItems[pItemPool->iItemIndex].bVisible != BURIED ) + { + gWorldItems[pItemPool->iItemIndex].bVisible = VISIBLE; + gWorldItems[pItemPool->iItemIndex].bRenderZHeightAboveLevel = 0; + gWorldItems[pItemPool->iItemIndex].ubNonExistChance = 0; + gWorldItems[pItemPool->iItemIndex].usFlags &= ( ~WORLD_ITEM_DONTRENDER ); + } + + pItemPool = pItemPool->pNext; + } + + NotifySoldiersToLookforItems(); +} void LoopLevelNodeForShowThroughFlag( LEVELNODE *pNode, INT32 sGridNo, UINT8 ubLevel ) { diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index 4c94df53..4474bb9d 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -220,7 +220,7 @@ void RemoveItemPool( INT32 sGridNo, UINT8 ubLevel ); void RenderTopmostFlashingItems( ); void RemoveAllUnburiedItems( INT32 sGridNo, UINT8 ubLevel ); - +void RevealAllUnburiedItems( INT32 sGridNo, UINT8 ubLevel ); BOOLEAN DoesItemPoolContainAnyHiddenItems( ITEM_POOL *pItemPool ); BOOLEAN DoesItemPoolContainAllHiddenItems( ITEM_POOL *pItemPool ); diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 366a85ca..f84785ac 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -650,7 +650,7 @@ void HandleFencePartnerCheck( INT32 sStructGridNo ) -BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, +INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel, UINT8 ubReason ) { @@ -683,7 +683,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe if ( DoesO3SectorStatueExistHere( sGridNo ) && uiDist <= 1 ) { ChangeO3SectorStatue( TRUE ); - return( TRUE ); + return( 1 ); } #ifdef JA2UB //JA25 UB @@ -706,12 +706,12 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe // ATE: Continue if we are only looking for walls if ( fOnlyWalls && !( pCurrent->fFlags & STRUCTURE_WALLSTUFF ) ) { - return( TRUE ); + return( 1 ); } if ( bLevel > 0 ) { - return( TRUE ); + return( 1 ); } // Is this a corpse? @@ -747,7 +747,9 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe pBase->fFlags & STRUCTURE_OPENABLE && !(pBase->fFlags & STRUCTURE_DOOR ) ) { - RemoveAllUnburiedItems( pBase->sGridNo, bLevel ); + // explosions destroy items inside + if ( ubReason == STRUCTURE_DAMAGE_EXPLOSION ) + RemoveAllUnburiedItems( pBase->sGridNo, bLevel ); } fExplosive = ( ( pCurrent->fFlags & STRUCTURE_EXPLOSIVE ) != 0 ); @@ -1315,7 +1317,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe if ( docontinue == 2 ) { - return( FALSE ); + return( 1 ); } } diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 83fb630a..f79fa47a 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1917,6 +1917,9 @@ INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, IN } RecompileLocalMovementCostsFromRadius( tmpgridno, 2 ); + + // if we've destroyed a structure, reveal the things inside, as destroying a structure doesn't necessarily destroy the contents inside + RevealAllUnburiedItems( tmpgridno, 0 ); } } @@ -1957,6 +1960,9 @@ INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, IN } RecompileLocalMovementCostsFromRadius( tmpgridno, 2 ); + + // if we've destroyed a structure, reveal the things inside, as destroying a structure doesn't necessarily destroy the contents inside + RevealAllUnburiedItems( tmpgridno, 0 ); } }