hedgewars/uLandOutline.pas
branchwebgl
changeset 8330 aaefa587e277
parent 8145 6408c0ba4ba1
child 8850 ae8a957c69fd
equal deleted inserted replaced
8116:d24257910f8d 8330:aaefa587e277
    24            Count: Longword;
    24            Count: Longword;
    25            points: array[0..8192] of record
    25            points: array[0..8192] of record
    26                                      xl, xr, y, dir: LongInt;
    26                                      xl, xr, y, dir: LongInt;
    27                                      end
    27                                      end
    28            end;
    28            end;
       
    29 
       
    30 const
       
    31     cMaxEdgePoints = 16384;
    29 
    32 
    30 procedure Push(_xl, _xr, _y, _dir: LongInt);
    33 procedure Push(_xl, _xr, _y, _dir: LongInt);
    31 begin
    34 begin
    32     TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
    35     TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
    33     _y:= _y + _dir;
    36     _y:= _y + _dir;
    94 var i: LongInt;
    97 var i: LongInt;
    95 begin
    98 begin
    96     i:= 0;
    99     i:= 0;
    97     with pa do
   100     with pa do
    98         while i < LongInt(Count) - 1 do
   101         while i < LongInt(Count) - 1 do
    99             if (ar[i + 1].X = NTPX) then 
   102             if (ar[i + 1].X = NTPX) then
   100                 inc(i, 2)
   103                 inc(i, 2)
   101             else 
   104             else
   102                 begin
   105                 begin
   103                 DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
   106                 DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
   104                 inc(i)
   107                 inc(i)
   105                 end
   108                 end
   106 end;
   109 end;
   125 
   128 
   126     if d2.QWordValue = 0 then
   129     if d2.QWordValue = 0 then
   127         begin
   130         begin
   128         Vx:= _0;
   131         Vx:= _0;
   129         Vy:= _0
   132         Vy:= _0
   130         end 
   133         end
   131     else
   134     else
   132         begin
   135         begin
   133         d2:= _1 / d2;
   136         d2:= _1 / d2;
   134         Vx:= Vx * d2;
   137         Vx:= Vx * d2;
   135         Vy:= Vy * d2;
   138         Vy:= Vy * d2;
   232     begin
   235     begin
   233         if (c1 < 0) or (c1 > dm) then
   236         if (c1 < 0) or (c1 > dm) then
   234             CheckIntersect:= false
   237             CheckIntersect:= false
   235         else if (c2 < 0) or (c2 > dm) then
   238         else if (c2 < 0) or (c2 > dm) then
   236             CheckIntersect:= false;
   239             CheckIntersect:= false;
   237     end 
   240     end
   238     else
   241     else
   239     begin
   242     begin
   240         if (c1 > 0) or (c1 < dm) then
   243         if (c1 > 0) or (c1 < dm) then
   241             CheckIntersect:= false
   244             CheckIntersect:= false
   242         else if (c2 > 0) or (c2 < dm) then
   245         else if (c2 > 0) or (c2 < dm) then