hedgewars/uCollisions.pas
changeset 521 bc8fd78d7598
parent 517 ba560c17c24c
child 536 33538aadb4e7
--- a/hedgewars/uCollisions.pas	Thu May 24 19:41:51 2007 +0000
+++ b/hedgewars/uCollisions.pas	Thu May 24 20:33:07 2007 +0000
@@ -191,7 +191,7 @@
    end;
 TestCollisionXKick:= false;
 
-if flag and (Gear^.dX > cHHKick) then
+if flag and (hwAbs(Gear^.dX) > cHHKick) then
    begin
    if Count = 0 then exit;
    mx:= hwRound(Gear^.X);
@@ -202,18 +202,18 @@
       if (Gear <> cGear) and
          (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and
          ((mx > x) xor (Dir > 0)) then
-         if (cinfos[i].cGear^.Kind in [gtHedgehog, gtMine]) then
+         if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
              Gear^.dX:= Gear^.dX {* _0_6};
              Gear^.dY:= Gear^.dY {* _0_6};
-             with cinfos[i].cGear^ do
+             with cGear^ do
                   begin
                   dX:= Gear^.dX {* _1_5};
                   dY:= Gear^.dY {* _1_5};
-                  State:= State and gstMoving;
+                  State:= State or gstMoving;
                   Active:= true
                   end;
-             DeleteCI(cinfos[i].cGear);
+             DeleteCI(cGear);
              exit
              end else exit(true)
    end
@@ -241,7 +241,7 @@
    end;
 TestCollisionYKick:= false;
 
-if flag and (Gear^.dX > cHHKick) then
+if flag and (hwAbs(Gear^.dX) > cHHKick) then
    begin
    if Count = 0 then exit;
    mx:= hwRound(Gear^.X);
@@ -252,18 +252,18 @@
       if (Gear <> cGear) and
          (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and
          ((my > y) xor (Dir > 0)) then
-         if (cinfos[i].cGear^.Kind in [gtHedgehog, gtMine]) then
+         if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
              Gear^.dX:= Gear^.dX {* _0_6};
              Gear^.dY:= Gear^.dY {* _0_6};
-             with cinfos[i].cGear^ do
+             with cGear^ do
                   begin
                   dX:= Gear^.dX {* _1_5};
                   dY:= Gear^.dY {* _1_5};
-                  State:= State and gstMoving;
+                  State:= State or gstMoving;
                   Active:= true
                   end;
-             DeleteCI(cinfos[i].cGear);
+             DeleteCI(cGear);
              exit
              end else exit(true)
    end