# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1525560523 -7200
# Node ID 354ceada9c40b25f3578f2816f6c481b288e645d
# Parent  e6e4019d02be0cd513985107f171a6258207fc92# Parent  caed04706564ba616fb04c6cc4c502996234edbd
Merge default

diff -r e6e4019d02be -r 354ceada9c40 hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sun May 06 00:47:49 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sun May 06 00:48:43 2018 +0200
@@ -1322,6 +1322,22 @@
     end;
 end;
 
+procedure CheckBulletDrowningHelp(Bullet: PGear);
+var dX, dY: hwFloat;
+begin
+    dX := Bullet^.dX;
+    dY := Bullet^.dY;
+    CheckGearDrowning(Bullet);
+    if (dX <> Bullet^.dX) or (dY <> Bullet^.dY) then
+    begin
+        SpawnBulletTrail(Bullet, Bullet^.X, Bullet^.Y, Bullet^.FlightTime = 0);
+        Bullet^.Elasticity := Bullet^.X;
+        Bullet^.Friction := Bullet^.Y;
+        Inc(Bullet^.PortalCounter);
+        Bullet^.FlightTime:= 1;
+    end;
+end;
+
 procedure doStepBulletWork(Gear: PGear);
 var
     i, x, y, iInit: LongWord;
@@ -1378,7 +1394,7 @@
             dec(Gear^.Damage);
             Gear^.X := Gear^.X - Gear^.dX;
             Gear^.Y := Gear^.Y - Gear^.dY;
-            CheckGearDrowning(Gear);
+            CheckBulletDrowningHelp(Gear);
             break;
             end
         else if (not isDigging) then
@@ -1395,7 +1411,7 @@
             oY:= Gear^.Y;
             end;
 
-        CheckGearDrowning(Gear);
+        CheckBulletDrowningHelp(Gear);
         case Gear^.Kind of
             gtMinigunBullet: isDead:= isDigging or ((Gear^.State and gstDrowning) <> 0);
             gtDEagleShot, gtSniperRifleShot: isDead:= (Gear^.Damage >= Gear^.Health) or ((Gear^.State and gstDrowning) <> 0)
diff -r e6e4019d02be -r 354ceada9c40 hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsUtils.pas	Sun May 06 00:47:49 2018 +0200
+++ b/hedgewars/uGearsUtils.pas	Sun May 06 00:48:43 2018 +0200
@@ -1273,7 +1273,7 @@
     if (Gear^.State and gstNoDamage) = 0 then
         begin
 
-        if (Gear^.Kind <> gtMinigun) and
+        if (not (Gear^.Kind in [gtMinigun, gtPortal])) and
             ((Ammo^.Kind = gtDEagleShot)
                 or (Ammo^.Kind = gtSniperRifleShot)
                 or (Ammo^.Kind = gtMinigunBullet)) then