diff -r 772b37c9c3ba -r 56cbc035b74b hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Fri Jun 18 14:22:14 2010 -0400 +++ b/hedgewars/uLandGraphics.pas Fri Jun 18 14:26:04 2010 -0400 @@ -46,19 +46,19 @@ 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] and LAND_INDESTRUCTIBLE) = 0 then + if (Land[y + dy, i] and lfIndestructible) = 0 then Land[y + dy, i]:= Value; 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] and LAND_INDESTRUCTIBLE) = 0 then + if (Land[y - dy, i] and lfIndestructible) = 0 then Land[y - dy, i]:= Value; 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] and LAND_INDESTRUCTIBLE) = 0 then + if (Land[y + dx, i] and lfIndestructible) = 0 then Land[y + dx, i]:= Value; 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] and LAND_INDESTRUCTIBLE) = 0 then + if (Land[y - dx, i] and lfIndestructible) = 0 then Land[y - dx, i]:= Value; end; @@ -145,7 +145,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 (not isMap and ((Land[y + dy, i] and LAND_INDESTRUCTIBLE) = 0)) or ((Land[y + dy, i] and LAND_BASIC) <> 0) then + if (not isMap and ((Land[y + dy, i] and lfIndestructible) = 0)) or ((Land[y + dy, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y + dy) div 2, i div 2]:= 0; {$ELSE} @@ -153,7 +153,7 @@ {$ENDIF} if ((y - dy) and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do - if (not isMap and ((Land[y - dy, i] and LAND_INDESTRUCTIBLE) = 0)) or ((Land[y - dy, i] and LAND_BASIC) <> 0) then + if (not isMap and ((Land[y - dy, i] and lfIndestructible) = 0)) or ((Land[y - dy, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y - dy) div 2, i div 2]:= 0; {$ELSE} @@ -161,7 +161,7 @@ {$ENDIF} if ((y + dx) and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do - if (not isMap and ((Land[y + dx, i] and LAND_INDESTRUCTIBLE) = 0)) or ((Land[y + dx, i] and LAND_BASIC) <> 0) then + if (not isMap and ((Land[y + dx, i] and lfIndestructible) = 0)) or ((Land[y + dx, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y + dx) div 2, i div 2]:= 0; {$ELSE} @@ -169,7 +169,7 @@ {$ENDIF} if ((y - dx) and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do - if (not isMap and ((Land[y - dx, i] and LAND_INDESTRUCTIBLE) = 0)) or ((Land[y - dx, i] and LAND_BASIC) <> 0) then + if (not isMap and ((Land[y - dx, i] and lfIndestructible) = 0)) or ((Land[y - dx, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y - dx) div 2, i div 2]:= 0; {$ELSE} @@ -182,7 +182,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] and LAND_BASIC) <> 0) then + if ((Land[y + dy, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y + dy) div 2, i div 2]:= LandBackPixel(i, y + dy) {$ELSE} @@ -190,13 +190,13 @@ {$ENDIF} else {$IFDEF DOWNSCALE} - if ((Land[y + dy, i] and LAND_OBJECT) <> 0) then LandPixels[(y + dy) div 2, i div 2]:= 0; + if ((Land[y + dy, i] and lfObject) <> 0) then LandPixels[(y + dy) div 2, i div 2]:= 0; {$ELSE} - if ((Land[y + dy, i] and LAND_OBJECT) <> 0) then LandPixels[y + dy, i]:= 0; + if ((Land[y + dy, i] and lfObject) <> 0) then LandPixels[y + dy, i]:= 0; {$ENDIF} 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] and LAND_BASIC) <> 0) then + if ((Land[y - dy, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y - dy) div 2, i div 2]:= LandBackPixel(i, y - dy) {$ELSE} @@ -204,13 +204,13 @@ {$ENDIF} else {$IFDEF DOWNSCALE} - if ((Land[y - dy, i] and LAND_OBJECT) <> 0) then LandPixels[(y - dy) div 2, i div 2]:= 0; + if ((Land[y - dy, i] and lfObject) <> 0) then LandPixels[(y - dy) div 2, i div 2]:= 0; {$ELSE} - if ((Land[y - dy, i] and LAND_OBJECT) <> 0) then LandPixels[y - dy, i]:= 0; + if ((Land[y - dy, i] and lfObject) <> 0) then LandPixels[y - dy, i]:= 0; {$ENDIF} 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] and LAND_BASIC) <> 0) then + if ((Land[y + dx, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y + dx) div 2, i div 2]:= LandBackPixel(i, y + dx) {$ELSE} @@ -218,13 +218,13 @@ {$ENDIF} else {$IFDEF DOWNSCALE} - if ((Land[y + dx, i] and LAND_OBJECT) <> 0) then LandPixels[(y + dx) div 2, i div 2]:= 0; + if ((Land[y + dx, i] and lfObject) <> 0) then LandPixels[(y + dx) div 2, i div 2]:= 0; {$ELSE} - if ((Land[y + dx, i] and LAND_OBJECT) <> 0) then LandPixels[y + dx, i]:= 0; + if ((Land[y + dx, i] and lfObject) <> 0) then LandPixels[y + dx, i]:= 0; {$ENDIF} 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] and LAND_BASIC) <> 0) then + if ((Land[y - dx, i] and lfBasic) <> 0) then {$IFDEF DOWNSCALE} LandPixels[(y - dx) div 2, i div 2]:= LandBackPixel(i, y - dx) {$ELSE} @@ -232,9 +232,9 @@ {$ENDIF} else {$IFDEF DOWNSCALE} - if ((Land[y - dx, i] and LAND_OBJECT) <> 0) then LandPixels[(y - dx) div 2, i div 2]:= 0; + if ((Land[y - dx, i] and lfObject) <> 0) then LandPixels[(y - dx) div 2, i div 2]:= 0; {$ELSE} - if ((Land[y - dx, i] and LAND_OBJECT) <> 0) then LandPixels[y - dx, i]:= 0; + if ((Land[y - dx, i] and lfObject) <> 0) then LandPixels[y - dx, i]:= 0; {$ENDIF} end; @@ -243,53 +243,53 @@ 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] and LAND_BASIC) <> 0) or ((Land[y + dy, i] and LAND_OBJECT) <> 0) then + if ((Land[y + dy, i] and lfBasic) <> 0) or ((Land[y + dy, i] and lfObject) <> 0) then begin {$IFDEF DOWNSCALE} LandPixels[(y + dy) div 2, i div 2]:= cExplosionBorderColor; {$ELSE} LandPixels[y + dy, i]:= cExplosionBorderColor; {$ENDIF} - Land[y + dy, i]:= Land[y + dy, i] or LAND_DAMAGED; + Land[y + dy, i]:= Land[y + dy, i] or lfDamaged; Despeckle(i, y + dy); LandDirty[(y + dy) div 32, i div 32]:= 1; 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] and LAND_BASIC) <> 0) or ((Land[y - dy, i] and LAND_OBJECT) <> 0) then + if ((Land[y - dy, i] and lfBasic) <> 0) or ((Land[y - dy, i] and lfObject) <> 0) then begin {$IFDEF DOWNSCALE} LandPixels[(y - dy) div 2, i div 2]:= cExplosionBorderColor; {$ELSE} LandPixels[y - dy, i]:= cExplosionBorderColor; {$ENDIF} - Land[y - dy, i]:= Land[y - dy, i] or LAND_DAMAGED; + Land[y - dy, i]:= Land[y - dy, i] or lfDamaged; Despeckle(i, y - dy); LandDirty[(y - dy) div 32, i div 32]:= 1; 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] and LAND_BASIC) <> 0) or ((Land[y + dx, i] and LAND_OBJECT) <> 0) then + if ((Land[y + dx, i] and lfBasic) <> 0) or ((Land[y + dx, i] and lfObject) <> 0) then begin {$IFDEF DOWNSCALE} LandPixels[(y + dx) div 2, i div 2]:= cExplosionBorderColor; {$ELSE} LandPixels[y + dx, i]:= cExplosionBorderColor; {$ENDIF} - Land[y + dx, i]:= Land[y + dx, i] or LAND_DAMAGED; + Land[y + dx, i]:= Land[y + dx, i] or lfDamaged; Despeckle(i, y + dx); LandDirty[(y + dx) div 32, i div 32]:= 1; 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] and LAND_BASIC) <> 0) or ((Land[y - dx, i] and LAND_OBJECT) <> 0) then + if ((Land[y - dx, i] and lfBasic) <> 0) or ((Land[y - dx, i] and lfObject) <> 0) then begin {$IFDEF DOWNSCALE} LandPixels[(y - dx) div 2, i div 2]:= cExplosionBorderColor; {$ELSE} LandPixels[y - dx, i]:= cExplosionBorderColor; {$ENDIF} - Land[y - dx, i]:= Land[y - dx, i] or LAND_DAMAGED; + Land[y - dx, i]:= Land[y - dx, i] or lfDamaged; Despeckle(i, y - dy); LandDirty[(y - dx) div 32, i div 32]:= 1; end; @@ -377,13 +377,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 LAND_BASIC) <> 0 then + if (Land[ty, tx] and lfBasic) <> 0 then {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) {$ELSE} LandPixels[ty, tx]:= LandBackPixel(tx, ty) {$ENDIF} - else if (Land[ty, tx] and LAND_OBJECT) <> 0 then + else if (Land[ty, tx] and lfObject) <> 0 then {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= 0; {$ELSE} @@ -399,14 +399,14 @@ 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 LAND_BASIC) <> 0) or ((Land[ty, tx] and LAND_OBJECT) <> 0) then + if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then begin {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor; {$ELSE} LandPixels[ty, tx]:= cExplosionBorderColor; {$ENDIF} - Land[ty, tx]:= Land[ty, tx] or LAND_DAMAGED; + Land[ty, tx]:= Land[ty, tx] or lfDamaged; LandDirty[(y + dy) shr 5, i shr 5]:= 1; end; inc(y, dY) @@ -443,10 +443,10 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and LAND_BASIC) <> 0) or - ((Land[ty, tx] and LAND_OBJECT) <> 0)) then + (((Land[ty, tx] and lfBasic) <> 0) or + ((Land[ty, tx] and lfObject) <> 0)) then begin - Land[ty, tx]:= Land[ty, tx] or LAND_DAMAGED; + Land[ty, tx]:= Land[ty, tx] or lfDamaged; {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor {$ELSE} @@ -470,10 +470,10 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and LAND_BASIC) <> 0) or - ((Land[ty, tx] and LAND_OBJECT) <> 0)) then + (((Land[ty, tx] and lfBasic) <> 0) or + ((Land[ty, tx] and lfObject) <> 0)) then begin - Land[ty, tx]:= Land[ty, tx] or LAND_DAMAGED; + Land[ty, tx]:= Land[ty, tx] or lfDamaged; {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor {$ELSE} @@ -489,15 +489,15 @@ Y:= Y + dY; tx:= hwRound(X); ty:= hwRound(Y); - if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and LAND_INDESTRUCTIBLE) = 0) then + 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 LAND_BASIC) <> 0 then + if (Land[ty, tx] and lfBasic) <> 0 then {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) {$ELSE} LandPixels[ty, tx]:= LandBackPixel(tx, ty) {$ENDIF} - else if (Land[ty, tx] and LAND_OBJECT) <> 0 then + else if (Land[ty, tx] and lfObject) <> 0 then {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= 0; {$ELSE} @@ -514,10 +514,10 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and LAND_BASIC) <> 0) or - ((Land[ty, tx] and LAND_OBJECT) <> 0)) then + (((Land[ty, tx] and lfBasic) <> 0) or + ((Land[ty, tx] and lfObject) <> 0)) then begin - Land[ty, tx]:= Land[ty, tx] or LAND_DAMAGED; + Land[ty, tx]:= Land[ty, tx] or lfDamaged; {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor {$ELSE} @@ -541,10 +541,10 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and LAND_BASIC) <> 0) or - ((Land[ty, tx] and LAND_OBJECT) <> 0)) then + (((Land[ty, tx] and lfBasic) <> 0) or + ((Land[ty, tx] and lfObject) <> 0)) then begin - Land[ty, tx]:= Land[ty, tx] or LAND_DAMAGED; + Land[ty, tx]:= Land[ty, tx] or lfDamaged; {$IFDEF DOWNSCALE} LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor {$ELSE} @@ -620,7 +620,7 @@ for x:= 0 to Pred(w) do if PLongword(@(p^[x * 4]))^ <> 0 then begin - Land[cpY + y, cpX + x]:= LAND_OBJECT; + Land[cpY + y, cpX + x]:= lfObject; {$IFDEF DOWNSCALE} LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= PLongword(@(p^[x * 4]))^ {$ELSE} @@ -644,7 +644,7 @@ function Despeckle(X, Y: LongInt): boolean; var nx, ny, i, j, c: LongInt; begin -if (Land[Y, X] > 255) and ((Land[Y, X] and LAND_INDESTRUCTIBLE) = 0) and ((Land[Y, X] and LAND_DAMAGED) <> 0)then // check neighbours +if (Land[Y, X] > 255) and ((Land[Y, X] and lfIndestructible) = 0) and ((Land[Y, X] and lfDamaged) <> 0)then // check neighbours begin c:= 0; for i:= -1 to 1 do @@ -661,9 +661,9 @@ if c < 4 then // 0-3 neighbours begin {$IFDEF DOWNSCALE} - if (Land[Y, X] and LAND_BASIC) <> 0 then LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y) else LandPixels[Y div 2, X div 2]:= 0; + 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; {$ELSE} - if (Land[Y, X] and LAND_BASIC) <> 0 then LandPixels[Y, X]:= LandBackPixel(X, Y) else LandPixels[Y, X]:= 0; + if (Land[Y, X] and lfBasic) <> 0 then LandPixels[Y, X]:= LandBackPixel(X, Y) else LandPixels[Y, X]:= 0; {$ENDIF} Land[Y, X]:= 0; exit(true);