hedgewars/uGearsRender.pas
changeset 15768 ff18f99f3f5d
parent 15737 e0cdb6ae88ab
child 15769 ed3c5c15dcbd
--- a/hedgewars/uGearsRender.pas	Thu Oct 08 20:38:19 2020 +0200
+++ b/hedgewars/uGearsRender.pas	Mon Oct 12 00:46:19 2020 +0200
@@ -549,8 +549,9 @@
                     ly:= ly + ay;
                     tx:= round(lx);
                     ty:= round(ly);
-                    // reached edge of land.
-                    if ((ty and LAND_HEIGHT_MASK) <> 0) and (((ty < LAND_HEIGHT) and (ay < 0)) or ((ty >= TopY) and (ay > 0))) then
+                    // reached top edge of land mask
+                    if ((ty and LAND_HEIGHT_MASK) <> 0) and (((ty < LAND_HEIGHT) and (ay < 0)) or ((ty >= TopY) and (ay > 0))) and
+                        (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
                         begin
                         // assume infinite beam. Extend it way out past camera
                         tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
@@ -573,16 +574,16 @@
                             // just stop
                             break;
 
-                    if ((tx and LAND_WIDTH_MASK) <> 0) and (((ax > 0) and (tx >= RightX)) or ((ax < 0) and (tx <= LeftX))) then
+                    // reached horizontal edge of land mask
+                    if ((tx and LAND_WIDTH_MASK) <> 0) and (((ax > 0) and (tx >= RightX)) or ((ax < 0) and (tx <= LeftX))) and
+                        (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
                         begin
-                        if (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
-                            // assume infinite beam. Extend it way out past camera
-                            begin
-                            tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
-                            ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
-                            end;
+                        // assume infinite beam. Extend it way out past camera
+                        tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
+                        ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
                         break;
                         end;
+
                     inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
                     end;