Fix freeze when aiming laser at 90° into sky
authorWuzzy <Wuzzy2@mail.ru>
Mon, 12 Oct 2020 01:25:04 +0200
changeset 15770 ff8bd08f7d98
parent 15769 ed3c5c15dcbd
child 15771 82fd124e6512
Fix freeze when aiming laser at 90° into sky
hedgewars/uGearsRender.pas
--- a/hedgewars/uGearsRender.pas	Mon Oct 12 01:01:28 2020 +0200
+++ b/hedgewars/uGearsRender.pas	Mon Oct 12 01:25:04 2020 +0200
@@ -550,14 +550,16 @@
                     tx:= round(lx);
                     ty:= round(ly);
                     // 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
+                    if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) and
+                        ((ty and LAND_HEIGHT_MASK) <> 0) and (((ty < LAND_HEIGHT) and (ay < 0)) or ((ty >= TopY) and (ay > 0))) then
                         begin
                         // 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;
+                    if ((WorldEdge = weWrap) or (WorldEdge = weBounce)) and (ty < -cCamLimitY) and (ay < 0) then
+                        break;
 
                     if ((hogLR < 0) and (tx < LeftX)) or ((hogLR > 0) and (tx >= RightX)) then
                         if (WorldEdge = weWrap) then