--- a/hedgewars/uLandGraphics.pas Sun Dec 26 19:06:10 2010 +0300
+++ b/hedgewars/uLandGraphics.pas Sun Dec 26 11:21:09 2010 -0500
@@ -190,7 +190,7 @@
t:= y + dy;
if (t and LAND_HEIGHT_MASK) = 0 then
for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
- if ((Land[t, i] and lfBasic) <> 0) then
+ if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
begin
inc(cnt);
if (cReducedQuality and rqBlurryLand) = 0 then
@@ -199,7 +199,7 @@
LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
end
else
- if ((Land[t, i] and lfObject) <> 0) then
+ if ((Land[t, i] and lfObject) <> 0) or disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[t, i]:= 0
else
@@ -208,7 +208,7 @@
t:= y - dy;
if (t and LAND_HEIGHT_MASK) = 0 then
for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
- if ((Land[t, i] and lfBasic) <> 0) then
+ if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
begin
inc(cnt);
if (cReducedQuality and rqBlurryLand) = 0 then
@@ -217,7 +217,7 @@
LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
end
else
- if ((Land[t, i] and lfObject) <> 0) then
+ if ((Land[t, i] and lfObject) <> 0) or disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[t, i]:= 0
else
@@ -226,25 +226,7 @@
t:= y + dx;
if (t and LAND_HEIGHT_MASK) = 0 then
for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
- if ((Land[t, i] and lfBasic) <> 0) then
- begin
- inc(cnt);
- if (cReducedQuality and rqBlurryLand) = 0 then
- LandPixels[t, i]:= LandBackPixel(i, t)
- else
- LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
- end
- else
- if ((Land[t, i] and lfObject) <> 0) then
- if (cReducedQuality and rqBlurryLand) = 0 then
- LandPixels[t, i]:= 0
- else
- LandPixels[t div 2, i div 2]:= 0;
-
-t:= y - dx;
-if (t and LAND_HEIGHT_MASK) = 0 then
- for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
- if ((Land[t, i] and lfBasic) <> 0) then
+ if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
begin
inc(cnt);
if (cReducedQuality and rqBlurryLand) = 0 then
@@ -253,11 +235,29 @@
LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
end
else
- if ((Land[t, i] and lfObject) <> 0) then
+ if ((Land[t, i] and lfObject) <> 0) or disableLandBack then
+ if (cReducedQuality and rqBlurryLand) = 0 then
+ LandPixels[t, i]:= 0
+ else
+ LandPixels[t div 2, i div 2]:= 0;
+
+t:= y - dx;
+if (t and LAND_HEIGHT_MASK) = 0 then
+ for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
+ if ((Land[t, i] and lfBasic) <> 0) and not disableLandBack then
+ begin
+ inc(cnt);
+ if (cReducedQuality and rqBlurryLand) = 0 then
+ LandPixels[t, i]:= LandBackPixel(i, t)
+ else
+ LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+ end
+ else
+ if ((Land[t, i] and lfObject) <> 0) or disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
- LandPixels[t, i]:= 0
+ LandPixels[t, i]:= 0
else
- LandPixels[t div 2, i div 2]:= 0;
+ LandPixels[t div 2, i div 2]:= 0;
FillLandCircleLinesBG:= cnt;
end;
@@ -409,13 +409,13 @@
begin
for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do
for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do
- if (Land[ty, tx] and lfBasic) <> 0 then
+ if ((Land[ty, tx] and lfBasic) <> 0) and not disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[ty, tx]:= LandBackPixel(tx, ty)
else
LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
else
- if (Land[ty, tx] and lfObject) <> 0 then
+ if ((Land[ty, tx] and lfObject) <> 0) or disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[ty, tx]:= 0
else
@@ -521,13 +521,13 @@
ty:= hwRound(Y);
if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then
begin
- if (Land[ty, tx] and lfBasic) <> 0 then
+ if ((Land[ty, tx] and lfBasic) <> 0) and not disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[ty, tx]:= LandBackPixel(tx, ty)
else
LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
else
- if (Land[ty, tx] and lfObject) <> 0 then
+ if ((Land[ty, tx] and lfObject) <> 0) or disableLandBack then
if (cReducedQuality and rqBlurryLand) = 0 then
LandPixels[ty, tx]:= 0
else
@@ -670,9 +670,21 @@
// was experimenting with applying as damage occurred.
function Despeckle(X, Y: LongInt): boolean;
-var nx, ny, i, j, c: LongInt;
+var nx, ny, i, j, c, xx, yy: LongInt;
+ pixelsweep: boolean;
begin
-if ((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0) then // check neighbours
+if (cReducedQuality and rqBlurryLand) = 0 then
+ begin
+ xx:= X;
+ yy:= Y;
+ end
+else
+ begin
+ xx:= X div 2;
+ yy:= Y div 2;
+ end;
+pixelsweep:= ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0);
+if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then
begin
c:= 0;
for i:= -1 to 1 do
@@ -682,25 +694,29 @@
ny:= Y + i;
nx:= X + j;
if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then
- if Land[ny, nx] > 255 then
- inc(c);
+ begin
+ if pixelsweep then
+ begin
+ if ((cReducedQuality and rqBlurryLand) <> 0) then
+ begin
+ nx:= nx div 2;
+ ny:= ny div 2
+ end;
+ if LandPixels[ny, nx] <> 0 then inc(c);
+ end
+ else if Land[ny, nx] > 255 then inc(c);
+ end
end;
if c < 4 then // 0-3 neighbours
begin
- if (cReducedQuality and rqBlurryLand) = 0 then
- if (Land[Y, X] and lfBasic) <> 0 then
- LandPixels[Y, X]:= LandBackPixel(X, Y)
- else
- LandPixels[Y, X]:= 0
+ if ((Land[Y, X] and lfBasic) <> 0) and not disableLandBack then
+ LandPixels[yy, xx]:= LandBackPixel(X, Y)
else
- if (Land[Y, X] and lfBasic) <> 0 then
- LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
- else
- LandPixels[Y div 2, X div 2]:= 0;
+ LandPixels[yy, xx]:= 0;
Land[Y, X]:= 0;
- exit(true);
+ if not pixelsweep then exit(true);
end;
end;
Despeckle:= false