Drawn maps: Update uLandPainted scaling to match the new map bounds
authorWuzzy <Wuzzy2@mail.ru>
Mon, 15 Jul 2019 10:36:00 +0200
changeset 15261 4195d2852974
parent 15260 de53425ebc39
child 15262 313c9b3a095b
Drawn maps: Update uLandPainted scaling to match the new map bounds
hedgewars/uLandPainted.pas
--- a/hedgewars/uLandPainted.pas	Fri Jul 12 00:07:09 2019 +0200
+++ b/hedgewars/uLandPainted.pas	Mon Jul 15 10:36:00 2019 +0200
@@ -58,7 +58,7 @@
         rec:= prec^;
         rec.X:= SDLNet_Read16(@rec.X);
         rec.Y:= SDLNet_Read16(@rec.Y);
-		
+
         if rec.X < -318 then rec.X:= -318;
         if rec.X > 4096+318 then rec.X:= 4096+318;
         if rec.Y < -318 then rec.Y:= -318;
@@ -90,8 +90,8 @@
     prevPoint.Y:= 0;
     radius:= 0;
     linePoints:= 0;
- 	Xoffset:= (LAND_WIDTH-(4096*max(min(cFeatureSize,24),3) div 12)) div 2;
- 	Yoffset:= (LAND_HEIGHT-(2048*max(min(cFeatureSize,24),3) div 12));
+    Xoffset:= (LAND_WIDTH-(playWidth)) div 2;
+    Yoffset:= LAND_HEIGHT-(playHeight);
 
     pe:= pointsListHead;
     while (pe <> nil) and (pe^.point.flags and $80 = 0) do
@@ -104,8 +104,8 @@
 
     while(pe <> nil) do
         begin
-		pe^.point.X:= (LongInt(pe^.point.X) * max(min(cFeatureSize,24),3)) div 12 + Xoffset;
-		pe^.point.Y:= (LongInt(pe^.point.Y) * max(min(cFeatureSize,24),3)) div 12 + Yoffset;
+        pe^.point.X:= LongInt(pe^.point.X) * playWidth div 4096 + Xoffset;
+        pe^.point.Y:= LongInt(pe^.point.Y) * playHeight div 2048 + Yoffset;
         if (pe^.point.flags and $80 <> 0) then
             begin
             if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
@@ -118,10 +118,10 @@
                 else
                 color:= lfBasic;
             radius:= (pe^.point.flags and $3F) * 5 + 3;
-			radius:= (radius * max(min(cFeatureSize,24),3)) div 12;
+            radius:= (radius * playWidth div 4096);
             linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
             end
-		else
+        else
             begin
             inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color));
             end;