hedgewars/GSHandlers.inc
changeset 4281 e033cf015b2c
parent 4279 b697a26ed538
child 4297 88714b6f3676
--- a/hedgewars/GSHandlers.inc	Fri Nov 12 22:38:05 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Fri Nov 12 22:47:13 2010 +0100
@@ -761,15 +761,16 @@
         );
         if trail <> nil then
         begin
-            trail^.dX := Gear^.X.QWordValue / _1.QWordValue;
-            trail^.dY := Gear^.Y.QWordValue / _1.QWordValue;
+            // http://mantis.freepascal.org/view.php?id=17714 hits again
+            trail^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
+            trail^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
             
             // reached edge of land. assume infinite beam. Extend it way out past camera
             if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 
                 or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
             begin
-                trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / _1.QWordValue;
-                trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / _1.QWordValue;
+                trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
+                trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
             end;
             
             trail^.Timer := 200;