rope: CheezeMonkey (omg I mentioned your name :O) has pointed out that there is still a way to get stuck in walls. This should fix it.
authorsheepluva
Sat, 24 Sep 2011 01:41:03 +0200
changeset 6002 7f790689205c
parent 6000 dbcebcd3d79f
child 6004 b92a6626b0e5
rope: CheezeMonkey (omg I mentioned your name :O) has pointed out that there is still a way to get stuck in walls. This should fix it. NOTE: although not necessary for this fix to work rope behavior got also changed: I removed the direction-bias. if you press left and right at the same time the result is now neutral rather than left.
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sat Sep 24 00:54:47 2011 +0200
+++ b/hedgewars/GSHandlers.inc	Sat Sep 24 01:41:03 2011 +0200
@@ -1503,9 +1503,11 @@
         exit
         end;
 
-    if (Gear^.Message and gmLeft  <> 0) then HHGear^.dX := HHGear^.dX - _0_0002
-    else
-        if (Gear^.Message and gmRight <> 0) then HHGear^.dX := HHGear^.dX + _0_0002;
+    if (Gear^.Message and gmLeft  <> 0) and not TestCollisionXwithGear(HHGear, -1) then
+        HHGear^.dX := HHGear^.dX - _0_0002;
+
+    if (Gear^.Message and gmRight <> 0) and not TestCollisionXwithGear(HHGear,  1) then
+        HHGear^.dX := HHGear^.dX + _0_0002;
 
     // vector between hedgehog and rope attaching point
     ropeDx := HHGear^.X - Gear^.X;