Fix hammer/pickhammer not digging land with gfSolidLand on
authorWuzzy <Wuzzy2@mail.ru>
Thu, 02 Aug 2018 23:43:31 +0200
changeset 13604 73b096e1d895
parent 13603 369efa5e01fa
child 13605 422d6062620a
Fix hammer/pickhammer not digging land with gfSolidLand on This bug was introduced after the switch to doMakeExplosion
ChangeLog.txt
hedgewars/uConsts.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsUtils.pas
hedgewars/uScript.pas
--- a/ChangeLog.txt	Thu Aug 02 23:24:27 2018 +0200
+++ b/ChangeLog.txt	Thu Aug 02 23:43:31 2018 +0200
@@ -84,6 +84,7 @@
  + New global: NoPointX. Value of CursorX and CursorY if cursor is inactive
  + New global: AMMO_INFINITE. Value for infinite ammo count for AddAmmo and other functions
  + New global: cMaxHogHealth. Maximum possible hedgehog health
+ + New global: EXPLForceDraw. Flag for Explode function, forces land removal even with gfSolidLand on
  * Changed global: lfCurrentHog becomes lfCurHogCrate
  * Fixed variable: TotalRounds was -1 (instead of 0) in first real round after hog placement phase
  * AI sometimes intentionally shot hedgehogs with aihDoesntMatter set
--- a/hedgewars/uConsts.pas	Thu Aug 02 23:24:27 2018 +0200
+++ b/hedgewars/uConsts.pas	Thu Aug 02 23:43:31 2018 +0200
@@ -343,6 +343,7 @@
     EXPLNoGfx             = $00000020;
     EXPLPoisoned          = $00000040;
     EXPLDoNotTouchAny     = $00000080;
+    EXPLForceDraw         = $00000100;
 
     posCaseAmmo    = $00000001;
     posCaseHealth  = $00000002;
--- a/hedgewars/uGearsHandlersMess.pas	Thu Aug 02 23:24:27 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Aug 02 23:43:31 2018 +0200
@@ -1710,7 +1710,7 @@
         ei := x + Gear^.Radius + LongInt(GetRandom(2));
         while i <= ei do
             begin
-            doMakeExplosion(i, y + 3, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
+            doMakeExplosion(i, y + 3, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw);
             inc(i, 1)
             end;
 
@@ -5672,11 +5672,11 @@
 
         i := hwRound(Gear^.X) - HitGear^.Radius + 2;
         ei := hwRound(Gear^.X) + HitGear^.Radius - 2;
-        for j := 1 to 4 do doMakeExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
-        for j := 1 to 4 do doMakeExplosion(ei + LongInt(GetRandom(5)), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
+        for j := 1 to 4 do doMakeExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw);
+        for j := 1 to 4 do doMakeExplosion(ei + LongInt(GetRandom(5)), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw);
         while i <= ei do
             begin
-            for j := 1 to 11 do doMakeExplosion(i, hwRound(Gear^.Y) + 3*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx);
+            for j := 1 to 11 do doMakeExplosion(i, hwRound(Gear^.Y) + 3*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw);
             inc(i, 1)
             end;
 
--- a/hedgewars/uGearsUtils.pas	Thu Aug 02 23:24:27 2018 +0200
+++ b/hedgewars/uGearsUtils.pas	Thu Aug 02 23:43:31 2018 +0200
@@ -216,7 +216,7 @@
     end;
 
 if (Mask and EXPLDontDraw) = 0 then
-    if (GameFlags and gfSolidLand) = 0 then
+    if ((GameFlags and gfSolidLand) = 0) or ((Mask and EXPLForceDraw) <> 0) then
         begin
         cnt:= DrawExplosion(X, Y, Radius) div 1608; // approx 2 16x16 circles to erase per chunk
         if (cnt > 0) and (SpritesData[sprChunk].Texture <> nil) then
--- a/hedgewars/uScript.pas	Thu Aug 02 23:24:27 2018 +0200
+++ b/hedgewars/uScript.pas	Thu Aug 02 23:43:31 2018 +0200
@@ -4010,6 +4010,7 @@
 ScriptSetInteger('EXPLNoGfx'        , EXPLNoGfx);
 ScriptSetInteger('EXPLPoisoned'     , EXPLPoisoned);
 ScriptSetInteger('EXPLDoNotTouchAny', EXPLDoNotTouchAny);
+ScriptSetInteger('EXPLForceDraw'    , EXPLForceDraw);
 
 // register functions
 lua_register(luaState, _P'HideHog', @lc_hidehog);