fix underwater-skipping bug and make air-strike missiles submersible when fired from within weSea
authorsheepluva
Mon, 17 Nov 2014 23:23:10 +0100
changeset 10512 25021aac078e
parent 10511 c33b2f001730
child 10513 58fa783e0cfd
fix underwater-skipping bug and make air-strike missiles submersible when fired from within weSea
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Tue Nov 18 00:32:39 2014 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Nov 17 23:23:10 2014 +0100
@@ -2428,6 +2428,8 @@
             //                 Gear^.Tag, _0, 5000);
             end;
         Gear^.dX := Gear^.dX + int2hwFloat(30 * Gear^.Tag);
+        if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
+            FollowGear^.State:= FollowGear^.State or gstSubmersible;
         StopSoundChan(Gear^.SoundChannel, 4000);
         end;
 
--- a/hedgewars/uGearsUtils.pas	Tue Nov 18 00:32:39 2014 +0300
+++ b/hedgewars/uGearsUtils.pas	Mon Nov 17 23:23:10 2014 +0100
@@ -556,7 +556,7 @@
 
         // skipping
 
-        if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed)
+        if (not isSubmersible) and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed)
         and ( ((not isDirH) and (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)))
           or (isDirH and (hwAbs(Gear^.dY) > skipAngle * hwAbs(Gear^.dX))) ) then
             begin