# HG changeset patch # User Urbertar # Date 1364330362 -7200 # Node ID 43e106417a057ce0dcd99969b6d0c6958c32f94a # Parent caba5291face6a4087abd6308b5dd82d4309b66e Change AI behavior for drill rocket diff -r caba5291face -r 43e106417a05 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Mar 26 17:34:29 2013 +0100 +++ b/hedgewars/GSHandlers.inc Tue Mar 26 22:39:22 2013 +0200 @@ -2886,18 +2886,16 @@ procedure doStepDrillDrilling(Gear: PGear); var t: PGearArray; - ox, oy: hwFloat; tempColl: Word; begin AllInactive := false; + if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then begin - ox := Gear^.X; - oy := Gear^.Y; + DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6); Gear^.X := Gear^.X + Gear^.dX; Gear^.Y := Gear^.Y + Gear^.dY; - DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); if (Gear^.Timer mod 30) = 0 then AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); if (CheckGearDrowning(Gear)) then diff -r caba5291face -r 43e106417a05 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Tue Mar 26 17:34:29 2013 +0100 +++ b/hedgewars/uAIAmmoTests.pas Tue Mar 26 22:39:22 2013 +0200 @@ -197,6 +197,8 @@ x, y, dX, dY: real; t: LongInt; value: LongInt; + t2: real; + timer: Longint; begin mX:= hwFloat2Float(Me^.X); mY:= hwFloat2Float(Me^.Y); @@ -224,7 +226,25 @@ dec(t) until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (y > cWaterLine); - + + if TestCollWithLand(trunc(x), trunc(y), 5) then + begin + timer := 500; + t2 := 0.5 / sqrt(sqr(dX) + sqr(dY)); + dX := dX * t2; + dY := dY * t2; + repeat + x:= x + dX; + y:= y + dY; + dec(timer); + until (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 5) + or (x < 0) + or (y < 0) + or (trunc(x) > LAND_WIDTH) + or (trunc(y) > LAND_HEIGHT) + or not TestCollWithLand(trunc(x), trunc(y), 5) + or (timer = 0) + end; EX:= trunc(x); EY:= trunc(y); if Level = 1 then diff -r caba5291face -r 43e106417a05 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Tue Mar 26 17:34:29 2013 +0100 +++ b/hedgewars/uAIMisc.pas Tue Mar 26 22:39:22 2013 +0200 @@ -64,6 +64,7 @@ function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline; function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline; function TraceShoveFall(x, y, dX, dY: Real): LongInt; +function TestCollWithLand(x, y, r: LongInt): boolean; inline; function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline; function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;