hedgewars/uLandPainted.pas
changeset 6873 30840365af0a
parent 6781 23f627ba8ee9
child 6898 344b0dbd9690
equal deleted inserted replaced
6872:0f6eef4a07c8 6873:30840365af0a
    41         next: PPointEntry;
    41         next: PPointEntry;
    42         end;
    42         end;
    43 
    43 
    44 var pointsListHead, pointsListLast: PPointEntry;
    44 var pointsListHead, pointsListLast: PPointEntry;
    45 
    45 
    46 procedure DrawLineOnLand(X1, Y1, X2, Y2, radius: LongInt);
    46 procedure DrawLineOnLand(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
    47 var  eX, eY, dX, dY: LongInt;
    47 var  eX, eY, dX, dY: LongInt;
    48     i, sX, sY, x, y, d: LongInt;
    48     i, sX, sY, x, y, d: LongInt;
    49     b: boolean;
    49     b: boolean;
    50     len: LongWord;
    50     len: LongWord;
    51 begin
    51 begin
   108                 end;
   108                 end;
   109             if b then
   109             if b then
   110                 begin
   110                 begin
   111                 inc(len);
   111                 inc(len);
   112                 if (len mod 4) = 0 then
   112                 if (len mod 4) = 0 then
   113                     FillRoundInLand(X, Y, radius, lfBasic)
   113                     FillRoundInLand(X, Y, radius, color)
   114                 end
   114                 end
   115         end
   115         end
   116 end;
   116 end;
   117 
   117 
   118 procedure chDraw(var s: shortstring);
   118 procedure chDraw(var s: shortstring);
   146 
   146 
   147 procedure Draw;
   147 procedure Draw;
   148 var pe: PPointEntry;
   148 var pe: PPointEntry;
   149     prevPoint: PointRec;
   149     prevPoint: PointRec;
   150     radius: LongInt;
   150     radius: LongInt;
       
   151     color: Longword;
   151 begin
   152 begin
   152     // shutup compiler
   153     // shutup compiler
   153     prevPoint.X:= 0;
   154     prevPoint.X:= 0;
   154     prevPoint.Y:= 0;
   155     prevPoint.Y:= 0;
   155     radius:= 0;
   156     radius:= 0;
   159 
   160 
   160     while(pe <> nil) do
   161     while(pe <> nil) do
   161         begin
   162         begin
   162         if (pe^.point.flags and $80 <> 0) then
   163         if (pe^.point.flags and $80 <> 0) then
   163             begin
   164             begin
   164             radius:= (pe^.point.flags and $7F) * 5 + 3;
   165             if (pe^.point.flags and $40 <> 0) then
   165             AddFileLog('[DRAW] Move to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   166                 color:= 0
   166             FillRoundInLand(pe^.point.X, pe^.point.Y, radius, lfBasic)
   167                 else
       
   168                 color:= lfBasic;
       
   169             radius:= (pe^.point.flags and $3F) * 5 + 3;
       
   170             AddFileLog('[DRAW] Move to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+'), radius = '+inttostr(radius));
       
   171             FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color)
   167             end
   172             end
   168             else
   173             else
   169             begin
   174             begin
   170             AddFileLog('[DRAW] Line to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   175             AddFileLog('[DRAW] Line to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+'), radius = '+inttostr(radius));
   171             DrawLineOnLand(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius);
   176             DrawLineOnLand(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color);
   172             end;
   177             end;
   173 
   178 
   174         prevPoint:= pe^.point;
   179         prevPoint:= pe^.point;
   175         pe:= pe^.next;  
   180         pe:= pe^.next;  
   176         end;
   181         end;