Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
authorPalewolf
Sat, 01 Jan 2011 19:41:58 +0100
changeset 4805 01332828b568
parent 4804 af59f3dfc53a
child 4806 48c1a395f0a7
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sat Jan 01 14:42:08 2011 +0100
+++ b/hedgewars/GSHandlers.inc	Sat Jan 01 19:41:58 2011 +0100
@@ -600,10 +600,8 @@
     // move back to cloud layer
         if yy > cWaterLine then move:= true
         else if ((yy and LAND_HEIGHT_MASK) <> 0) or ((xx and LAND_WIDTH_MASK) <> 0) then move:=true
-        // Hog/Object encountered
-        else if ((Land[yy, xx] and $FF) <> 0) then move:=true
         // Solid pixel encountered
-        else if (Land[yy, xx] > 255) then
+        else if (Land[yy, xx] <> 0) then
             begin
             // If there's room below keep falling
             if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then
@@ -631,6 +629,9 @@
                 X:= X + _0_8 * 2 * hwSign(cWindSpeed);
                 Y:= Y - dY - cGravity * vobFallSpeed * 8;
                 end
+            // if there's an hog/object below do nothing
+            else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy+1, xx] and $FF) <> 0))
+                then move:=true
             else
                 begin
                 // we've collided with land. draw some stuff and get back into the clouds