potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
authorsheepluva
Sun, 31 Oct 2010 02:50:15 +0100
changeset 4038 8972dd38bbad
parent 4037 0f8ec120e90d
child 4039 6769180a8736
potential fix for issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sat Oct 30 21:48:47 2010 -0400
+++ b/hedgewars/GSHandlers.inc	Sun Oct 31 02:50:15 2010 +0100
@@ -3413,8 +3413,20 @@
 
         hasdxy := ((iterator^.dX.QWordValue <> 0) or (iterator^.dY.QWordValue <> 0));
 
+        // in case the object is not moving, let's asume it's moving towards the portal
+        if not hasdxy then
+        begin
+            ox:= Gear^.X - iterator^.X;
+            oy:= Gear^.Y - iterator^.Y;
+        end
+        else
+        begin
+            ox:= iterator^.dX;
+            oy:= iterator^.dY;
+        end;
+
         // won't port stuff that moves away from me!
-        if hasdxy and not (Gear^.dX*iterator^.dX + Gear^.dY*iterator^.dY).isNegative then
+        if not (Gear^.dX*ox + Gear^.dY*oy).isNegative then
                 continue;
 
         if (iterator^.Kind <> gtCake) then