Remove all placement restrictions of air attack and friends
authorWuzzy <Wuzzy2@mail.ru>
Thu, 11 Jul 2019 00:53:29 +0200
changeset 15245 f16376e9374f
parent 15244 32678e65b25e
child 15246 ebbc2f04b863
Remove all placement restrictions of air attack and friends
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Thu Jul 11 00:45:49 2019 +0200
+++ b/ChangeLog.txt	Thu Jul 11 00:53:29 2019 +0200
@@ -33,7 +33,6 @@
  * Fix player-chosen teams ignoring custom team controls in campaigns
  * Fix broken behaviour of airborne attacks when placed near bounce world edge
  * Fix crate sometimes collected twice when switching to hedgehog that touches it
- * Deny placement of airborne attack in “impossible” places in maps with bounce world edge
  * Deny placement of piano beyond bounce world edge
  * Fix laser sight not working properly when it starts out of map bounds
  * Fix parachute making hog stuck or fast when bumping into wall while looking other way
--- a/hedgewars/uGearsHandlersMess.pas	Thu Jul 11 00:45:49 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Jul 11 00:53:29 2019 +0200
@@ -3072,25 +3072,16 @@
     if (Gear^.Health > 0) and (not (Gear^.X < Gear^.dX)) and (Gear^.X < Gear^.dX + cAirPlaneSpeed) then
         begin
         dec(Gear^.Health);
-        if (WorldEdge = weBounce) and (((Gear^.Tag = 1) and (hwRound(Gear^.X) > rightX)) or ((Gear^.Tag = -1) and (hwRound(Gear^.X) < leftX))) then
-            begin
-            // Don't spawn missile if it would end up inside bounce world edge of the opposite side
-            PlaySound(sndVaporize);
-            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmoke);
-            end
-        else
-            begin
-            // Spawn missile
-            case Gear^.State of
-                0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
-                1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed * Gear^.Tag, _0, 0);
-                2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
-                3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed * Gear^.Tag, _0, Gear^.Timer + 1);
-            end;
-            Gear^.dX := Gear^.dX + int2hwFloat(Gear^.Damage * Gear^.Tag);
-            if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
-                FollowGear^.State:= FollowGear^.State or gstSubmersible;
-            end;
+        // Spawn missile
+        case Gear^.State of
+            0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
+            1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed * Gear^.Tag, _0, 0);
+            2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
+            3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed * Gear^.Tag, _0, Gear^.Timer + 1);
+        end;
+        Gear^.dX := Gear^.dX + int2hwFloat(Gear^.Damage * Gear^.Tag);
+        if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
+            FollowGear^.State:= FollowGear^.State or gstSubmersible;
         StopSoundChan(Gear^.SoundChannel, 4000);
         end;
 
@@ -3106,42 +3097,13 @@
 end;
 
 procedure doStepAirAttack(Gear: PGear);
-var valid: boolean;
-    HHGear: PGear;
+var HHGear: PGear;
 begin
     AllInactive := false;
 
-    valid:= true;
-    // Bounce world edge restrictions ...
-    if (WorldEdge = weBounce) then
-        // If plane flies right, deny placement inside the right bounce side
-        if (Gear^.X.QWordValue = 0) and (Gear^.Target.X > rightX) then
-            valid:= false
-        // If plane flies left, deny placement inside the left bounce side
-        else if (Gear^.X.QWordValue <> 0) and (Gear^.Target.X < leftX) then
-            valid:= false
-        // Deny placement of high targets. This serves as a buffer to further
-        // reduce potentially weird bouncy gear behaviour
-        else if (Gear^.Target.Y < (topY - 50)) then
-            valid:= false;
-
     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
         HHGear:= Gear^.Hedgehog^.Gear;
 
-    if (not valid) then
-        begin
-        if (HHGear <> nil) then
-            begin
-            HHGear^.Message := HHGear^.Message and (not gmAttack);
-            HHGear^.State := HHGear^.State and (not gstAttacking);
-            HHGear^.State := HHGear^.State or gstChooseTarget;
-            isCursorVisible := true;
-            end;
-        DeleteGear(Gear);
-        PlaySound(sndDenied);
-        exit;
-        end;
-
     if (HHGear <> nil) then
         PlaySoundV(sndIncoming, Gear^.Hedgehog^.Team^.voicepack);
     AfterAttack;