tweak a few params. still something wtf going on when on rope
authornemo
Sat, 17 Jan 2015 10:07:12 -0500
changeset 10791 0311c9fa7498
parent 10790 7e8ea160152f
child 10792 f6df7d6e18e5
child 10793 f8e0961b463e
tweak a few params. still something wtf going on when on rope
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsList.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sat Jan 17 14:26:25 2015 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Jan 17 10:07:12 2015 -0500
@@ -1778,7 +1778,9 @@
     else if Gear^.Hedgehog <> nil then
         targ:= Gear^.Hedgehog^.Gear;
     // todo, allow not finding new target, set timeout on target retention
-    if (Gear^.State and gsttmpFlag <> 0) and (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) then // recheck hunted hog
+    if (Gear^.State and (gsttmpFlag or gstAttacking) =  gsttmpFlag) and
+       (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and
+       (GameTicks > Gear^.FlightTime) then // recheck hunted hog
         begin
         if targ <> nil then
              targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round
@@ -1804,7 +1806,8 @@
                                 targ:= tmpG;
                                 end
                             end
-                        end
+                        end;
+        Gear^.FlightTime:= GameTicks + 10000
         end;
     if targ <> nil then
         begin
@@ -1841,10 +1844,29 @@
                 PlaySound(sndMineTick);
             if Gear^.Timer = 0 then
                 begin
-                Gear^.Hedgehog:= CurrentHedgehog;
-                doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound);
-                DeleteGear(Gear);
-                exit
+                // recheck
+                if targ <> nil then
+                    begin
+                    tX:=Gear^.X-targ^.X;
+                    tY:=Gear^.Y-targ^.Y;
+                    if (tX.Round+tY.Round < Gear^.Karma) and
+                       (hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Karma)) then
+                        begin
+                        Gear^.Hedgehog:= CurrentHedgehog;
+                        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound);
+                        DeleteGear(Gear);
+                        exit
+                        end
+                    end
+                else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Karma, Gear^.Karma) <> nil) then
+                    begin
+                    Gear^.Hedgehog:= CurrentHedgehog;
+                    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound);
+                    DeleteGear(Gear);
+                    exit
+                    end;
+                Gear^.State:= Gear^.State and not gstAttacking;
+                Gear^.Timer:= Gear^.WDTimer
                 end;
             dec(Gear^.Timer);
             end
@@ -1852,7 +1874,10 @@
         if (TurnTimeLeft = 0)
         or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))
         or (CurrentHedgehog^.Gear = nil) then
-            Gear^.State := Gear^.State or gsttmpFlag;
+        begin
+        Gear^.FlightTime:= GameTicks;
+        Gear^.State := Gear^.State or gsttmpFlag
+        end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uGearsList.pas	Sat Jan 17 14:26:25 2015 +0100
+++ b/hedgewars/uGearsList.pas	Sat Jan 17 10:07:12 2015 -0500
@@ -369,11 +369,12 @@
                 gear^.Elasticity:= _0_55;
                 gear^.Friction:= _0_995;
                 gear^.Density:= _1;
-                gear^.Angle:= 125; // Radius at which air bombs will start "seeking". $FFFFFFFF = unlimited. check is skipped.
-                gear^.Power:= 536871; // hwFloat converted. 1/4 g default. defines the "seek" speed when a gear is in range.
+                gear^.Angle:= 175; // Radius at which air bombs will start "seeking". $FFFFFFFF = unlimited. check is skipped.
+                gear^.Power:= cGravity.QWordValue div 2; // hwFloat converted. 1/2 g default. defines the "seek" speed when a gear is in range.
                 gear^.Pos:= 134217; // air friction. slows it down when not hitting stuff
                 gear^.Karma:= 30; // damage
                 gear^.Timer:= 500;
+                gear^.WDTimer:= 500;
                 end;
        gtSMine: begin
                 gear^.Health:= 10;