hedgewars/uLandGraphics.pas
changeset 5895 212d3b459658
parent 5887 7d69b76ce923
child 6011 519f8a58c021
equal deleted inserted replaced
5894:86c59c34cdd5 5895:212d3b459658
   830 var x, y, xx, yy, ty, tx: LongInt;
   830 var x, y, xx, yy, ty, tx: LongInt;
   831     bRes, updateBlock, resweep, recheck: boolean;
   831     bRes, updateBlock, resweep, recheck: boolean;
   832 begin
   832 begin
   833 bRes:= false;
   833 bRes:= false;
   834 reCheck:= true;
   834 reCheck:= true;
   835 for y:= 0 to LAND_HEIGHT div 32 - 1 do
       
   836     for x:= 0 to LAND_WIDTH div 32 - 1 do
       
   837         if LandDirty[y, x] <> 0 then
       
   838             begin
       
   839             ty:= y * 32;
       
   840             tx:= x * 32;
       
   841             for yy:= ty to ty + 31 do
       
   842                 for xx:= tx to tx + 31 do
       
   843                     Smooth(xx,yy)
       
   844             end;
       
   845 
   835 
   846 while recheck do
   836 while recheck do
   847     begin
   837     begin
   848     recheck:= false;
   838     recheck:= false;
   849     for y:= 0 to LAND_HEIGHT div 32 - 1 do
   839     for y:= 0 to LAND_HEIGHT div 32 - 1 do
   850         begin
   840         begin
   851         for x:= 0 to LAND_WIDTH div 32 - 1 do
   841         for x:= 0 to LAND_WIDTH div 32 - 1 do
   852             begin
   842             begin
   853             if LandDirty[y, x] <> 0 then
   843             if LandDirty[y, x] = 1 then
   854                 begin
   844                 begin
   855                 updateBlock:= false;
   845                 updateBlock:= false;
   856                 resweep:= true;
   846                 resweep:= true;
   857                 ty:= y * 32;
   847                 ty:= y * 32;
   858                 tx:= x * 32;
   848                 tx:= x * 32;
   887                                     recheck:= true;
   877                                     recheck:= true;
   888                                     end
   878                                     end
   889                                 end;
   879                                 end;
   890                     end;
   880                     end;
   891                 if updateBlock then UpdateLandTexture(tx, 32, ty, 32);
   881                 if updateBlock then UpdateLandTexture(tx, 32, ty, 32);
   892                 LandDirty[y, x]:= 0;
   882                 LandDirty[y, x]:= 2;
   893                 end;
   883                 end;
   894             end;
   884             end;
   895         end;
   885         end;
   896      end;
   886      end;
       
   887 
       
   888 for y:= 0 to LAND_HEIGHT div 32 - 1 do
       
   889     for x:= 0 to LAND_WIDTH div 32 - 1 do
       
   890         if LandDirty[y, x] <> 0 then
       
   891             begin
       
   892             LandDirty[y, x]:= 0;
       
   893             ty:= y * 32;
       
   894             tx:= x * 32;
       
   895             for yy:= ty to ty + 31 do
       
   896                 for xx:= tx to tx + 31 do
       
   897                     Smooth(xx,yy)
       
   898             end;
   897 
   899 
   898 SweepDirty:= bRes;
   900 SweepDirty:= bRes;
   899 end;
   901 end;
   900 
   902 
   901 
   903