make all bullets function similar to machinegun bullets (can hit/shove objects without checkin)
authornemo
Thu, 24 May 2018 13:04:56 -0400
changeset 13408 9c9d29be9e00
parent 13407 13be6de7860f
child 13409 8ce83caec236
make all bullets function similar to machinegun bullets (can hit/shove objects without checkin)
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Thu May 24 09:51:11 2018 -0400
+++ b/hedgewars/uGearsHandlersMess.pas	Thu May 24 13:04:56 2018 -0400
@@ -1301,8 +1301,7 @@
 procedure LineShoveHelp(Gear: PGear; oX, oY, tX, tY, dX, dY: hwFloat; count: LongWord);
 var dmg,power: LongInt;
 begin
-    if ((Gear^.Kind = gtMinigunBullet) or (Gear^.Damage > 0))
-    and (hwSqr(tX - oX) + hwSqr(tY - oY) > _0_25) then
+    if hwSqr(tX - oX) + hwSqr(tY - oY) > _0_25 then
     begin
         if (Gear^.AmmoType = amDEagle) or (Gear^.AmmoType = amMinigun) then
             dmg:= Gear^.Boom
@@ -1486,6 +1485,7 @@
         Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear);
 
     PlaySound(sndGun);
+    ClearHitOrder();
     // add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles
     Gear^.X := Gear^.X + Gear^.dX * 2;
     Gear^.Y := Gear^.Y + Gear^.dY * 2;
@@ -1528,6 +1528,7 @@
         Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5;
         Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5;
         PlaySound(sndGun);
+        ClearHitOrder();
         // add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles
         Gear^.X := Gear^.X + Gear^.dX * 2;
         Gear^.Y := Gear^.Y + Gear^.dY * 2;
--- a/hedgewars/uGearsUtils.pas	Thu May 24 09:51:11 2018 -0400
+++ b/hedgewars/uGearsUtils.pas	Thu May 24 13:04:56 2018 -0400
@@ -1291,8 +1291,9 @@
     begin
     dec(i);
     Gear:= t^.ar[i];
-    if (Ammo^.Data <> nil) and (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet]) and (PGear(Ammo^.Data) = Gear)
-    or ((Ammo^.Kind = gtMinigunBullet) and (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
+    if (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet])
+        and (((Ammo^.Data <> nil) and (PGear(Ammo^.Data) = Gear))
+             or (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
         continue;
 
     if ((Ammo^.Kind = gtFlame) or (Ammo^.Kind = gtBlowTorch)) and
@@ -1303,9 +1304,7 @@
         begin
 
         if (not (Gear^.Kind in [gtMinigun, gtPortal])) and
-            ((Ammo^.Kind = gtDEagleShot)
-                or (Ammo^.Kind = gtSniperRifleShot)
-                or (Ammo^.Kind = gtMinigunBullet)) then
+            (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet]) then
             begin
             VGear := AddVisualGear(t^.cX[i], t^.cY[i], vgtBulletHit);
             if VGear <> nil then
@@ -1413,10 +1412,7 @@
 procedure AmmoShoveLine(Ammo: PGear; Damage, Power: LongInt; oX, oY, tX, tY: hwFloat);
 var t: PGearArray;
 begin
-    if Ammo^.Kind = gtMinigunBullet then
-        t:= CheckAllGearsLineCollision(Ammo, oX, oY, tX, tY)
-    else
-        t:= CheckGearsLineCollision(Ammo, oX, oY, tX, tY);
+    t:= CheckAllGearsLineCollision(Ammo, oX, oY, tX, tY);
     AmmoShoveImpl(Ammo, Damage, Power, t);
 end;