Index: src/actions/Walker.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/Walker.cc,v
retrieving revision 1.5
diff -u -r1.5 Walker.cc
--- src/actions/Walker.cc	2001/08/16 22:00:50	1.5
+++ src/actions/Walker.cc	2001/12/04 07:21:01
@@ -84,25 +84,39 @@
 	}
     }
   
-  if (rel_getpixel(0, 26) != ColMap::NOTHING && !(rel_getpixel(0, 26) & ColMap::BRIDGE))
-    {
-      if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
-	std::cout << "Pingu: Head collision" << std::endl;
-      pingu->direction.change();
-      return;
-    }
 
   if (rel_getpixel(0,-1) & ColMap::WATER)
     {
       pingu->set_paction ("drown");
       return;
+    }
+  // pingu is walking down a hill. 
+  // this should have fixed the following `FIXME'. do we need a 
+  // better transition?
+  // FIXME: We need better translation between walker and faller
+  else if (rel_getpixel(0,-1) == ColMap::NOTHING)
+    {
+       if (rel_getpixel(0,-2) != ColMap::NOTHING) 
+         pingu->pos.y += 1; 
+       else if (rel_getpixel(0,-3) != ColMap::NOTHING) 
+	 pingu->pos.y += 2;  // allow some more steep downhill
+       else {
+         pingu->set_action("faller");
+	 return;
+       }
     }
-  else if (rel_getpixel(0,-1) == ColMap::NOTHING
-	   && rel_getpixel(0,-2) == ColMap::NOTHING)
+
+  // This is moved here to fix the bug where pingu stuck turning both
+  // sides indefinetely when a head collision occured. the fix needs the
+  // above downhill walk being done before head collision check.
+  if (rel_getpixel(0, 26) != ColMap::NOTHING && !(rel_getpixel(0, 26) & ColMap::BRIDGE))
     {
-      // FIXME: We need better translation between walker and faller
-      pingu->set_action("faller");
+      if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
+	std::cout << "Pingu: Head collision" << std::endl;
+      pingu->direction.change();
+      return;
     }
+
 }
 
 void  
