hedgewars/uLand.pas
changeset 5441 39962b855540
parent 5274 941da059472b
child 5495 272ed78e59a7
child 5687 fac606654317
equal deleted inserted replaced
5439:25d3784dc0f6 5441:39962b855540
  1094                     else if Land[y-1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y-1, x];
  1094                     else if Land[y-1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y-1, x];
  1095                     LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift)
  1095                     LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift)
  1096                     end;
  1096                     end;
  1097                 Land[y,x]:= lfObject
  1097                 Land[y,x]:= lfObject
  1098             end;
  1098             end;
       
  1099 
  1099     AddProgress();
  1100     AddProgress();
  1100 end;
  1101 end;
  1101 
  1102 
  1102 procedure MakeFortsMap;
  1103 procedure MakeFortsMap;
  1103 var tmpsurf: PSDL_Surface;
  1104 var tmpsurf: PSDL_Surface;
  1312     then AddObjects
  1313     then AddObjects
  1313 else AddProgress();
  1314 else AddProgress();
  1314 
  1315 
  1315 FreeLandObjects;
  1316 FreeLandObjects;
  1316 
  1317 
       
  1318 if cGrayScale then
       
  1319     begin
       
  1320     if (cReducedQuality and rqBlurryLand) = 0 then
       
  1321         for x:= leftX to rightX do
       
  1322             for y:= topY to LAND_HEIGHT-1 do
       
  1323                 begin
       
  1324                 w:= LandPixels[y,x];
       
  1325                 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED +
       
  1326                       (w shr BShift and $FF) * RGB_LUMINANCE_GREEN +
       
  1327                       (w shr GShift and $FF) * RGB_LUMINANCE_BLUE));
       
  1328                 if w > 255 then w:= 255;
       
  1329                 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y,x] and AMask);
       
  1330                 LandPixels[y,x]:= w or (LandPixels[y, x] and AMask)
       
  1331                 end
       
  1332     else
       
  1333         for x:= leftX div 2 to rightX div 2 do
       
  1334             for y:= topY div 2 to LAND_HEIGHT-1 div 2 do
       
  1335                 begin
       
  1336                 w:= LandPixels[y div 2,x div 2];
       
  1337                 w:= ((w shr RShift and $FF) +  (w shr BShift and $FF) + (w shr GShift and $FF)) div 3;
       
  1338                 if w > 255 then w:= 255;
       
  1339                w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask);
       
  1340                 LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask)
       
  1341                 end
       
  1342     end;
       
  1343 
  1317 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT);
  1344 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT);
  1318 end;
  1345 end;
  1319 
  1346 
  1320 function GenPreview: TPreview;
  1347 function GenPreview: TPreview;
  1321 var x, y, xx, yy, t, bit, cbit, lh, lw: LongInt;
  1348 var x, y, xx, yy, t, bit, cbit, lh, lw: LongInt;