have napalm strike bombs explode right over the target
authorsheepluva
Wed, 29 Dec 2010 17:27:33 +0100
changeset 4778 1565a553d200
parent 4776 ab956d4647a4
child 4780 8571151411b3
have napalm strike bombs explode right over the target
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Wed Dec 29 15:57:13 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Wed Dec 29 17:27:33 2010 +0100
@@ -2288,9 +2288,13 @@
     Gear^.Y := int2hwFloat(topY-300);
     Gear^.dX := int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
 
-    if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then
-        Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 /
-                    cGravity) * Gear^.Tag;
+    // calcs for Napalm Strike, so that it will hit the target (without wind at least :P)
+    if (Gear^.State = 2) then
+        Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 1000 // ^.Timer of gtNapalmBomb, make it a constant var if you prefer that :P
+    // calcs for regular falling gears
+    else if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then
+            Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 /
+                cGravity) * Gear^.Tag;
 
     Gear^.Health := 6;
     Gear^.doStep := @doStepAirAttackWork;