more drowning fixes
authornemo
Tue, 14 May 2013 07:14:41 -0400
changeset 8990 e64a1a851b69
parent 8989 ae97ab6dcc70
child 8991 82e3a6e5d51b
more drowning fixes
hedgewars/GSHandlers.inc
hedgewars/uGearsUtils.pas
--- a/hedgewars/GSHandlers.inc	Tue May 14 06:33:59 2013 -0400
+++ b/hedgewars/GSHandlers.inc	Tue May 14 07:14:41 2013 -0400
@@ -3274,7 +3274,7 @@
     if // (Gear^.Health = 0)
         (HHGear^.Damage <> 0)
         //or CheckGearDrowning(HHGear)
-        or (cWaterLine + 512 < hwRound(HHGear^.Y))
+        or (cWaterLine + cVisibleWater * 4 < hwRound(HHGear^.Y))
         or (TurnTimeLeft = 0)
         // allow brief ground touches - to be fair on this, might need another counter
         or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and (TestCollisionYwithGear(HHGear, 1) <> 0))
--- a/hedgewars/uGearsUtils.pas	Tue May 14 06:33:59 2013 -0400
+++ b/hedgewars/uGearsUtils.pas	Tue May 14 07:14:41 2013 -0400
@@ -369,7 +369,7 @@
         vdX:= hwFloat2Float(Gear^.dX);
         vdY:= hwFloat2Float(Gear^.dY);
         // this could perhaps be a tiny bit higher.
-        if  (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed)
+        if  (cWaterLine + 64 + Gear^.Radius > Y) and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) 
         and (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
             begin
             Gear^.dY.isNegative := true;
@@ -406,7 +406,10 @@
                         Gear^.doStep := @doStepDrowningGear;
                         if Gear^.Kind = gtFlake then
                             exit // skip splashes 
-                end;
+                end
+            else if (Y > cWaterLine + cVisibleWater) and 
+                    ((Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.AmmoType <> amJetpack)) then
+                Gear^.doStep:= @doStepDrowningGear;
             if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius))
             or (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and (Gear = CurAmmoGear) and ((CurAmmoGear^.Pos = 0)
             and (CurAmmoGear^.dY < _0_01))) then