hedgewars/GSHandlers.inc
changeset 2938 451f917ac46c
parent 2937 da06c25edf1d
child 2939 58d811e0d41c
--- a/hedgewars/GSHandlers.inc	Fri Mar 05 02:28:03 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Mar 05 02:51:12 2010 +0000
@@ -1264,8 +1264,7 @@
     V:= hwSqr(Gear^.dX) + hwSqr(Gear^.dY);
     //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
     if hwAbs(Gear^.dX) > _0_15 then Gear^.State:= Gear^.State or gstAnimation;
-    if ((Gear^.State and gstAnimation) = 0) or (hwAbs(Gear^.dX) < _0_001) then Gear^.dX:= _0;
-    if ((Gear^.State and gstAnimation) <> 0) and (Gear^.dX.QWordValue <> 0) and (Gear^.dY.QWordValue <> 0)  then
+    if ((Gear^.State and gstAnimation) <> 0) and ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0))  then
         begin
         AllInactive:= false;
         doStepFallingGear(Gear);
@@ -1279,6 +1278,7 @@
 	if Gear^.Health <= 0 then
 		exBoom:= true;
 	end;
+if ((Gear^.State and gstAnimation) = 0) or (hwAbs(Gear^.dX) < _0_001) then Gear^.dX:= _0;
 
 if (Gear^.Damage > 0) or exBoom then
 	begin
@@ -1315,7 +1315,7 @@
         Gear^.Y:= Gear^.Y + Gear^.dY;
 	    if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0
         end;
-    if Gear^.dY < _0_001 then SetAllHHToActive;
+    if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive;
 	if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
 		begin
         if (V > _0_02) and (k = gtExplosives) and ((Gear^.State and gstAnimation) <> 0) then
@@ -1332,8 +1332,8 @@
 	CheckGearDrowning(Gear);
 	end;
 
-if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear)
-	else if (Gear^.dY.QWordValue <> 0) then DeleteCI(Gear)
+if (Gear^.dX.QWordValue = 0) and (Gear^.dY.QWordValue = 0) then AddGearCI(Gear)
+	else DeleteCI(Gear)
 end;
 
 ////////////////////////////////////////////////////////////////////////////////