hedgewars/uGearsHandlersRope.pas
changeset 7604 c143c942b5fe
parent 7602 a620319d377e
child 7605 10e88fbb5fdb
--- a/hedgewars/uGearsHandlersRope.pas	Sat Aug 25 18:35:59 2012 -0400
+++ b/hedgewars/uGearsHandlersRope.pas	Sat Aug 25 20:15:19 2012 -0400
@@ -87,6 +87,8 @@
 end;
 
 procedure RopeWaitCollision(Gear, HHGear: PGear);
+var i: LongInt;
+    stuck: Boolean;
 begin
     PlaySound(sndRopeRelease);
     with HHGear^ do
@@ -94,6 +96,17 @@
         Message := Message and (not gmAttack);
         State := State or gstMoving;
         end;
+    if (TestCollisionYwithGear(HHGear, 1) <> 0) and (TestCollisionYwithGear(HHGear, -1) = 0) then
+        begin
+        i:= 1;
+        repeat
+            begin
+            inc(i);
+            stuck:= TestCollisionYwithGear(HHGear, i) <> 0
+            end
+        until (i = 8) or not stuck;
+        HHGear^.Y:= HHGear^.Y-int2hwFloat(pred(i))
+        end;
     RopePoints.Count := 0;
     Gear^.Elasticity := _0;
     Gear^.doStep := @doStepRopeAfterAttack;
@@ -168,6 +181,8 @@
             Gear^.Elasticity := Gear^.Elasticity - _2_4
     else haveCollision:= true;
 
+(*
+I am not so sure this is useful. Disabling
     if haveCollision then
         begin
         if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) and not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
@@ -175,6 +190,7 @@
         if (TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) <> 0) and (TestCollisionYwithGear(HHGear, -hwSign(HHGear^.dY)) = 0) then
             HHGear^.dY.isNegative:= not HHGear^.dY.isNegative;
         end;
+*)
 
     mdX := ropeDx + HHGear^.dX;
     mdY := ropeDy + HHGear^.dY;