From 07d7ced8883370024261a1c627ea942d1b65029f Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 12 Jul 2021 19:47:17 +0000 Subject: [PATCH] Reworked vanilla code: Explosions on the ground leave a permanent burnmark (by Sevenfm) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9139 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TileEngine/Explosion Control.cpp | 34 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 41fa719f..bcb26f28 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -2382,17 +2382,31 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte } // Add burn marks to ground randomly.... - //if ( Random( 50 ) < 15 && uiDist == 1 ) - //{ + INT8 bOverTerrainType = GetTerrainType( sGridNo ); + + if ( pExplosive->ubType == EXPLOSV_NORMAL && + ( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS || bOverTerrainType == HIGH_GRASS || bOverTerrainType == PAVED_ROAD ) && + uiDist == 0 && + bLevel == 0 && + !HasItemFlag( usItem, JUMP_GRENADE ) && + sWoundAmt > (INT16)Random( 100 ) ) + //Random( 50 ) < 15 && + //sWoundAmt / (4 * uiDist + 1) > Random( 100 ) ) + //pExplosive->ubDamage > Random( 100 ) ) + { + UINT16 usObjectIndex; + UINT16 usTileIndex; //if ( !TypeRangeExistsInObjectLayer( sGridNo, FIRSTEXPLDEBRIS, SECONDEXPLDEBRIS, &usObjectIndex ) ) - //{ - // GetTileIndexFromTypeSubIndex( SECONDEXPLDEBRIS, (UINT16)( Random( 10 ) + 1 ), &usTileIndex ); - // AddObjectToHead( sGridNo, usTileIndex ); - - // SetRenderFlags(RENDER_FLAG_FULL); - - //} - //} + if ( !TypeRangeExistsInObjectLayer( sGridNo, FIRSTEXPLDEBRIS, SECONDLARGEEXPDEBRIS10, &usObjectIndex ) ) + { + //GetTileIndexFromTypeSubIndex( SECONDEXPLDEBRIS, (UINT16)( Random( 10 ) + 1 ), &usTileIndex ); + GetTileIndexFromTypeSubIndex( SECONDEXPLDEBRIS, (UINT16)( 1 + 3 * Random( 2 ) ), &usTileIndex ); + ApplyMapChangesToMapTempFile( TRUE ); + AddObjectToHead( sGridNo, usTileIndex ); + ApplyMapChangesToMapTempFile( FALSE ); + SetRenderFlags( RENDER_FLAG_FULL ); + } + } // NB radius can be 0 so cannot divide it by 2 here if (!fStunEffect && (uiDist * 2 <= pExplosive->ubRadius) )