hedgewars/uLandPainted.pas
changeset 14437 96624a6cdb93
parent 11046 47a8c19ecb60
child 15162 af14c418c92f
equal deleted inserted replaced
14436:06672690d71b 14437:96624a6cdb93
    56         begin
    56         begin
    57         prec:= PPointRec(@s[i]);
    57         prec:= PPointRec(@s[i]);
    58         rec:= prec^;
    58         rec:= prec^;
    59         rec.X:= SDLNet_Read16(@rec.X);
    59         rec.X:= SDLNet_Read16(@rec.X);
    60         rec.Y:= SDLNet_Read16(@rec.Y);
    60         rec.Y:= SDLNet_Read16(@rec.Y);
       
    61 		
    61         if rec.X < -318 then rec.X:= -318;
    62         if rec.X < -318 then rec.X:= -318;
    62         if rec.X > 4096+318 then rec.X:= 4096+318;
    63         if rec.X > 4096+318 then rec.X:= 4096+318;
    63         if rec.Y < -318 then rec.Y:= -318;
    64         if rec.Y < -318 then rec.Y:= -318;
    64         if rec.Y > 2048+318 then rec.Y:= 2048+318;
    65         if rec.Y > 2048+318 then rec.Y:= 2048+318;
    65 
    66 
    79 
    80 
    80 procedure Draw;
    81 procedure Draw;
    81 var pe: PPointEntry;
    82 var pe: PPointEntry;
    82     prevPoint: PointRec;
    83     prevPoint: PointRec;
    83     radius: LongInt;
    84     radius: LongInt;
    84     color: Longword;
    85     color, Xoffset, Yoffset: Longword;
    85     lineNumber, linePoints: Longword;
    86     lineNumber, linePoints: Longword;
    86 begin
    87 begin
    87     // shutup compiler
    88     // shutup compiler
    88     prevPoint.X:= 0;
    89     prevPoint.X:= 0;
    89     prevPoint.Y:= 0;
    90     prevPoint.Y:= 0;
    90     radius:= 0;
    91     radius:= 0;
    91     linePoints:= 0;
    92     linePoints:= 0;
       
    93  	Xoffset:= (LAND_WIDTH-(4096*max(min(cFeatureSize,24),3) div 12)) div 2;
       
    94  	Yoffset:= (LAND_HEIGHT-(2048*max(min(cFeatureSize,24),3) div 12));
    92 
    95 
    93     pe:= pointsListHead;
    96     pe:= pointsListHead;
    94     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    97     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    95         begin
    98         begin
    96         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
    99         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
    99 
   102 
   100     lineNumber:= 0;
   103     lineNumber:= 0;
   101 
   104 
   102     while(pe <> nil) do
   105     while(pe <> nil) do
   103         begin
   106         begin
       
   107 		pe^.point.X:= (LongInt(pe^.point.X) * max(min(cFeatureSize,24),3)) div 12 + Xoffset;
       
   108 		pe^.point.Y:= (LongInt(pe^.point.Y) * max(min(cFeatureSize,24),3)) div 12 + Yoffset;
   104         if (pe^.point.flags and $80 <> 0) then
   109         if (pe^.point.flags and $80 <> 0) then
   105             begin
   110             begin
   106             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
   111             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
   107                     SendIPC('|' + inttostr(lineNumber - 1));
   112                     SendIPC('|' + inttostr(lineNumber - 1));
   108 
   113 
   111             if (pe^.point.flags and $40 <> 0) then
   116             if (pe^.point.flags and $40 <> 0) then
   112                 color:= 0
   117                 color:= 0
   113                 else
   118                 else
   114                 color:= lfBasic;
   119                 color:= lfBasic;
   115             radius:= (pe^.point.flags and $3F) * 5 + 3;
   120             radius:= (pe^.point.flags and $3F) * 5 + 3;
       
   121 			radius:= (radius * max(min(cFeatureSize,24),3)) div 12;
   116             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
   122             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
   117             end
   123             end
   118             else
   124 		else
   119             begin
   125             begin
   120             inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color));
   126             inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color));
   121             end;
   127             end;
   122 
   128 
   123         prevPoint:= pe^.point;
   129         prevPoint:= pe^.point;