Explode hog instantly when taking damage while dying
authorWuzzy <Wuzzy2@mail.ru>
Sun, 23 Jun 2019 16:14:27 +0200
changeset 15216 7d41e7889123
parent 15215 a6cf13eebb14
child 15217 a0bb57d3d272
Explode hog instantly when taking damage while dying
ChangeLog.txt
hedgewars/uGearsUtils.pas
--- a/ChangeLog.txt	Sun Jun 23 11:28:00 2019 +0200
+++ b/ChangeLog.txt	Sun Jun 23 16:14:27 2019 +0200
@@ -39,6 +39,7 @@
  * Add missing winner animation in single missions
  * Fix hog floating when switching to moving hog
  * Fix jump key not being ignored after placing girder or target
+ * Explode hog instantly when taking damage while dying
 
 Styles and schemes:
  + The Specialists: Unlock game scheme
--- a/hedgewars/uGearsUtils.pas	Sun Jun 23 11:28:00 2019 +0200
+++ b/hedgewars/uGearsUtils.pas	Sun Jun 23 16:14:27 2019 +0200
@@ -283,8 +283,16 @@
         Gear^.LastDamage := AttackerHog;
 
         Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
-        HHHurt(Gear^.Hedgehog, Source, Damage);
-        AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
+
+        if (Gear^.State and gstHHDeath) <> 0 then
+            // If hog took damage while dying, explode hog instantly (see doStepHedgehogDead)
+            Gear^.Timer:= 1
+        else
+            begin
+            HHHurt(Gear^.Hedgehog, Source, Damage);
+            AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
+            end;
+
         tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
         if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
             begin