hedgewars/uCollisions.pas
changeset 13470 7b4643ff60ea
parent 13469 f1d349a52bc7
child 14027 105793e575d6
--- a/hedgewars/uCollisions.pas	Tue Jul 10 18:00:04 2018 +0200
+++ b/hedgewars/uCollisions.pas	Tue Jul 10 18:35:31 2018 +0200
@@ -344,7 +344,7 @@
 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
     ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.X) - Gear^.Radius) or
      (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.X) + Gear^.Radius)) then
-    Gear^.CollisionMask:= $FFFF;
+    Gear^.CollisionMask:= lfAll;
 
 x:= hwRound(Gear^.X);
 if Dir < 0 then
@@ -373,7 +373,7 @@
 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
     ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.Y) - Gear^.Radius) or
      (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.Y) + Gear^.Radius)) then
-    Gear^.CollisionMask:= $FFFF;
+    Gear^.CollisionMask:= lfAll;
 
 y:= hwRound(Gear^.Y);
 if Dir < 0 then
@@ -417,7 +417,7 @@
             begin
             if Land[y, x] and Gear^.CollisionMask <> 0 then
                 begin
-                if Land[y, x] and Gear^.CollisionMask > 255 then
+                if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then
                     exit(Land[y, x] and Gear^.CollisionMask)
                 else
                     pixel:= Land[y, x] and Gear^.CollisionMask;
@@ -483,7 +483,7 @@
     if (x and LAND_WIDTH_MASK) = 0 then
         if Land[y, x] > 0 then
             begin
-            if Land[y, x] and Gear^.CollisionMask > 255 then
+            if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then
                 exit(Land[y, x] and Gear^.CollisionMask)
             else // if Land[y, x] <> 0 then
                 pixel:= Land[y, x] and Gear^.CollisionMask;
@@ -558,7 +558,7 @@
     i:= y + Gear^.Radius * 2 - 2;
     repeat
         if (y and LAND_HEIGHT_MASK) = 0 then
-            if Land[y, x] and Gear^.CollisionMask > 255 then
+            if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then
                 exit(Land[y, x] and Gear^.CollisionMask);
     inc(y)
     until (y > i);
@@ -581,7 +581,7 @@
     i:= x + Gear^.Radius * 2 - 2;
     repeat
         if (x and LAND_WIDTH_MASK) = 0 then
-            if Land[y, x] and Gear^.CollisionMask > 255 then
+            if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then
                 exit(Land[y, x] and Gear^.CollisionMask);
     inc(x)
     until (x > i);
@@ -897,7 +897,7 @@
     i:= x + Gear^.Radius * 2 - 2;
     repeat
     if (x and LAND_WIDTH_MASK) = 0 then
-        if Land[y, x] > 255 then
+        if (Land[y, x] and lfNotObjMask) <> 0 then
             if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
                 begin
                 isColl:= true;