hedgewars/uGearsHandlersRope.pas
changeset 9706 5178d2263521
parent 9683 a342837fc875
child 9809 1e32628eb167
--- a/hedgewars/uGearsHandlersRope.pas	Mon Nov 18 22:14:16 2013 +0100
+++ b/hedgewars/uGearsHandlersRope.pas	Tue Nov 19 22:15:40 2013 -0500
@@ -36,7 +36,7 @@
     HHGear := Gear^.Hedgehog^.Gear;
     tX:= HHGear^.X;
     if WorldWrap(HHGear) and (WorldEdge = weWrap) and 
-       (TestCollisionXwithGear(HHGear, 1) or TestCollisionXwithGear(HHGear, -1))  then
+       ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
         begin
         HHGear^.X:= tX;
         HHGear^.dX.isNegative:= (hwRound(tX) > leftX+HHGear^.Radius*2)
@@ -62,7 +62,7 @@
 
     HedgehogChAngle(HHGear);
 
-    if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
+    if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0 then
         SetLittle(HHGear^.dX);
 
     if HHGear^.dY.isNegative and (TestCollisionYwithGear(HHGear, -1) <> 0) then
@@ -127,7 +127,7 @@
 
     tX:= HHGear^.X;
     if WorldWrap(HHGear) and (WorldEdge = weWrap) and 
-       (TestCollisionXwithGear(HHGear, 1) or TestCollisionXwithGear(HHGear, -1))  then
+       ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
         begin
         PlaySound(sndRopeRelease);
         RopeDeleteMe(Gear, HHGear);
@@ -147,17 +147,17 @@
 
     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2;
     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2;
-    if (Gear^.Message and gmLeft  <> 0) and (not TestCollisionXwithGear(HHGear, -1)) then
+    if (Gear^.Message and gmLeft  <> 0) and (TestCollisionXwithGear(HHGear, -1) = 0) then
         HHGear^.dX := HHGear^.dX - _0_0032;
 
-    if (Gear^.Message and gmRight <> 0) and (not TestCollisionXwithGear(HHGear,  1)) then
+    if (Gear^.Message and gmRight <> 0) and (TestCollisionXwithGear(HHGear,  1) = 0) then
         HHGear^.dX := HHGear^.dX + _0_0032;
 
     // vector between hedgehog and rope attaching point
     ropeDx := HHGear^.X - Gear^.X;
     ropeDy := HHGear^.Y - Gear^.Y;
 
-    if not TestCollisionYwithXYShift(HHGear, 0, 1, 1) then
+    if TestCollisionYwithXYShift(HHGear, 0, 1, 1) = 0 then
         begin
 
         // depending on the rope vector we know which X-side to check for collision
@@ -168,12 +168,12 @@
             cd:= 1;
 
         // apply gravity if there is no obstacle
-        if not (TestCollisionXwithXYShift(HHGear, _2*cd, 0, cd, true)) then
+        if TestCollisionXwithXYShift(HHGear, _2*cd, 0, cd, true) = 0 then
             HHGear^.dY := HHGear^.dY + cGravity * 16;
 
         if (GameFlags and gfMoreWind) <> 0 then
             // apply wind if there's no obstacle
-            if not TestCollisionXwithGear(HHGear, hwSign(cWindSpeed)) then
+            if TestCollisionXwithGear(HHGear, hwSign(cWindSpeed)) = 0 then
                 HHGear^.dX := HHGear^.dX + cWindSpeed * 16 / HHGear^.Density;
         end;
 
@@ -193,13 +193,13 @@
     ty := HHGear^.Y;
 
     if ((Gear^.Message and gmDown) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
-        if not (TestCollisionXwithXYShift(HHGear, _2*hwSign(ropeDx), 0, hwSign(ropeDx), true)
-        or ((ropeDy.QWordValue <> 0) and TestCollisionYwithXYShift(HHGear, 0, 1*hwSign(ropeDy), hwSign(ropeDy)))) then
+        if not ((TestCollisionXwithXYShift(HHGear, _2*hwSign(ropeDx), 0, hwSign(ropeDx), true) <> 0)
+        or ((ropeDy.QWordValue <> 0) and (TestCollisionYwithXYShift(HHGear, 0, 1*hwSign(ropeDy), hwSign(ropeDy)) <> 0))) then
             Gear^.Elasticity := Gear^.Elasticity + _1_2;
 
     if ((Gear^.Message and gmUp) <> 0) and (Gear^.Elasticity > _30) then
-        if not (TestCollisionXwithXYShift(HHGear, -_2*hwSign(ropeDx), 0, -hwSign(ropeDx), true)
-        or ((ropeDy.QWordValue <> 0) and TestCollisionYwithXYShift(HHGear, 0, 1*-hwSign(ropeDy), -hwSign(ropeDy)))) then
+        if not ((TestCollisionXwithXYShift(HHGear, -_2*hwSign(ropeDx), 0, -hwSign(ropeDx), true) <> 0)
+        or ((ropeDy.QWordValue <> 0) and (TestCollisionYwithXYShift(HHGear, 0, 1*-hwSign(ropeDy), -hwSign(ropeDy)) <> 0))) then
             Gear^.Elasticity := Gear^.Elasticity - _1_2;
 
     HHGear^.X := Gear^.X + mdX * Gear^.Elasticity;
@@ -315,12 +315,12 @@
             end;
 
     haveCollision := false;
-    if TestCollisionXwithXYShift(HHGear, _2*hwSign(HHGear^.dX), 0, hwSign(HHGear^.dX), true) then
+    if TestCollisionXwithXYShift(HHGear, _2*hwSign(HHGear^.dX), 0, hwSign(HHGear^.dX), true) <> 0 then
         begin
         HHGear^.dX := -_0_6 * HHGear^.dX;
         haveCollision := true
         end;
-    if TestCollisionYwithXYShift(HHGear, 0, 1*hwSign(HHGear^.dY), hwSign(HHGear^.dY)) then
+    if TestCollisionYwithXYShift(HHGear, 0, 1*hwSign(HHGear^.dY), hwSign(HHGear^.dY)) <> 0 then
         begin
         HHGear^.dY := -_0_6 * HHGear^.dY;
         haveCollision := true
@@ -418,7 +418,7 @@
 
     if (HHGear^.State and gstMoving) <> 0 then
         begin
-        if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
+        if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0 then
             SetLittle(HHGear^.dX);
         if HHGear^.dY.isNegative and (TestCollisionYwithGear(HHGear, -1) <> 0) then
             HHGear^.dY := _0;