hedgewars/uLandTexture.pas
changeset 3595 341e407e3754
parent 3513 f589230fa21b
child 3612 b50215a8a43d
equal deleted inserted replaced
3594:aeca3d8f1b29 3595:341e407e3754
    68 end;
    68 end;
    69 
    69 
    70 procedure UpdateLandTexture(X, Width, Y, Height: LongInt);
    70 procedure UpdateLandTexture(X, Width, Y, Height: LongInt);
    71 var tx, ty: Longword;
    71 var tx, ty: Longword;
    72 begin
    72 begin
    73 if (Width <= 0) or (Height <= 0) then exit;
    73     if (Width <= 0) or (Height <= 0) then exit;
    74 TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true);
    74     TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true);
    75 TryDo(X + Width <= LAND_WIDTH, 'UpdateLandTexture: wrong Width parameter', true);
    75     TryDo(X + Width <= LAND_WIDTH, 'UpdateLandTexture: wrong Width parameter', true);
    76 TryDo((Y >= 0) and (Y < LAND_HEIGHT), 'UpdateLandTexture: wrong Y parameter', true);
    76     TryDo((Y >= 0) and (Y < LAND_HEIGHT), 'UpdateLandTexture: wrong Y parameter', true);
    77 TryDo(Y + Height <= LAND_HEIGHT, 'UpdateLandTexture: wrong Height parameter', true);
    77     TryDo(Y + Height <= LAND_HEIGHT, 'UpdateLandTexture: wrong Height parameter', true);
    78 
    78 
    79 {$IFDEF DOWNSCALE}
    79     if (cReducedQuality and rqBlurryLand) = 0 then
    80 for ty:= (Y div TEXSIZE) div 2 to ((Y + Height - 1) div TEXSIZE) div 2 do
    80         for ty:= Y div TEXSIZE to (Y + Height - 1) div TEXSIZE do
    81     for tx:= (X div TEXSIZE) div 2 to ((X + Width - 1) div TEXSIZE) div 2 do
    81             for tx:= X div TEXSIZE to (X + Width - 1) div TEXSIZE do
    82         LandTextures[tx, ty].shouldUpdate:= true
    82                 LandTextures[tx, ty].shouldUpdate:= true
    83 {$ELSE}
    83     else
    84 for ty:= Y div TEXSIZE to (Y + Height - 1) div TEXSIZE do
    84         for ty:= (Y div TEXSIZE) div 2 to ((Y + Height - 1) div TEXSIZE) div 2 do
    85     for tx:= X div TEXSIZE to (X + Width - 1) div TEXSIZE do
    85             for tx:= (X div TEXSIZE) div 2 to ((X + Width - 1) div TEXSIZE) div 2 do
    86         LandTextures[tx, ty].shouldUpdate:= true
    86                 LandTextures[tx, ty].shouldUpdate:= true;
    87 {$ENDIF}
       
    88 end;
    87 end;
    89 
    88 
    90 procedure RealLandTexUpdate;
    89 procedure RealLandTexUpdate;
    91 var x, y: LongWord;
    90 var x, y: LongWord;
    92 begin
    91 begin
   117 RealLandTexUpdate;
   116 RealLandTexUpdate;
   118 
   117 
   119 for x:= 0 to LANDTEXARW -1 do
   118 for x:= 0 to LANDTEXARW -1 do
   120     for y:= 0 to LANDTEXARH - 1 do
   119     for y:= 0 to LANDTEXARH - 1 do
   121         with LandTextures[x, y] do
   120         with LandTextures[x, y] do
   122 {$IFDEF DOWNSCALE}
   121             if (cReducedQuality and rqBlurryLand) = 0 then
   123             DrawTexture(dX + x * TEXSIZE * 2, dY + y * TEXSIZE * 2, tex, 2.0)
   122                 DrawTexture(dX + x * TEXSIZE, dY + y * TEXSIZE, tex)
   124 {$ELSE}
   123             else
   125             DrawTexture(dX + x * TEXSIZE, dY + y * TEXSIZE, tex)
   124                 DrawTexture(dX + x * TEXSIZE * 2, dY + y * TEXSIZE * 2, tex, 2.0)
   126 {$ENDIF}
   125 
   127 end;
   126 end;
   128 
   127 
   129 procedure FreeLand;
   128 procedure FreeLand;
   130 var x, y: LongInt;
   129 var x, y: LongInt;
   131 begin
   130 begin