--- a/hedgewars/uLandGraphics.pas Thu Nov 05 20:47:42 2009 +0000
+++ b/hedgewars/uLandGraphics.pas Thu Nov 05 20:48:13 2009 +0000
@@ -139,38 +139,25 @@
if (dx = dy) then ChangeCircleLines(x, y, dx, dy, doSet)
end;
-procedure FillLandCircleLines0(x, y, dx, dy, cr: LongInt);
+procedure FillLandCircleLines0(x, y, dx, dy: LongInt);
var i: LongInt;
begin
-cr:= cr * cr; // avoid sqrt() to compare lengths/distances
if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
- if (LandPixels[y + dy, i] and $FF000000) <> 0 then
- if (dy * dy + (i - x) * (i - x) < cr) or (Land[y + dy, i] = COLOR_OBJECT) then
- LandPixels[y + dy, i]:= 0
- else
- LandPixels[y + dy, i]:= LandBackPixel(i, y + dy);
+ if Land[y + dy, i] = COLOR_LAND then
+ LandPixels[y + dy, i]:= 0;
if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
- if (LandPixels[y - dy, i] and $FF000000) <> 0 then
- if (dy * dy + (i - x) * (i - x) < cr) or (Land[y - dy, i] = COLOR_OBJECT) then
- LandPixels[y - dy, i]:= 0
- else
- LandPixels[y - dy, i]:= LandBackPixel(i, y - dy);
+ if Land[y - dy, i] = COLOR_LAND then
+ LandPixels[y - dy, i]:= 0;
if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
- if (LandPixels[y + dx, i] and $FF000000) <> 0 then
- if (dx * dx + (i - x) * (i - x) < cr) or (Land[y + dx, i] = COLOR_OBJECT) then
- LandPixels[y + dx, i]:= 0
- else
- LandPixels[y + dx, i]:= LandBackPixel(i, y + dx);
+ if Land[y + dx, i] = COLOR_LAND then
+ LandPixels[y + dx, i]:= 0;
if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
- if (LandPixels[y - dx, i] and $FF000000) <> 0 then
- if (dx * dx + (i - x) * (i - x) < cr) or (Land[y - dx, i] = COLOR_OBJECT) then
- LandPixels[y - dx, i]:= 0
- else
- LandPixels[y - dx, i]:= LandBackPixel(i, y - dx);
+ if Land[y - dx, i] = COLOR_LAND then
+ LandPixels[y - dx, i]:= 0;
end;
procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
@@ -178,7 +165,7 @@
begin
if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
- if (Land[y + dy, i] = COLOR_LAND) or (Land[y + dy, i] = COLOR_OBJECT) then
+ if Land[y + dy, i] = COLOR_LAND then
begin
LandPixels[y + dy, i]:= cExplosionBorderColor;
// Despeckle(y + dy, i);
@@ -186,7 +173,7 @@
end;
if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
- if (Land[y - dy, i] = COLOR_LAND) or (Land[y - dy, i] = COLOR_OBJECT) then
+ if Land[y - dy, i] = COLOR_LAND then
begin
LandPixels[y - dy, i]:= cExplosionBorderColor;
// Despeckle(y - dy, i);
@@ -194,7 +181,7 @@
end;
if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
- if (Land[y + dx, i] = COLOR_LAND) or (Land[y + dx, i] = COLOR_OBJECT) then
+ if Land[y + dx, i] = COLOR_LAND then
begin
LandPixels[y + dx, i]:= cExplosionBorderColor;
// Despeckle(y + dx, i);
@@ -202,7 +189,7 @@
end;
if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
- if (Land[y - dx, i] = COLOR_LAND) or (Land[y - dx, i] = COLOR_OBJECT) then
+ if Land[y - dx, i] = COLOR_LAND then
begin
LandPixels[y - dx, i]:= cExplosionBorderColor;
// Despeckle(y - dx, i);
@@ -211,17 +198,14 @@
end;
procedure DrawExplosion(X, Y, Radius: LongInt);
-var dx, dy, ty, tx, d, cr: LongInt;
+var dx, dy, ty, tx, d: LongInt;
begin
dx:= 0;
dy:= Radius;
d:= 3 - 2 * Radius;
- cr:= Radius * 3 div 4;
- if cr < 10 then cr:= 0;
-
while (dx < dy) do
begin
- FillLandCircleLines0(x, y, dx, dy, cr);
+ FillLandCircleLines0(x, y, dx, dy);
if (d < 0)
then d:= d + 4 * dx + 6
else begin
@@ -230,7 +214,7 @@
end;
inc(dx)
end;
- if (dx = dy) then FillLandCircleLines0(x, y, dx, dy, cr);
+ if (dx = dy) then FillLandCircleLines0(x, y, dx, dy);
// FillRoundInLand after erasing land pixels to allow Land 0 check for mask.png to function
FillRoundInLand(X, Y, Radius, 0);
inc(Radius, 4);
@@ -265,9 +249,7 @@
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] = COLOR_LAND then
- LandPixels[ty, tx]:= LandBackPixel(tx, ty)
- else if Land[ty, tx] = COLOR_OBJECT then
- LandPixels[ty, tx]:= 0;
+ LandPixels[ty, tx]:= 0;
inc(y, dY)
end;
@@ -278,7 +260,7 @@
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] = COLOR_LAND) or (Land[ty, tx] = COLOR_OBJECT) then
+ if Land[ty, tx] = COLOR_LAND then
begin
LandPixels[ty, tx]:= cExplosionBorderColor;
LandDirty[trunc((y + dy)/32), trunc(i/32)]:= 1;
@@ -330,13 +312,11 @@
tx:= hwRound(X);
ty:= hwRound(Y);
if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) then
- begin
- if Land[ty, tx] = COLOR_LAND then
- LandPixels[ty, tx]:= LandBackPixel(tx, ty)
- else if Land[ty, tx] = COLOR_OBJECT then
- LandPixels[ty, tx]:= 0;
- Land[ty, tx]:= 0;
- end
+ if Land[ty, tx] = COLOR_LAND then
+ begin
+ Land[ty, tx]:= 0;
+ LandPixels[ty, tx]:= 0;
+ end
end;
for t:= 0 to 7 do
{$INCLUDE "tunsetborder.inc"}
@@ -418,7 +398,7 @@
for x:= 0 to Pred(w) do
if PLongword(@(p^[x * 4]))^ <> 0 then
begin
- Land[cpY + y, cpX + x]:= COLOR_OBJECT;
+ Land[cpY + y, cpX + x]:= COLOR_LAND;
LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^
end;
p:= @(p^[Image^.pitch]);
@@ -454,10 +434,7 @@
if c < 4 then // 0-3 neighbours
begin
- if Land[Y, X] = COLOR_LAND then
- LandPixels[Y, X]:= LandBackPixel(X, Y)
- else if Land[Y, X] = COLOR_OBJECT then
- LandPixels[Y, X]:= 0;
+ LandPixels[Y, X]:= 0;
Land[Y, X]:= 0;
exit(true);
end;