hedgewars/uLandOutline.pas
changeset 10015 4feced261c68
parent 8850 ae8a957c69fd
child 10189 875607ce793d
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    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 
    29 
    30 const
       
    31     cMaxEdgePoints = 16384;
       
    32 
    30 
    33 procedure Push(_xl, _xr, _y, _dir: LongInt);
    31 procedure Push(_xl, _xr, _y, _dir: LongInt);
    34 begin
    32 begin
    35     TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
    33     TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
    36     _y:= _y + _dir;
    34     _y:= _y + _dir;
    97 var i: LongInt;
    95 var i: LongInt;
    98 begin
    96 begin
    99     i:= 0;
    97     i:= 0;
   100     with pa do
    98     with pa do
   101         while i < LongInt(Count) - 1 do
    99         while i < LongInt(Count) - 1 do
   102             if (ar[i + 1].X = NTPX) then 
   100             if (ar[i + 1].X = NTPX) then
   103                 inc(i, 2)
   101                 inc(i, 2)
   104             else 
   102             else
   105                 begin
   103                 begin
   106                 DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
   104                 DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
   107                 inc(i)
   105                 inc(i)
   108                 end
   106                 end
   109 end;
   107 end;
   128 
   126 
   129     if d2.QWordValue = 0 then
   127     if d2.QWordValue = 0 then
   130         begin
   128         begin
   131         Vx:= _0;
   129         Vx:= _0;
   132         Vy:= _0
   130         Vy:= _0
   133         end 
   131         end
   134     else
   132     else
   135         begin
   133         begin
   136         d2:= _1 / d2;
   134         d2:= _1 / d2;
   137         Vx:= Vx * d2;
   135         Vx:= Vx * d2;
   138         Vy:= Vy * d2;
   136         Vy:= Vy * d2;
   235     begin
   233     begin
   236         if (c1 < 0) or (c1 > dm) then
   234         if (c1 < 0) or (c1 > dm) then
   237             CheckIntersect:= false
   235             CheckIntersect:= false
   238         else if (c2 < 0) or (c2 > dm) then
   236         else if (c2 < 0) or (c2 > dm) then
   239             CheckIntersect:= false;
   237             CheckIntersect:= false;
   240     end 
   238     end
   241     else
   239     else
   242     begin
   240     begin
   243         if (c1 > 0) or (c1 < dm) then
   241         if (c1 > 0) or (c1 < dm) then
   244             CheckIntersect:= false
   242             CheckIntersect:= false
   245         else if (c2 > 0) or (c2 < dm) then
   243         else if (c2 > 0) or (c2 < dm) then