Skip collision on X for barrels that aren't knocked over
authornemo
Mon, 17 May 2010 15:50:48 +0000
changeset 3474 c6d308f5a431
parent 3473 f80431269806
child 3475 95345f98da19
Skip collision on X for barrels that aren't knocked over
hedgewars/uCollisions.pas
--- a/hedgewars/uCollisions.pas	Mon May 17 15:42:48 2010 +0000
+++ b/hedgewars/uCollisions.pas	Mon May 17 15:50:48 2010 +0000
@@ -210,11 +210,13 @@
       if (Gear <> cGear) and
          (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) and
          ((mx > x) xor (Dir > 0)) then
-         if (cGear^.Kind in [gtHedgehog, gtMine, gtExplosives]) and ((Gear^.State and gstNotKickable) = 0) then
+         if ((cGear^.Kind in [gtHedgehog, gtMine]) and ((Gear^.State and gstNotKickable) = 0)) or
+            // only apply X kick if the barrel is knocked over
+            ((cGear^.Kind = gtExplosives) and ((cGear^.State and gsttmpflag) <> 0)) then
              begin
              with cGear^ do
                   begin
-                  if (Kind <> gtExplosives) or ((State and gsttmpflag) <> 0) then dX:= Gear^.dX;
+                  dX:= Gear^.dX;
                   dY:= Gear^.dY * _0_5;
                   State:= State or gstMoving;
                   Active:= true