weBounce: Force hedgehogs to stay in playable area
authorWuzzy <Wuzzy2@mail.ru>
Sat, 15 Jun 2019 13:06:15 +0200
changeset 15152 5dc3e3f1c0f9
parent 15151 6b7d92fa4912
child 15153 95b72e81a866
weBounce: Force hedgehogs to stay in playable area
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Sat Jun 15 12:58:01 2019 +0200
+++ b/hedgewars/uGearsUtils.pas	Sat Jun 15 13:06:15 2019 +0200
@@ -1762,14 +1762,14 @@
     else if WorldEdge = weBounce then
         begin
         bounced:= false;
-        if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX)) then
+        if (hwRound(Gear^.X) - Gear^.Radius < leftX) and (Gear^.Kind = gtHedgehog) or ((hwSign(Gear^.dX) = -1) and (not isZero(Gear^.dX))) 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 (hwSign(Gear^.dX) = 1) and (not isZero(Gear^.dX)) then
+        else if (hwRound(Gear^.X) - Gear^.Radius > rightX) and (Gear^.Kind = gtHedgehog) or ((hwSign(Gear^.dX) = 1) and (not isZero(Gear^.dX))) then
             begin
             RightImpactTimer:= 333;
             Gear^.dX.isNegative:= true;