hedgewars/uLandUtils.pas
changeset 10198 e9cbe111c0df
child 10626 2562797ab3cf
equal deleted inserted replaced
10197:c57798251b55 10198:e9cbe111c0df
       
     1 unit uLandUtils;
       
     2 interface
       
     3 
       
     4 procedure ResizeLand(width, height: LongWord);
       
     5 
       
     6 implementation
       
     7 uses uUtils, uConsts, uVariables;
       
     8 
       
     9 procedure ResizeLand(width, height: LongWord);
       
    10 var potW, potH: LongInt;
       
    11 begin
       
    12 potW:= toPowerOf2(width);
       
    13 potH:= toPowerOf2(height);
       
    14 if (potW <> LAND_WIDTH) or (potH <> LAND_HEIGHT) then
       
    15     begin
       
    16     LAND_WIDTH:= potW;
       
    17     LAND_HEIGHT:= potH;
       
    18     LAND_WIDTH_MASK:= not(LAND_WIDTH-1);
       
    19     LAND_HEIGHT_MASK:= not(LAND_HEIGHT-1);
       
    20     cWaterLine:= LAND_HEIGHT;
       
    21     if (cReducedQuality and rqBlurryLand) = 0 then
       
    22         SetLength(LandPixels, LAND_HEIGHT, LAND_WIDTH)
       
    23     else
       
    24         SetLength(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2);
       
    25 
       
    26     SetLength(Land, LAND_HEIGHT, LAND_WIDTH);
       
    27     SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
       
    28     // 0.5 is already approaching on unplayable
       
    29     if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= 0.5;
       
    30     cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel
       
    31     end;
       
    32 end;
       
    33 
       
    34 end.