hedgewars/uGearsHandlersMess.pas
changeset 10827 2b717f687c72
parent 10822 def423815f24
child 10831 19d056c10bbd
--- a/hedgewars/uGearsHandlersMess.pas	Sun Feb 15 21:27:27 2015 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Feb 16 13:58:32 2015 -0500
@@ -1762,11 +1762,16 @@
 var i,t,targDist,tmpDist: LongWord;
     targ, tmpG: PGear;
     trackSpeed, airFriction, tX, tY: hwFloat;
+    isUnderwater: Boolean;
 begin
+    isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius);
     if Gear^.Pos > 0 then
         begin
         airFriction:= _1;
-        dec(airFriction.QWordValue,Gear^.Pos);
+        if isUnderwater then
+            dec(airFriction.QWordValue,Gear^.Pos*2)
+        else
+            dec(airFriction.QWordValue,Gear^.Pos);
         Gear^.dX:= Gear^.dX*airFriction;
         Gear^.dY:= Gear^.dY*airFriction
         end;
@@ -1837,7 +1842,10 @@
     if targ <> nil then
         begin
         trackSpeed:= _0;
-        trackSpeed.QWordValue:= Gear^.Power;
+        if isUnderwater then
+            trackSpeed.QWordValue:= Gear^.Power div 2
+        else
+            trackSpeed.QWordValue:= Gear^.Power;
         if (Gear^.X < targ^.X) and (Gear^.dX < _0_1)  then
              Gear^.dX:= Gear^.dX+trackSpeed // please leave as an add.  I like the effect
         else if (Gear^.X > targ^.X) and (Gear^.dX > -_0_1) then