hedgewars/uLandGraphics.pas
changeset 4659 ce5897f53072
parent 4640 bc30434ae156
child 4686 3682db294dae
equal deleted inserted replaced
4658:280195b0ffbd 4659:ce5897f53072
   418                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   418                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   419                 else
   419                 else
   420                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   420                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   421             else if not isMap then
   421             else if not isMap then
   422                 begin
   422                 begin
   423 	        if (cReducedQuality and rqBlurryLand) = 0 then
   423                 if (cReducedQuality and rqBlurryLand) = 0 then
   424 	     	    LandPixels[ty, tx]:= 0
   424                     LandPixels[ty, tx]:= 0
   425 	        else
   425                 else
   426 		    LandPixels[ty div 2, tx div 2]:= 0
   426                     LandPixels[ty div 2, tx div 2]:= 0
   427                 end;
   427                 end;
   428     inc(y, dY)
   428     inc(y, dY)
   429     end;
   429     end;
   430 
   430 
   431 inc(Radius, 4);
   431 inc(Radius, 4);
   668 UpdateLandTexture(x, w, y, h)
   668 UpdateLandTexture(x, w, y, h)
   669 end;
   669 end;
   670 
   670 
   671 // was experimenting with applying as damage occurred.
   671 // was experimenting with applying as damage occurred.
   672 function Despeckle(X, Y: LongInt): boolean;
   672 function Despeckle(X, Y: LongInt): boolean;
   673 var nx, ny, i, j, c: LongInt;
   673 var nx, ny, i, j, c, xx, yy: LongInt;
   674 begin
   674     pixelsweep: boolean;
   675 if ((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0) then // check neighbours
   675 begin
       
   676 if (cReducedQuality and rqBlurryLand) = 0 then
       
   677    begin
       
   678    xx:= X;
       
   679    yy:= Y;
       
   680    end
       
   681 else
       
   682    begin
       
   683    xx:= X div 2;
       
   684    yy:= Y div 2;
       
   685    end;
       
   686 pixelsweep:= not isMap and ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0);
       
   687 if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then
   676     begin
   688     begin
   677     c:= 0;
   689     c:= 0;
   678     for i:= -1 to 1 do
   690     for i:= -1 to 1 do
   679         for j:= -1 to 1 do
   691         for j:= -1 to 1 do
   680             if (i <> 0) or (j <> 0) then
   692             if (i <> 0) or (j <> 0) then
   681                 begin
   693                 begin
   682                 ny:= Y + i;
   694                 ny:= Y + i;
   683                 nx:= X + j;
   695                 nx:= X + j;
   684                 if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then
   696                 if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then
   685                     if Land[ny, nx] > 255 then
   697                     begin
   686                         inc(c);
   698                     if pixelsweep then
       
   699                         begin
       
   700                         if ((cReducedQuality and rqBlurryLand) <> 0) then
       
   701                             begin
       
   702                             nx:= nx div 2;
       
   703                             ny:= ny div 2
       
   704                             end;
       
   705                         if LandPixels[ny, nx] <> 0 then inc(c);
       
   706                         end
       
   707                     else if Land[ny, nx] > 255 then inc(c);
       
   708                     end
   687                 end;
   709                 end;
   688 
   710 
   689     if c < 4 then // 0-3 neighbours
   711     if c < 4 then // 0-3 neighbours
   690         begin
   712         begin
   691         if (cReducedQuality and rqBlurryLand) = 0 then
       
   692             begin
       
   693             if (Land[Y, X] and lfBasic) <> 0 then
   713             if (Land[Y, X] and lfBasic) <> 0 then
   694                 LandPixels[Y, X]:= LandBackPixel(X, Y)
   714                 LandPixels[yy, xx]:= LandBackPixel(X, Y)
   695             else if not isMap or ((Land[Y, X] and lfObject) <> 0) then
   715             else LandPixels[yy, xx]:= 0;
   696                 LandPixels[Y, X]:= 0
       
   697             end
       
   698         else
       
   699             if (Land[Y, X] and lfBasic) <> 0 then
       
   700                 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
       
   701             else if not isMap or ((Land[Y, X] and lfObject) <> 0) then
       
   702                 LandPixels[Y div 2, X div 2]:= 0;
       
   703 
   716 
   704         Land[Y, X]:= 0;
   717         Land[Y, X]:= 0;
   705         exit(true);
   718         exit(true);
   706         end;
   719         end;
   707     end;
   720     end;