hedgewars/uGearsRender.pas
changeset 15746 ff18f99f3f5d
parent 15715 e0cdb6ae88ab
child 15747 ed3c5c15dcbd
equal deleted inserted replaced
15745:bbcf037af2f2 15746:ff18f99f3f5d
   547                         break;
   547                         break;
   548                     lx:= lx + ax;
   548                     lx:= lx + ax;
   549                     ly:= ly + ay;
   549                     ly:= ly + ay;
   550                     tx:= round(lx);
   550                     tx:= round(lx);
   551                     ty:= round(ly);
   551                     ty:= round(ly);
   552                     // reached edge of land.
   552                     // reached top edge of land mask
   553                     if ((ty and LAND_HEIGHT_MASK) <> 0) and (((ty < LAND_HEIGHT) and (ay < 0)) or ((ty >= TopY) and (ay > 0))) then
   553                     if ((ty and LAND_HEIGHT_MASK) <> 0) and (((ty < LAND_HEIGHT) and (ay < 0)) or ((ty >= TopY) and (ay > 0))) and
       
   554                         (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
   554                         begin
   555                         begin
   555                         // assume infinite beam. Extend it way out past camera
   556                         // assume infinite beam. Extend it way out past camera
   556                         tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
   557                         tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
   557                         ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
   558                         ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
   558                         break;
   559                         break;
   571                             end
   572                             end
   572                         else if (WorldEdge = weBounce) then
   573                         else if (WorldEdge = weBounce) then
   573                             // just stop
   574                             // just stop
   574                             break;
   575                             break;
   575 
   576 
   576                     if ((tx and LAND_WIDTH_MASK) <> 0) and (((ax > 0) and (tx >= RightX)) or ((ax < 0) and (tx <= LeftX))) then
   577                     // reached horizontal edge of land mask
   577                         begin
   578                     if ((tx and LAND_WIDTH_MASK) <> 0) and (((ax > 0) and (tx >= RightX)) or ((ax < 0) and (tx <= LeftX))) and
   578                         if (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
   579                         (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then
   579                             // assume infinite beam. Extend it way out past camera
   580                         begin
   580                             begin
   581                         // assume infinite beam. Extend it way out past camera
   581                             tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
   582                         tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2));
   582                             ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
   583                         ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2));
   583                             end;
       
   584                         break;
   584                         break;
   585                         end;
   585                         end;
       
   586 
   586                     inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
   587                     inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
   587                     end;
   588                     end;
   588 
   589 
   589                 DrawLineWrapped(hx, hy, tx, ty, 1.0, hogLR < 0, wraps, $FF, $00, $00, $C0);
   590                 DrawLineWrapped(hx, hy, tx, ty, 1.0, hogLR < 0, wraps, $FF, $00, $00, $C0);
   590                 end;
   591                 end;