hedgewars/HHHandlers.inc
changeset 3907 5b516f0d9957
parent 3894 9abce5468583
child 3909 4ba25a3d15af
--- a/hedgewars/HHHandlers.inc	Sun Sep 26 17:02:44 2010 +0200
+++ b/hedgewars/HHHandlers.inc	Sun Sep 26 15:40:59 2010 -0400
@@ -604,8 +604,9 @@
 procedure doStepHedgehog(Gear: PGear); forward;
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogMoving(Gear: PGear);
-var isFalling: boolean;
+var isFalling, isUnderwater: boolean;
 begin
+isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
 if Gear^.dX > _0_995 then Gear^.dX:= _0_995;
 if Gear^.dY > _0_995 then Gear^.dY:= _0_995;
 if PHedgehog(Gear^.Hedgehog)^.Unplaced then
@@ -642,6 +643,12 @@
 
 if (Gear^.State <> 0) then DeleteCI(Gear);
 
+if isUnderwater then
+   begin
+   Gear^.dY:= Gear^.dY * _0_999;
+   Gear^.dX:= Gear^.dX * _0_999;
+   end;
+
 if (Gear^.State and gstMoving) <> 0 then
    if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then
       if not isFalling then