hedgewars/uLandPainted.pas
changeset 10246 8da91cd7a32a
parent 10244 f7b5b4b88171
child 11046 47a8c19ecb60
equal deleted inserted replaced
10245:3ccc054c3c3e 10246:8da91cd7a32a
    25 procedure Draw;
    25 procedure Draw;
    26 procedure initModule;
    26 procedure initModule;
    27 procedure freeModule;
    27 procedure freeModule;
    28 
    28 
    29 implementation
    29 implementation
    30 uses uLandGraphics, uConsts, uVariables, uUtils, SDLh, uCommands, uScript;
    30 uses uLandGraphics, uConsts, uVariables, uUtils, SDLh, uCommands, uScript, uIO;
    31 
    31 
    32 type PointRec = packed record
    32 type PointRec = packed record
    33     X, Y: SmallInt;
    33     X, Y: SmallInt;
    34     flags: byte;
    34     flags: byte;
    35     end;
    35     end;
    80 procedure Draw;
    80 procedure Draw;
    81 var pe: PPointEntry;
    81 var pe: PPointEntry;
    82     prevPoint: PointRec;
    82     prevPoint: PointRec;
    83     radius: LongInt;
    83     radius: LongInt;
    84     color: Longword;
    84     color: Longword;
    85     linePoints: Longword;
    85     lineNumber, linePoints: Longword;
    86 begin
    86 begin
    87     // shutup compiler
    87     // shutup compiler
    88     prevPoint.X:= 0;
    88     prevPoint.X:= 0;
    89     prevPoint.Y:= 0;
    89     prevPoint.Y:= 0;
    90     radius:= 0;
    90     radius:= 0;
       
    91     linePoints:= 0;
    91 
    92 
    92     pe:= pointsListHead;
    93     pe:= pointsListHead;
    93     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    94     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    94         begin
    95         begin
    95         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
    96         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
    96         pe:= pe^.next;
    97         pe:= pe^.next;
    97         end;
    98         end;
    98 
    99 
       
   100     lineNumber:= 0;
       
   101 
    99     while(pe <> nil) do
   102     while(pe <> nil) do
   100         begin
   103         begin
   101         if (pe^.point.flags and $80 <> 0) then
   104         if (pe^.point.flags and $80 <> 0) then
   102             begin
   105             begin
   103             if (pe^.point.flags and $40 <> 0) and (not cAdvancedMapGenMode) then
   106             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
       
   107                     SendIPC('|' + inttostr(lineNumber - 1));
       
   108 
       
   109             inc(lineNumber);
       
   110 
       
   111             if (pe^.point.flags and $40 <> 0) then
   104                 color:= 0
   112                 color:= 0
   105                 else
   113                 else
   106                 color:= lfBasic;
   114                 color:= lfBasic;
   107             radius:= (pe^.point.flags and $3F) * 5 + 3;
   115             radius:= (pe^.point.flags and $3F) * 5 + 3;
   108             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color)
   116             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
   109             end
   117             end
   110             else
   118             else
   111             begin
   119             begin
   112             inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color));
   120             inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color));
   113             end;
   121             end;