hedgewars/uCollisions.pas
branchwebgl
changeset 9521 8054d9d775fd
parent 9248 3e8558dc285a
parent 9305 8e5140875ab5
child 9950 2759212a27de
--- a/hedgewars/uCollisions.pas	Fri Oct 11 11:55:31 2013 +0200
+++ b/hedgewars/uCollisions.pas	Fri Oct 11 17:43:13 2013 +0200
@@ -33,7 +33,7 @@
 procedure initModule;
 procedure freeModule;
 
-procedure AddGearCI(Gear: PGear);
+procedure AddCI(Gear: PGear);
 procedure DeleteCI(Gear: PGear);
 
 function  CheckGearsCollision(Gear: PGear): PGearArray;
@@ -72,7 +72,7 @@
     cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry;
     ga: TGearArray;
 
-procedure AddGearCI(Gear: PGear);
+procedure AddCI(Gear: PGear);
 var t: PGear;
 begin
 if Gear^.CollisionIndex >= 0 then
@@ -83,7 +83,7 @@
     X:= hwRound(Gear^.X);
     Y:= hwRound(Gear^.Y);
     Radius:= Gear^.Radius;
-    ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen <> 0)));
+    ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0)));
     cGear:= Gear
     end;
 Gear^.CollisionIndex:= Count;
@@ -104,7 +104,7 @@
 if Gear^.CollisionIndex >= 0 then
     begin
     with cinfos[Gear^.CollisionIndex] do
-        ChangeRoundInLand(X, Y, Radius - 1, false, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen <> 0)));
+        ChangeRoundInLand(X, Y, Radius - 1, false, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0)));
     cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)];
     cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex;
     Gear^.CollisionIndex:= -1;
@@ -237,12 +237,14 @@
 
     for i:= 0 to Pred(Count) do
         with cinfos[i] do
-            if (Gear <> cGear) and (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2))
-            and ((mx > x) xor (Dir > 0)) and
+            if  (Gear <> cGear) and 
+                ((mx > x) xor (Dir > 0)) and
                 (
                   ((cGear^.Kind in [gtHedgehog, gtMine, gtKnife]) 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
+                  ((cGear^.Kind = gtExplosives) and ((cGear^.State and gsttmpflag) <> 0))
+                ) and
+                (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) then
                     begin
                     with cGear^ do
                         begin
@@ -300,11 +302,11 @@
 
     for i:= 0 to Pred(Count) do
         with cinfos[i] do
-            if (Gear <> cGear) and (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2))
-            and ((myr > y) xor (Dir > 0)) and
-                (
-                 (cGear^.Kind in [gtHedgehog, gtMine, gtKnife, gtExplosives]) and 
-                 ((Gear^.State and gstNotKickable) = 0)) then
+            if (Gear <> cGear) and
+               ((myr > y) xor (Dir > 0)) and
+               (Gear^.State and gstNotKickable = 0) and
+               (cGear^.Kind in [gtHedgehog, gtMine, gtKnife, gtExplosives]) and 
+               (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) then
                     begin
                     with cGear^ do
                         begin