weBounce: Fix some weird bouncing behaviour
authorWuzzy <Wuzzy2@mail.ru>
Wed, 19 Jun 2019 18:51:02 +0200
changeset 15178 d3998dcc076f
parent 15177 a22013a817e4
child 15179 cd38295cac16
weBounce: Fix some weird bouncing behaviour
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Mon Jun 17 21:43:05 2019 +0200
+++ b/hedgewars/uGearsUtils.pas	Wed Jun 19 18:51:02 2019 +0200
@@ -1763,14 +1763,14 @@
     else if WorldEdge = weBounce then
         begin
         bounced:= false;
-        if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (Gear^.Kind = gtHedgehog) or ((hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX))) then
+        if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (((hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX))) or (Gear^.Kind = gtHedgehog)) then
             begin
             LeftImpactTimer:= 333;
             Gear^.dX.isNegative:= false;
             Gear^.X:= int2hwfloat(leftX + Gear^.Radius);
             bounced:= true;
             end
-        else if (hwRound(Gear^.X) - Gear^.Radius > rightX) and (Gear^.Kind = gtHedgehog) or ((hwSign(Gear^.dX) = 1) and (not isZero(Gear^.dX))) then
+        else if (hwRound(Gear^.X) + Gear^.Radius > rightX) and (((hwSign(Gear^.dX) = 1) and (not isZero(Gear^.dX))) or (Gear^.Kind = gtHedgehog)) then
             begin
             RightImpactTimer:= 333;
             Gear^.dX.isNegative:= true;