# HG changeset patch # User nemo # Date 1363623226 14400 # Node ID 4609823efc94d6d1df3d9d032095dc946e4a8e0e # Parent 1b9f026e9fc6717faa7d0110a0cbceef522649ff More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places. diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/GSHandlers.inc Mon Mar 18 12:13:46 2013 -0400 @@ -680,7 +680,7 @@ begin rx:= rx div 2;ry:= ry div 2; end; - if Land[yy + py, xx + px] and $FF00 = 0 then + if Land[yy + py, xx + px] <= lfAllObjMask then if gun then begin LandDirty[yy div 32, xx div 32]:= 1; @@ -1020,7 +1020,7 @@ if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then inc(Gear^.Damage); // let's interrupt before a collision to give portals a chance to catch the bullet - if (Gear^.Damage = 1) and (Gear^.Tag = 0) and not(CheckLandValue(x, y, $FF00)) then + if (Gear^.Damage = 1) and (Gear^.Tag = 0) and not(CheckLandValue(x, y, lfLandMask)) then begin Gear^.Tag := 1; Gear^.Damage := 0; @@ -1242,7 +1242,7 @@ end else begin - if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), $FF00) then + if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfLandMask) then begin Gear^.dY := Gear^.dY + cGravity; Gear^.Y := Gear^.Y + Gear^.dY @@ -1252,7 +1252,7 @@ end; Gear^.X := Gear^.X + HHGear^.dX; - if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, $FF00) then + if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfLandMask) then begin HHGear^.X := Gear^.X; HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius) @@ -2753,7 +2753,7 @@ HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and (not gmAttack); - Gear^.CollisionMask:= lfCurrentMask; + Gear^.CollisionMask:= lfNotCurrentMask; FollowGear := Gear; @@ -3025,7 +3025,7 @@ ry := rndSign(getRandomf * _0_1); ball:= AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); - ball^.CollisionMask:= lfCurrentMask; + ball^.CollisionMask:= lfNotCurrentMask; PlaySound(sndGun); end; @@ -3595,7 +3595,7 @@ doPortalColorSwitch(); // destroy portal if ground it was attached too is gone - if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0) + if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] <= lfAllObjMask) or (Gear^.Timer < 1) or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) or (hwRound(Gear^.Y) > cWaterLine) then @@ -4376,14 +4376,14 @@ flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); - flame^.CollisionMask:= lfCurrentMask; + flame^.CollisionMask:= lfNotCurrentMask; if (Gear^.Health mod 30) = 0 then begin flame:= AddGear(gx, gy, gtFlame, 0, SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); - flame^.CollisionMask:= lfCurrentMask; + flame^.CollisionMask:= lfNotCurrentMask; end end; Gear^.Timer:= Gear^.Tag @@ -4460,7 +4460,7 @@ land:= AddGear(gx, gy, gtFlake, gstTmpFlag, SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); - land^.CollisionMask:= lfCurrentMask; + land^.CollisionMask:= lfNotCurrentMask; Gear^.Timer:= Gear^.Tag end; @@ -5064,7 +5064,7 @@ For now we assume a "ray" like a deagle projected out from the gun. All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". * When fired at water a layer of ice textured land is added above the water. - * When fired at non-ice land (land and $FF00 and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. + * When fired at non-ice land (land and lfLandMask and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. * When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. If the effect is interrupted before reaching the top, the freezing state is cleared. A frozen hog will animate differently. To be decided, but possibly in a similar fashion to a grave when it comes to explosions. The hog might (possibly) not be damaged by explosions. This might make freezing potentially useful for friendlies in a bad position. It might be better to allow damage though. A frozen hog stays frozen for a certain number of turns. Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again. @@ -5460,7 +5460,7 @@ if Gear^.State and gstDrowning <> 0 then exit; with Gear^ do begin - if CheckLandValue(gx, gy, $FF00) then + if CheckLandValue(gx, gy, lfLandMask) then begin t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uAIAmmoTests.pas Mon Mar 18 12:13:46 2013 -0400 @@ -1171,7 +1171,7 @@ //FillChar(cake, sizeof(cake), 0); cake.Radius:= 7; - cake.CollisionMask:= lfCurrentMask; + cake.CollisionMask:= lfNotCurrentMask; cake.Hedgehog:= Me^.Hedgehog; // check left direction diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uAIMisc.pas Mon Mar 18 12:13:46 2013 -0400 @@ -265,7 +265,7 @@ MeX:= hwRound(Me^.X); MeY:= hwRound(Me^.Y); // We are still inside the hog. Skip radius test - if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and ((Land[y, x] and $FF00) = 0) then + if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and (Land[y, x] <= lfAllObjMask) then exit(false); end; TestCollExcludingMe:= TestColl(x, y, r) @@ -274,19 +274,19 @@ function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline; var b: boolean; begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] and $FF00 <> 0); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > lfAllObjMask); if b then exit(true); - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] and $FF00 <> 0); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > lfAllObjMask); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] and $FF00 <> 0); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > lfAllObjMask); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] and $FF00 <> 0); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > lfAllObjMask); if b then exit(true); @@ -296,19 +296,19 @@ function TestColl(x, y, r: LongInt): boolean; inline; var b: boolean; begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] and lfCurrentMask <> 0); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] and lfNotCurrentMask <> 0); if b then exit(true); - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] and lfCurrentMask <> 0); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] and lfNotCurrentMask <> 0); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] and lfCurrentMask <> 0); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] and lfNotCurrentMask <> 0); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] and lfCurrentMask <> 0); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] and lfNotCurrentMask <> 0); if b then exit(true); @@ -318,19 +318,19 @@ function TestCollWithLand(x, y, r: LongInt): boolean; inline; var b: boolean; begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > 255); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > lfAllObjMask); if b then exit(true); - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > 255); + b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > lfAllObjMask); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > 255); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > lfAllObjMask); if b then exit(true); - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > 255); + b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > lfAllObjMask); if b then exit(true); @@ -712,7 +712,7 @@ var pX, pY, tY: LongInt; begin HHGo:= false; -Gear^.CollisionMask:= lfCurrentMask; +Gear^.CollisionMask:= lfNotCurrentMask; AltGear^:= Gear^; GoInfo.Ticks:= 0; diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uCollisions.pas Mon Mar 18 12:13:46 2013 -0400 @@ -139,7 +139,7 @@ var x, y, i: LongInt; begin // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap -if (Gear^.CollisionMask = lfCurrentMask) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and +if (Gear^.CollisionMask = lfNotCurrentMask) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.X) - Gear^.Radius) or (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.X) + Gear^.Radius)) then Gear^.CollisionMask:= $FFFF; @@ -169,7 +169,7 @@ var x, y, i: LongInt; begin // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap -if (Gear^.CollisionMask = lfCurrentMask) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and +if (Gear^.CollisionMask = lfNotCurrentMask) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.Y) - Gear^.Radius) or (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.Y) + Gear^.Radius)) then Gear^.CollisionMask:= $FFFF; diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uConsts.pas Mon Mar 18 12:13:46 2013 -0400 @@ -97,11 +97,16 @@ lfDamaged = $1000; // lfIce = $0800; // blue lfBouncy = $0400; // green + lfLandMask = $FF00; // upper byte is used for terrain, not objects. lfCurrentHog = $0080; // CurrentHog. It is also used to flag crates, for convenience of AI. Since an active hog would instantly collect the crate, this doesn't impact play - lfCurrentMask = $FF7F; // inverse of above. frequently used. + lfNotCurrentMask = $FF7F; // inverse of above. frequently used lfObjMask = $007F; // lower 7 bits used for hogs lfNotObjMask = $FF80; // inverse of above. + // lower byte is for objects. + // consists of 0-127 counted for object checkins and $80 as a bit flag for current hog. + lfAllObjMask = $00FF; // lfCurrentHog or lfObjMask + cMaxPower = 1500; cMaxAngle = 2048; diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uGearsHandlersRope.pas --- a/hedgewars/uGearsHandlersRope.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uGearsHandlersRope.pas Mon Mar 18 12:13:46 2013 -0400 @@ -202,7 +202,7 @@ begin lx := hwRound(nx); ly := hwRound(ny); - if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and ((Land[ly, lx] and $FF00) <> 0) then + if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] > lfAllObjMask) then begin tx := _1 / Distance(ropeDx, ropeDy); // old rope pos @@ -425,7 +425,7 @@ ty := _0; while tt > _20 do begin - if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] and $FF00) <> 0) then + if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and (Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] > lfAllObjMask) then begin Gear^.X := Gear^.X + tx; Gear^.Y := Gear^.Y + ty; @@ -449,8 +449,8 @@ end; end; - if Gear^.Elasticity < _20 then Gear^.CollisionMask:= $FF00 - else Gear^.CollisionMask:= lfCurrentMask; + if Gear^.Elasticity < _20 then Gear^.CollisionMask:= lfLandMask + else Gear^.CollisionMask:= lfNotCurrentMask; CheckCollision(Gear); if (Gear^.State and gstCollision) <> 0 then diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uGearsList.pas Mon Mar 18 12:13:46 2013 -0400 @@ -185,7 +185,7 @@ begin gear^.Hedgehog:= CurrentHedgehog; if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then - gear^.CollisionMask:= lfCurrentMask + gear^.CollisionMask:= lfNotCurrentMask end; if (Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uGearsUtils.pas Mon Mar 18 12:13:46 2013 -0400 @@ -580,7 +580,7 @@ inc(y, 2); until (y >= cWaterLine) or (not ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, $FFFF) = 0)) or - (ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, $FF00) = 0)); + (ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, lfLandMask) = 0)); sy:= y; @@ -588,7 +588,7 @@ inc(y); until (y >= cWaterLine) or (not ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, $FFFF) <> 0)) or - (ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, $FF00) <> 0)); + (ignoreOverlap and (CountNonZeroz(x, y, Gear^.Radius - 1, 1, lfLandMask) <> 0)); if (y - sy > Gear^.Radius * 2) and (((Gear^.Kind = gtExplosives) diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uLandGraphics.pas Mon Mar 18 12:13:46 2013 -0400 @@ -108,25 +108,25 @@ if ((y + dy) and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if isCurrent then - Land[y + dy, i]:= Land[y + dy, i] and lfCurrentMask + Land[y + dy, i]:= Land[y + dy, i] and lfNotCurrentMask else if Land[y + dy, i] and lfObjMask > 0 then Land[y + dy, i]:= (Land[y + dy, i] and lfNotObjMask) or ((Land[y + dy, i] and lfObjMask) - 1); if ((y - dy) and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if isCurrent then - Land[y - dy, i]:= Land[y - dy, i] and lfCurrentMask + Land[y - dy, i]:= Land[y - dy, i] and lfNotCurrentMask else if Land[y - dy, i] and lfObjMask > 0 then Land[y - dy, i]:= (Land[y - dy, i] and lfNotObjMask) or ((Land[y - dy, i] and lfObjMask) - 1); if ((y + dx) and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if isCurrent then - Land[y + dx, i]:= Land[y + dx, i] and lfCurrentMask + Land[y + dx, i]:= Land[y + dx, i] and lfNotCurrentMask else if Land[y + dx, i] and lfObjMask > 0 then Land[y + dx, i]:= (Land[y + dx, i] and lfNotObjMask) or ((Land[y + dx, i] and lfObjMask) - 1); if ((y - dx) and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if isCurrent then - Land[y - dx, i]:= Land[y - dx, i] and lfCurrentMask + Land[y - dx, i]:= Land[y - dx, i] and lfNotCurrentMask else if Land[y - dx, i] and lfObjMask > 0 then Land[y - dx, i]:= (Land[y - dx, i] and lfNotObjMask) or ((Land[y - dx, i] and lfObjMask) - 1) end @@ -269,7 +269,7 @@ exit; end; - if Land[j, i] and $FF00 and not lfIce = 0 then + if Land[j, i] and lfLandMask and not lfIce = 0 then result := result + 1; end; end; @@ -957,7 +957,7 @@ yy:= Y div 2; end; - pixelsweep:= ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0); + pixelsweep:= (Land[Y, X] <= lfAllObjMask) 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; diff -r 1b9f026e9fc6 -r 4609823efc94 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Sun Mar 17 22:02:57 2013 +0100 +++ b/hedgewars/uLandObjects.pas Mon Mar 18 12:13:46 2013 -0400 @@ -105,7 +105,7 @@ if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; - if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then + if (Land[cpY + y, cpX + x] <= lfAllObjMask) and ((p^[x] and AMask) <> 0) then begin Land[cpY + y, cpX + x]:= lfObject; Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags