hedgewars/uLandPainted.pas
changeset 15245 4195d2852974
parent 15162 490bd70dac6e
equal deleted inserted replaced
15244:de53425ebc39 15245:4195d2852974
    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 
    62         if rec.X < -318 then rec.X:= -318;
    62         if rec.X < -318 then rec.X:= -318;
    63         if rec.X > 4096+318 then rec.X:= 4096+318;
    63         if rec.X > 4096+318 then rec.X:= 4096+318;
    64         if rec.Y < -318 then rec.Y:= -318;
    64         if rec.Y < -318 then rec.Y:= -318;
    65         if rec.Y > 2048+318 then rec.Y:= 2048+318;
    65         if rec.Y > 2048+318 then rec.Y:= 2048+318;
    66 
    66 
    88     // shutup compiler
    88     // shutup compiler
    89     prevPoint.X:= 0;
    89     prevPoint.X:= 0;
    90     prevPoint.Y:= 0;
    90     prevPoint.Y:= 0;
    91     radius:= 0;
    91     radius:= 0;
    92     linePoints:= 0;
    92     linePoints:= 0;
    93  	Xoffset:= (LAND_WIDTH-(4096*max(min(cFeatureSize,24),3) div 12)) div 2;
    93     Xoffset:= (LAND_WIDTH-(playWidth)) div 2;
    94  	Yoffset:= (LAND_HEIGHT-(2048*max(min(cFeatureSize,24),3) div 12));
    94     Yoffset:= LAND_HEIGHT-(playHeight);
    95 
    95 
    96     pe:= pointsListHead;
    96     pe:= pointsListHead;
    97     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    97     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
    98         begin
    98         begin
    99         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
    99         ScriptCall('onSpecialPoint', pe^.point.X, pe^.point.Y, pe^.point.flags);
   102 
   102 
   103     lineNumber:= 0;
   103     lineNumber:= 0;
   104 
   104 
   105     while(pe <> nil) do
   105     while(pe <> nil) do
   106         begin
   106         begin
   107 		pe^.point.X:= (LongInt(pe^.point.X) * max(min(cFeatureSize,24),3)) div 12 + Xoffset;
   107         pe^.point.X:= LongInt(pe^.point.X) * playWidth div 4096 + Xoffset;
   108 		pe^.point.Y:= (LongInt(pe^.point.Y) * max(min(cFeatureSize,24),3)) div 12 + Yoffset;
   108         pe^.point.Y:= LongInt(pe^.point.Y) * playHeight div 2048 + Yoffset;
   109         if (pe^.point.flags and $80 <> 0) then
   109         if (pe^.point.flags and $80 <> 0) then
   110             begin
   110             begin
   111             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
   111             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
   112                     SendIPC('|' + inttostr(lineNumber - 1));
   112                     SendIPC('|' + inttostr(lineNumber - 1));
   113 
   113 
   116             if (pe^.point.flags and $40 <> 0) then
   116             if (pe^.point.flags and $40 <> 0) then
   117                 color:= 0
   117                 color:= 0
   118                 else
   118                 else
   119                 color:= lfBasic;
   119                 color:= lfBasic;
   120             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;
   121             radius:= (radius * playWidth div 4096);
   122             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
   122             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
   123             end
   123             end
   124 		else
   124         else
   125             begin
   125             begin
   126             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));
   127             end;
   127             end;
   128 
   128 
   129         prevPoint:= pe^.point;
   129         prevPoint:= pe^.point;