--- a/hedgewars/uGearsHandlersMess.pas Sun Jan 19 00:18:28 2014 +0400
+++ b/hedgewars/uGearsHandlersMess.pas Tue Jan 21 22:38:13 2014 +0100
@@ -24,7 +24,7 @@
* should NOT occur!
* Use safe functions and data types! (e.g. GetRandom() and hwFloat)
*)
-
+
{$INCLUDE "options.inc"}
unit uGearsHandlersMess;
@@ -394,7 +394,7 @@
if xland <> 0 then collH := -hwSign(Gear^.dX)
end;
//if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
- if (collV <> 0) and (collH <> 0) and
+ if (collV <> 0) and (collH <> 0) and
(((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then
//or ((xland or land) and lfBouncy <> 0)) then
begin
@@ -436,7 +436,7 @@
if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
Gear^.State := Gear^.State or gstCollision;
-
+
if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and
((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then
begin
@@ -760,7 +760,7 @@
yy:= hwRound(Gear^.Y);
if draw and (WorldEdge = weWrap) and ((xx < LongInt(leftX) + 3) or (xx > LongInt(rightX) - 3)) then
begin
- if xx < LongInt(leftX) + 3 then
+ if xx < LongInt(leftX) + 3 then
xx:= rightX-3
else xx:= leftX+3;
Gear^.X:= int2hwFloat(xx)
@@ -1054,7 +1054,7 @@
// no need to display remaining time anymore
Gear^.RenderTimer:= false;
// bee can drown when timer reached 0
- Gear^.State:= Gear^.State and not gstSubmersible;
+ Gear^.State:= Gear^.State and (not gstSubmersible);
end;
end;
end;
@@ -1235,7 +1235,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, lfLandMask)) then
+ if (Gear^.Damage = 1) and (Gear^.Tag = 0) and (not CheckLandValue(x, y, lfLandMask)) then
begin
Gear^.Tag := 1;
Gear^.Damage := 0;
@@ -1772,7 +1772,7 @@
end
end
else // gsttmpFlag = 0
- if ((GameFlags and gfInfAttack = 0) and ((TurnTimeLeft = 0) or (Gear^.Hedgehog^.Gear = nil)))
+ if ((GameFlags and gfInfAttack = 0) and ((TurnTimeLeft = 0) or (Gear^.Hedgehog^.Gear = nil)))
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) then
Gear^.State := Gear^.State or gsttmpFlag;
end;
@@ -1806,7 +1806,7 @@
if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then
SetLittle(Gear^.dY);
Gear^.State := Gear^.State or gstAnimation;
- if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and not gstFrozen;
+ if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and (not gstFrozen);
if ((Gear^.dX.QWordValue <> 0)
or (Gear^.dY.QWordValue <> 0)) then
@@ -1892,7 +1892,7 @@
Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump));
exit
end;
- if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and not gstFrozen;
+ if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and (not gstFrozen);
if ((k <> gtExplosives) and (Gear^.Damage > 0)) or ((k = gtExplosives) and (Gear^.Health<=0)) then
begin
@@ -2163,7 +2163,7 @@
exit
end
end
- else
+ else
begin
if (Gear^.Timer = 1) and (GameTicks and $3 = 0) then
begin
@@ -2471,9 +2471,11 @@
begin
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
DeleteGear(Gear);
+ {$IFNDEF PAS2C}
with mobileRecord do
if (performRumble <> nil) and (not fastUntilLag) then
performRumble(kSystemSoundID_Vibrate);
+ {$ENDIF}
exit
end;
if (GameTicks and $3F) = 0 then
@@ -2502,7 +2504,7 @@
if Gear^.AmmoType = amRubber then LandFlags:= lfBouncy
else if cIce then LandFlags:= lfIce;
- if ((Distance(tx - x, ty - y) > _256) and ((WorldEdge <> weWrap) or
+ if ((Distance(tx - x, ty - y) > _256) and ((WorldEdge <> weWrap) or
(
(Distance(tx - int2hwFloat(rightX+(rx-leftX)), ty - y) > _256) and
(Distance(tx - int2hwFloat(leftX-(rightX-rx)), ty - y) > _256)
@@ -4615,9 +4617,11 @@
Gear^.dY.isNegative := not Gear^.dY.isNegative;
Gear^.doStep := @doStepSineGunShotWork;
+ {$IFNDEF PAS2C}
with mobileRecord do
if (performRumble <> nil) and (not fastUntilLag) then
performRumble(kSystemSoundID_Vibrate);
+ {$ENDIF}
end;
////////////////////////////////////////////////////////////////////////////////
@@ -5380,7 +5384,7 @@
Gear^.SoundChannel:= -1;
if GameTicks mod 40 = 0 then dec(Gear^.Health)
end
- else
+ else
begin
if Gear^.SoundChannel = -1 then
Gear^.SoundChannel := LoopSound(sndIceBeam);
@@ -5487,14 +5491,15 @@
landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1);
landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1);
UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);
-
+
// Freeze nearby mines/explosives/cases too
iter := GearsList;
while iter <> nil do
begin
if (iter^.State and gstFrozen = 0) and
- ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
- (abs(iter^.X.Round-target.x)+abs(iter^.Y.Round-target.y)+2<2*iceRadius) and (Distance(iter^.X-int2hwFloat(target.x),iter^.Y-int2hwFloat(target.y))<int2hwFloat(iceRadius*2)) then
+ ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
+ (abs(LongInt(iter^.X.Round) - target.x) + abs(LongInt(iter^.Y.Round) - target.y) + 2 < 2 * iceRadius)
+ and (Distance(iter^.X - int2hwFloat(target.x), iter^.Y - int2hwFloat(target.y)) < int2hwFloat(iceRadius * 2)) then
begin
for t:= 0 to 5 do
begin
@@ -5621,7 +5626,7 @@
begin
with gi^ do CheckSum:= CheckSum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac;
AddRandomness(CheckSum);
- if gi^.Kind = gtGenericFaller then gi^.State:= gi^.State and not gstTmpFlag;
+ if gi^.Kind = gtGenericFaller then gi^.State:= gi^.State and (not gstTmpFlag);
gi := gi^.NextGear
end;
AddPickup(Gear^.Hedgehog^, a, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y));