Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
authorWuzzy <Wuzzy2@mail.ru>
Sat, 12 Jan 2019 23:26:33 +0100
changeset 14560 45c6c12c12e2
parent 14559 da2094316dd7
child 14561 c8436da5c58b
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug #718)
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Sat Jan 12 06:38:20 2019 +0100
+++ b/ChangeLog.txt	Sat Jan 12 23:26:33 2019 +0100
@@ -29,6 +29,7 @@
 
 Graphics:
  + Show contour of flying saucer when in highly opaque water
+ * Fix wrong ice beam angle if it goes diagonally up out of map through world wrap
  * Fix double water splash when flying saucer drowns
 
 Game HUD:
--- a/hedgewars/uGearsHandlersMess.pas	Sat Jan 12 06:38:20 2019 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Jan 12 23:26:33 2019 +0100
@@ -6377,7 +6377,11 @@
             Timer := iceWaitCollision;
             FlightTime := 0;
             end
-        else
+        // Extend ice beam, unless it is far outside he map boundaries
+        else if (not ((hwRound(X + dX) > max(LAND_WIDTH,4096)*2) or
+            (hwRound(X + dX) < -max(LAND_WIDTH,4096)*2) or
+            (hwRound(Y + dY) < -max(LAND_HEIGHT,4096)*2) or
+            (hwRound(Y + dY) > max(LAND_HEIGHT,4096)+512))) then
             begin
             X:= X + dX;
             Y:= Y + dY;
@@ -6582,16 +6586,6 @@
                     Y:= HHGear^.Y
                     end 
                 end;
-            if (gX > max(LAND_WIDTH,4096)*2) or
-                    (gX < -max(LAND_WIDTH,4096)) or
-                    (gY < -max(LAND_HEIGHT,4096)) or
-                    (gY > max(LAND_HEIGHT,4096)+512) then
-                begin
-                //X:= HHGear^.X;
-                //Y:= HHGear^.Y
-                Target.X:= gX;
-                Target.Y:= gY;
-                end
         end
     end;
 end;