diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 1ec0e7ef..ccda925e 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -1935,9 +1935,9 @@ INT32 LineOfSightTest( FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, // leaving a tile, check to see if it had gas in it // if ( pMapElement->ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS) ) - if ( pMapElement->ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS) ) + if ( pMapElement->ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS | MAPELEMENT_EXT_DEBRIS_SMOKE) ) { - if ( (pMapElement->ubExtFlags[0] & MAPELEMENT_EXT_SMOKE) && !fSmell ) + if ( (pMapElement->ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_DEBRIS_SMOKE) ) && !fSmell ) { bSmoke++; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ff4bde3b..fdd07bf3 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -2387,6 +2387,14 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE } } + if ( gpWorldLevelData[pSoldier->sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_DEBRIS_SMOKE ) + { + //if ( !(pSoldier->flags.fHitByGasFlags & HIT_BY_BURNABLEGAS) ) // gas mask doesn't help vs fire damage + { + pExplosive = &(Explosive[Item[GetFirstExplosiveOfType( EXPLOSV_SMOKE_DEBRIS )].ubClassIndex]); + } + } + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pSoldier->flags.fHitByGasFlags: %d", pSoldier->flags.fHitByGasFlags ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType ); diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index a79d471a..3fed58f8 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -291,6 +291,7 @@ enum EXPLOSV_BURNABLEGAS, EXPLOSV_FLASHBANG, EXPLOSV_SIGNAL_SMOKE, + EXPLOSV_SMOKE_DEBRIS, }; #define AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( x ) (x / 4) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 1b96a032..a78d69b3 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -1961,7 +1961,7 @@ BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo ) BOOLEAN InGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo ) { // smoke - if (gpWorldLevelData[sGridNo].ubExtFlags[ pSoldier->pathing.bLevel ] & (MAPELEMENT_EXT_SMOKE|MAPELEMENT_EXT_SIGNAL_SMOKE) ) + if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_SIGNAL_SMOKE | MAPELEMENT_EXT_DEBRIS_SMOKE) ) return TRUE; return InGas(pSoldier,sGridNo); diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index eddac550..f980b7cb 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -1179,7 +1179,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // if ( gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & MAPELEMENT_EXT_SMOKE || // gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS) || // gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & MAPELEMENT_EXT_MUSTARDGAS) - if ( gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & MAPELEMENT_EXT_SMOKE || + if ( gpWorldLevelData[sGridNo].ubExtFlags[bOpponentLevel[ubLoop]] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_DEBRIS_SMOKE) || gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS) || gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & MAPELEMENT_EXT_MUSTARDGAS || gpWorldLevelData[ sGridNo ].ubExtFlags[ bOpponentLevel[ubLoop] ] & MAPELEMENT_EXT_BURNABLEGAS) { @@ -2107,7 +2107,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * else return(0); } - else if ( Explosive[Item[pSoldier->inv[ ubItemPos ].usItem].ubClassIndex].ubType == EXPLOSV_SMOKE ) + else if ( Explosive[Item[pSoldier->inv[ubItemPos].usItem].ubClassIndex].ubType == EXPLOSV_SMOKE || Explosive[Item[pSoldier->inv[ubItemPos].usItem].ubClassIndex].ubType == EXPLOSV_SMOKE_DEBRIS ) return 5; else ubExplosiveIndex = Item[ pSoldier->inv[ubItemPos].usItem ].ubClassIndex; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 041252fd..8c7db117 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1986,7 +1986,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN } } - else if(pExplosive->ubType == EXPLOSV_SMOKE)//dnl ch40 200909 + else if ( pExplosive->ubType == EXPLOSV_SMOKE || pExplosive->ubType == EXPLOSV_SMOKE_DEBRIS )//dnl ch40 200909 { // robots are unaffected by smoke if( AM_A_ROBOT(pSoldier) ) @@ -2092,6 +2092,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN pSoldier->flags.fHitByGasFlags |= HIT_BY_BURNABLEGAS; break; case EXPLOSV_SMOKE://dnl ch40 200909 + case EXPLOSV_SMOKE_DEBRIS: pSoldier->flags.fHitByGasFlags |= HIT_BY_SMOKEGAS; break; default: @@ -2224,6 +2225,12 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte bSmokeEffectType = SIGNAL_SMOKE_EFFECT; fBlastEffect = FALSE; break; + + case EXPLOSV_SMOKE_DEBRIS: + fSmokeEffect = TRUE; + bSmokeEffectType = DEBRIS_SMOKE_EFFECT; + fBlastEffect = FALSE; + break; } } @@ -2904,6 +2911,7 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, case EXPLOSV_SMOKE: case EXPLOSV_CREATUREGAS: case EXPLOSV_SIGNAL_SMOKE: + case EXPLOSV_SMOKE_DEBRIS: fSmokeEffect = TRUE; break; @@ -5956,6 +5964,16 @@ void RoofDestruction( INT32 sGridNo, BOOLEAN fWithExplosion ) { InternalIgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, usRoofCollapseExplosionIndex, FALSE, 0 ); } + + if ( Chance( 15 ) ) + { + static UINT16 debrissmokeitem = GetFirstExplosiveOfType( EXPLOSV_SMOKE_DEBRIS ); + + if ( debrissmokeitem ) + { + InternalIgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, debrissmokeitem, FALSE, 0 ); + } + } } RemoveAllRoofsOfTypeRangeAdjustSaveFile( sGridNo, FIRSTTEXTURE, WIREFRAMES ); @@ -6043,26 +6061,29 @@ void HandleRoofDestruction( INT32 sGridNo, INT16 sDamage ) // sadly the calculating time is somewhat high if there are many nodes connected to the roof, like Alma prison. // therefore this part is commented out. Can be commented in once the speed issues have been resolved // properly done, this would simulat the 'structural integrity' of the building - /*// for each remaining node, determine the distance to the closest node with a wall-connection inside the remaining network. If the distance is high enough, the roof will come down + // for each remaining node, determine the distance to the closest node with a wall-connection inside the remaining network. If the distance is high enough, the roof will come down gridnoarmourvector roofarmoursharednetwork = GetArmourSharedRoofNetwork( (*roofnetworkit).second ); - for ( gridnoarmourvector::iterator it = roofarmoursharednetwork.begin( ); it != roofarmoursharednetwork.end( ); ++it ) + if ( roofarmoursharednetwork.size() < 200 ) { - gridnoarmourpair pair = (*it); + for ( gridnoarmourvector::iterator it = roofarmoursharednetwork.begin( ); it != roofarmoursharednetwork.end( ); ++it ) + { + gridnoarmourpair pair = (*it); - // if it does not have a roof, ignore - if ( !IsRoofPresentAtGridNo( pair.first ) ) - { - pair.second = 0; - continue; - } + // if it does not have a roof, ignore + if ( !IsRoofPresentAtGridNo( pair.first ) ) + { + pair.second = 0; + continue; + } - if ( pair.second < 1 ) - { - if ( DamageRoof( pair.first, 255 ) ) - pair.second = 0; + if ( pair.second < 1 ) + { + if ( DamageRoof( pair.first, 255 ) ) + pair.second = 0; + } + } } - }*/ // for now, determine the best armour for each remaining network, and collapse it if there is no armou - and thus no wall connection - left gridnoarmourvector roofnetwork = (*roofnetworkit).second; diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index 525188e7..610c5a45 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -59,6 +59,7 @@ enum EXPLOSION_TYPES THERMOBARIC_EXP, FLASHBANG_EXP, // Lesh: enum added ROOF_COLLAPSE, // Flugente: play an animation of roof tiles crashing down + ROOF_COLLAPSE_SMOKE, // Flugente: when structure collapses, smoke might rise NUM_EXP_TYPES=50 } ; diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index ed8b0310..c9ab8f38 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -130,10 +130,12 @@ INT8 FromWorldFlagsToSmokeType( UINT16 ubWorldFlags ) { return( SIGNAL_SMOKE_EFFECT ); } - else + else if ( ubWorldFlags & MAPELEMENT_EXT_DEBRIS_SMOKE ) { - return( NO_SMOKE_EFFECT ); + return(DEBRIS_SMOKE_EFFECT); } + + return(NO_SMOKE_EFFECT); } @@ -171,6 +173,10 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType ) return( MAPELEMENT_EXT_SIGNAL_SMOKE ); break; + case DEBRIS_SMOKE_EFFECT: + return(MAPELEMENT_EXT_DEBRIS_SMOKE); + break; + default: return( 0 ); @@ -275,6 +281,10 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, bSmokeEffectType = SIGNAL_SMOKE_EFFECT; break; + + case EXPLOSV_SMOKE_DEBRIS: + bSmokeEffectType = DEBRIS_SMOKE_EFFECT; + break; } pSmoke->ubDuration = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubDuration; @@ -496,6 +506,24 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8 } } break; + + case DEBRIS_SMOKE_EFFECT: + if ( !(gGameSettings.fOptions[TOPTION_ANIMATE_SMOKE]) ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\debris_smoke.STI" ); + } + else + { + if ( fDissipating ) + { + strcpy( AniParams.zCachedFile, "TILECACHE\\debris_smoke.STI" ); + } + else + { + strcpy( AniParams.zCachedFile, "TILECACHE\\debris_smoke.STI" ); + } + } + break; } // Create tile... diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 9dd173f0..8cec4bc4 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -12,6 +12,7 @@ enum CREATURE_SMOKE_EFFECT, BURNABLEGAS_SMOKE_EFFECT, SIGNAL_SMOKE_EFFECT, // added by Flugente for artillery + DEBRIS_SMOKE_EFFECT, // added by Flugente for collapsing roofs }; #define SMOKE_EFFECT_INDOORS 0x01 diff --git a/TileEngine/Tile Animation.cpp b/TileEngine/Tile Animation.cpp index f97a9311..8b25570c 100644 --- a/TileEngine/Tile Animation.cpp +++ b/TileEngine/Tile Animation.cpp @@ -570,10 +570,8 @@ void UpdateAniTiles( ) ubExpType = Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubType; - // if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || - // ubExpType == EXPLOSV_SMOKE ) if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || - ubExpType == EXPLOSV_SMOKE || ubExpType == EXPLOSV_BURNABLEGAS || ubExpType == EXPLOSV_SIGNAL_SMOKE ) + ubExpType == EXPLOSV_SMOKE || ubExpType == EXPLOSV_BURNABLEGAS || ubExpType == EXPLOSV_SIGNAL_SMOKE || ubExpType == EXPLOSV_SMOKE_DEBRIS ) { // Do sound.... // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) ); diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index 0fdb6094..566198c3 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -135,12 +135,13 @@ class SOLDIERTYPE; #define MAPELEMENT_EXT_BURNABLEGAS 0x0100 //0x100 #define MAPELEMENT_EXT_CLIMBPOINT 0x0200 //0x200 #define MAPELEMENT_EXT_SIGNAL_SMOKE 0x0400 //0x400 // added by Flugente +#define MAPELEMENT_EXT_DEBRIS_SMOKE 0x0800 //0x800 // added by Flugente #define FIRST_LEVEL 0 #define SECOND_LEVEL 1 //#define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS ) -#define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS | MAPELEMENT_EXT_SIGNAL_SMOKE ) +#define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS | MAPELEMENT_EXT_SIGNAL_SMOKE | MAPELEMENT_EXT_DEBRIS_SMOKE ) // WDS - Clean up inventory handling