hedgewars/uLandPainted.pas
changeset 6781 23f627ba8ee9
parent 6700 e04da46ee43c
child 6873 30840365af0a
equal deleted inserted replaced
6780:166ee5275915 6781:23f627ba8ee9
    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: LongInt);
    46 procedure DrawLineOnLand(X1, Y1, X2, Y2, radius: LongInt);
    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, 34, lfBasic)
   113                     FillRoundInLand(X, Y, radius, lfBasic)
   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);
   145 end;
   145 end;
   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 begin
   151 begin
   151     // shutup compiler
   152     // shutup compiler
   152     prevPoint.X:= 0;
   153     prevPoint.X:= 0;
   153     prevPoint.Y:= 0;
   154     prevPoint.Y:= 0;
       
   155     radius:= 0;
   154 
   156 
   155     pe:= pointsListHead;
   157     pe:= pointsListHead;
   156     TryDo((pe = nil) or (pe^.point.flags and $80 <> 0), 'Corrupted draw data', true);
   158     TryDo((pe = nil) or (pe^.point.flags and $80 <> 0), 'Corrupted draw data', true);
   157 
   159 
   158     while(pe <> nil) do
   160     while(pe <> nil) do
   159         begin
   161         begin
   160         if (pe^.point.flags and $80 <> 0) then
   162         if (pe^.point.flags and $80 <> 0) then
   161             begin
   163             begin
       
   164             radius:= (pe^.point.flags and $7F) * 5 + 3;
   162             AddFileLog('[DRAW] Move to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   165             AddFileLog('[DRAW] Move to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   163             FillRoundInLand(pe^.point.X, pe^.point.Y, 34, lfBasic)
   166             FillRoundInLand(pe^.point.X, pe^.point.Y, radius, lfBasic)
   164             end
   167             end
   165             else
   168             else
   166             begin
   169             begin
   167             AddFileLog('[DRAW] Line to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   170             AddFileLog('[DRAW] Line to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
   168             DrawLineOnLand(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y);
   171             DrawLineOnLand(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius);
   169             end;
   172             end;
   170 
   173 
   171         prevPoint:= pe^.point;
   174         prevPoint:= pe^.point;
   172         pe:= pe^.next;  
   175         pe:= pe^.next;  
   173         end;
   176         end;