Merge default
authorWuzzy <Wuzzy2@mail.ru>
Sun, 06 May 2018 00:48:43 +0200
changeset 13383 354ceada9c40
parent 13382 e6e4019d02be (current diff)
parent 13381 caed04706564 (diff)
child 13384 cf8abedaa878
Merge default
--- 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)
--- 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