hedgewars/uLand.pas
branchhedgeroid
changeset 5495 272ed78e59a7
parent 5286 22c1f4833a86
parent 5441 39962b855540
child 5725 e27100a0e2d0
equal deleted inserted replaced
5479:b9aed3de7c27 5495:272ed78e59a7
  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;