add some target tracking to sentries
authoralfadur
Tue, 30 Jun 2020 19:09:04 +0300
changeset 15657 72173f800dc4
parent 15656 c34cad72cd85
child 15658 d23ebe7c88f8
add some target tracking to sentries
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Tue Jun 30 02:18:54 2020 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Tue Jun 30 19:09:04 2020 +0300
@@ -7328,6 +7328,16 @@
             Gear^.Timer := 0
     end;
 
+    if ((GameTicks and $1F) = 0)
+        and (Gear^.Tag = sentry_Aiming)
+        and (CurrentHedgehog <> nil)
+        and (CurrentHedgehog^.Gear <> nil) then
+    begin
+        HHGear := CurrentHedgehog^.Gear;
+        Gear^.Target.X := Gear^.Target.X + hwSign(HHGear^.X - int2hwFloat(Gear^.Target.X));
+        Gear^.Target.Y := Gear^.Target.Y + hwSign(HHGear^.Y - int2hwFloat(Gear^.Target.Y));
+    end;
+
     if ((GameTicks and $FF) = 0)
         and (Gear^.Tag in [sentry_Idle, sentry_Walking])
         and (CurrentHedgehog <> nil)