make blowtorch hit moving gears
authoralfadur
Thu, 29 Nov 2018 01:23:14 +0300
changeset 14336 9e8e64b2bb9e
parent 14335 97be4f6bf264
child 14337 94e50f346c57
make blowtorch hit moving gears
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Wed Nov 28 21:35:54 2018 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Nov 29 01:23:14 2018 +0300
@@ -1852,9 +1852,14 @@
     prevX: LongInt;
 begin
     AllInactive := false;
-    WorldWrap(Gear);
     dec(Gear^.Timer);
 
+    if WorldWrap(Gear) or (((Gear^.Timer) mod 500) = 0) then
+    begin
+        ClearHitOrder();
+        RefillProximityCache(Gear, 100);
+    end;
+
     if Gear^.Hedgehog^.Gear = nil then
         begin
         StopSoundChan(Gear^.SoundChannel);
@@ -1918,7 +1923,7 @@
                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
                 end;
             HHGear^.State := HHGear^.State or gstNoDamage;
-            AmmoShove(Gear, Gear^.Boom, 15);
+            AmmoShoveCache(Gear, Gear^.Boom, 15);
             HHGear^.State := HHGear^.State and (not gstNoDamage)
             end;
         end;
@@ -1935,6 +1940,8 @@
     if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
     or ((HHGear^.Message and gmAttack) <> 0) then
         begin
+        ClearHitOrder();
+        ClearProximityCache();
         StopSoundChan(Gear^.SoundChannel);
         HHGear^.Message := 0;
         HHGear^.State := HHGear^.State and (not gstNotKickable);
@@ -1961,7 +1968,10 @@
     HHGear^.Message := 0;
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.SoundChannel := LoopSound(sndBlowTorch);
-    Gear^.doStep := @doStepBlowTorchWork
+    Gear^.doStep := @doStepBlowTorchWork;
+
+    ClearHitOrder();
+    RefillProximityCache(Gear, 100);
 end;
 
 
--- a/hedgewars/uGearsUtils.pas	Wed Nov 28 21:35:54 2018 +0300
+++ b/hedgewars/uGearsUtils.pas	Thu Nov 29 01:23:14 2018 +0300
@@ -1336,7 +1336,7 @@
     dec(i);
     Gear:= t^.ar[i];
     if (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet,
-                       gtFirePunch, gtKamikaze, gtWhip, gtShover])
+                       gtFirePunch, gtKamikaze, gtWhip, gtShover, gtBlowtorch])
         and (((Ammo^.Data <> nil) and (PGear(Ammo^.Data) = Gear))
              or (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
         continue;