--- a/hedgewars/GSHandlers.inc Mon Jun 11 15:53:29 2007 +0000
+++ b/hedgewars/GSHandlers.inc Sun Jun 17 14:48:15 2007 +0000
@@ -70,12 +70,13 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepFallingGear(Gear: PGear);
+var isFalling: boolean;
begin
Gear^.State:= Gear^.State and not gstCollision;
if Gear^.dY.isNegative then
begin
- Gear^.State:= Gear^.State or gstFalling;
+ isFalling:= true;
if TestCollisionYwithGear(Gear, -1) then
begin
Gear^.dX:= Gear^.dX * Gear^.Friction;
@@ -85,11 +86,11 @@
end else
if TestCollisionYwithGear(Gear, 1) then
begin
- Gear^.State:= Gear^.State and not gstFalling;
+ isFalling:= false;
Gear^.dX:= Gear^.dX * Gear^.Friction;
Gear^.dY:= - Gear^.dY * Gear^.Elasticity;
Gear^.State:= Gear^.State or gstCollision
- end else Gear^.State:= Gear^.State or gstFalling;
+ end else isFalling:= true;
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
begin
@@ -97,14 +98,14 @@
Gear^.State:= Gear^.State or gstCollision
end;
-if (Gear^.State and gstFalling) <> 0 then Gear^.dY:= Gear^.dY + cGravity;
+if isFalling then Gear^.dY:= Gear^.dY + cGravity;
Gear^.X:= Gear^.X + Gear^.dX;
Gear^.Y:= Gear^.Y + Gear^.dY;
CheckGearDrowning(Gear);
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and
- ((Gear^.State and gstFalling) = 0) then Gear^.State:= Gear^.State and not gstMoving
- else Gear^.State:= Gear^.State or gstMoving
+ (not isFalling) then Gear^.State:= Gear^.State and not gstMoving
+ else Gear^.State:= Gear^.State or gstMoving
end;
////////////////////////////////////////////////////////////////////////////////
@@ -505,7 +506,7 @@
HHGear^.State:= HHGear^.State and not gstNoDamage
end;
- if (HHGear^.State and gstFalling) <> 0 then Gear^.Timer:= 0
+ if (HHGear^.State and gstMoving) <> 0 then Gear^.Timer:= 0
end;
if b then
@@ -544,7 +545,7 @@
with HHGear^ do
begin
Message:= Message and not gm_Attack;
- State:= State or gstFalling;
+ State:= State or gstMoving;
end;
DeleteGear(Gear);
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
@@ -664,12 +665,12 @@
Gear^.Elasticity:= Gear^.Elasticity + _1;
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
DeleteCI(HHGear);
-if (HHGear^.State and gstFalling) <> 0 then
+if (HHGear^.State and gstMoving) <> 0 then
if TestCollisionYwithGear(HHGear, 1) then
begin
HHGear^.dY:= _0;
CheckHHDamage(HHGear);
- HHGear^.State:= HHGear^.State and not (gstFalling or gstHHJumping);
+ HHGear^.State:= HHGear^.State and not (gstMoving or gstHHJumping);
end else
begin
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
@@ -754,11 +755,11 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepMine(Gear: PGear);
begin
-if (Gear^.State and (gstMoving or gstFalling)) <> 0 then
+if (Gear^.State and gstMoving) <> 0 then
begin
DeleteCI(Gear);
doStepFallingGear(Gear);
- if (Gear^.State and (gstMoving or gstFalling)) = 0 then
+ if (Gear^.State and gstMoving) = 0 then
begin
AddGearCI(Gear);
Gear^.dX:= _0;
@@ -977,7 +978,7 @@
HHGear^.dY:= HHGear^.dY + cGravity;
if not (HHGear^.dY.isNegative) then
begin
- HHGear^.State:= HHGear^.State or gstFalling;
+ HHGear^.State:= HHGear^.State or gstMoving;
DeleteGear(Gear);
AfterAttack;
exit
@@ -1023,7 +1024,7 @@
SetLittle(dx);
dY:= _0;
State:= State and not (gstAttacking or gstAttacked);
- State:= State or gstFalling;
+ State:= State or gstMoving;
end;
DeleteGear(Gear);
if Gear^.Timer > 10 then
@@ -1158,7 +1159,7 @@
Gear^.doStep:= @doStepTeleportAfter;
HHGear^.X:= int2hwFloat(TargetPoint.X);
HHGear^.Y:= int2hwFloat(TargetPoint.Y);
- HHGear^.State:= HHGear^.State or gstFalling
+ HHGear^.State:= HHGear^.State or gstMoving
end;
TargetPoint.X:= NoPointX
end;