diff -r 3ec95dc2b249 -r ea4d1fe665d7 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Fri Sep 09 22:04:40 2011 +0400 +++ b/hedgewars/HHHandlers.inc Fri Sep 09 20:17:50 2011 +0200 @@ -770,6 +770,30 @@ Gear^.State:= Gear^.State and not gstMoving; exit end; + +// move hedgehogs out of walls +if hwAbs(Gear^.dX) < _0_03 then + begin + if CountCollisionsX(Gear, -1) > Gear^.Radius then + repeat + Gear^.X:= Gear^.X + _1; + if CountCollisionsX(Gear, 1) > Gear^.Radius then + begin + Gear^.X:= Gear^.X - _1; + break; + end + until CountCollisionsX(Gear, -1) <= Gear^.Radius + else if CountCollisionsX(Gear, 1) > Gear^.Radius then + repeat + Gear^.X:= Gear^. X - _1; + if CountCollisionsX(Gear, -1) > Gear^.Radius then + begin + Gear^.X:= Gear^.X + _1; + break; + end + until CountCollisionsX(Gear, 1) <= Gear^.Radius; + end; + isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1); if isFalling then begin