# HG changeset patch # User Wuzzy # Date 1557624463 -7200 # Node ID e28ff0f1aca2c64118cb20821df7d1b30ce8457f # Parent d82b54399e7e99f2c03ed8c957bcf01b1caa8411 Fix laser sight not working when it starts out of map bounds (bug 432) diff -r d82b54399e7e -r e28ff0f1aca2 ChangeLog.txt --- a/ChangeLog.txt Sat May 11 23:40:24 2019 +0200 +++ b/ChangeLog.txt Sun May 12 03:27:43 2019 +0200 @@ -18,6 +18,7 @@ * Deny placement of airborne attack in “impossible” places in maps with bounce world edge * Deny placement of piano beyond bounce world edge * Fix cut scenes not being skipped when pressing precise in enemy turn + * Fix laser sight not working properly when it starts out of map bounds Styles and schemes: + The Specialists: Unlock game scheme diff -r d82b54399e7e -r e28ff0f1aca2 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Sat May 11 23:40:24 2019 +0200 +++ b/hedgewars/uGearsRender.pas Sun May 12 03:27:43 2019 +0200 @@ -506,7 +506,7 @@ hy:= ty; wraps:= 0; inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0; - while inWorldBounds and ((Land[ty, tx] and lfAll) = 0) do + while (inWorldBounds and ((Land[ty, tx] and lfAll) = 0)) or (not inWorldBounds) do begin if wraps > cMaxLaserSightWraps then break; @@ -515,7 +515,7 @@ tx:= round(lx); ty:= round(ly); // reached edge of land. - if ((ty and LAND_HEIGHT_MASK) <> 0) then + if ((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)); @@ -538,7 +538,7 @@ // just stop break; - if ((tx and LAND_WIDTH_MASK) <> 0) then + if ((tx and LAND_WIDTH_MASK) <> 0) and (((ax > 0) and (tx >= RightX)) or ((ax < 0) and (tx <= LeftX))) then begin if (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then // assume infinite beam. Extend it way out past camera @@ -548,6 +548,7 @@ end; break; end; + inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0; end; DrawLineWrapped(hx, hy, tx, ty, 1.0, (sign*m) < 0, wraps, $FF, $00, $00, $C0);