--- a/hedgewars/GSHandlers.inc Mon Feb 12 21:57:29 2007 +0000
+++ b/hedgewars/GSHandlers.inc Tue Feb 13 18:16:03 2007 +0000
@@ -806,7 +806,7 @@
Gear^.dY:= Gear^.dY + cGravity;
Gear^.Y:= Gear^.Y + Gear^.dY;
if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= 0 else
- if (Gear^.dY.QWordValue <> 0) and TestCollisionYwithGear(Gear, 1) then
+ if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
begin
Gear^.dY:= - Gear^.dY * Gear^.Elasticity;
if Gear^.dY > - _0_001 then Gear^.dY:= 0
--- a/hedgewars/uAI.pas Mon Feb 12 21:57:29 2007 +0000
+++ b/hedgewars/uAI.pas Tue Feb 13 18:16:03 2007 +0000
@@ -79,7 +79,7 @@
else if (Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
begin
- Angle:= integer(Me^.Angle) - Abs(Angle);
+ Angle:= LongInt(Me^.Angle) - Abs(Angle);
if Angle > 0 then
begin
AddAction(BestActions, aia_Up, aim_push, 500, 0, 0);
@@ -269,7 +269,8 @@
procedure StartThink(Me: PGear);
var a: TAmmoType;
begin
-if ((Me^.State and gstAttacking) <> 0) or isInMultiShoot then exit;
+if ((Me^.State and (gstAttacking or gstHHJumping or gstFalling or gstMoving)) <> 0)
+ or isInMultiShoot then exit;
Me^.State:= Me^.State or gstHHThinking;
Me^.Message:= 0;
StopThinking:= false;
--- a/hedgewars/uAIAmmoTests.pas Mon Feb 12 21:57:29 2007 +0000
+++ b/hedgewars/uAIAmmoTests.pas Tue Feb 13 18:16:03 2007 +0000
@@ -50,7 +50,7 @@
{amGirder} nil
);
-const BadTurn = Low(LongInt);
+const BadTurn = Low(LongInt) div 4;
implementation
@@ -106,7 +106,7 @@
Score:= CheckTrace;
if Result <= Score then
begin
- Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 11));
+ Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
Power:= hwRound(r * cMaxPower) - random((Level - 1) * 17 + 1);
ExplR:= 100;
ExplX:= EX;
@@ -167,7 +167,7 @@
Result:= Score
end;
end
-until (TestTime = 5000);
+until (TestTime = 4000);
TestGrenade:= Result
end;
@@ -176,13 +176,10 @@
rx, ry, Result: LongInt;
begin
ExplR:= 0;
-if Metric(hwRound(Me^.X), hwRound(Me^.Y), Targ.X, Targ.Y) < 80 then
- begin
- Result:= BadTurn;
- exit
- end;
Time:= 0;
Power:= 1;
+if Metric(hwRound(Me^.X), hwRound(Me^.Y), Targ.X, Targ.Y) < 80 then
+ exit(BadTurn);
Vx:= (Targ.X - Me^.X) * _1div1024;
Vy:= (Targ.Y - Me^.Y) * _1div1024;
x:= Me^.X;
@@ -210,13 +207,10 @@
Result: LongInt;
begin
ExplR:= 0;
-if hwAbs(Me^.X - Targ.X) + hwAbs(Me^.Y - Targ.Y) < 80 then
- begin
- Result:= BadTurn;
- exit
- end;
Time:= 0;
Power:= 1;
+if hwAbs(Me^.X - Targ.X) + hwAbs(Me^.Y - Targ.Y) < 80 then
+ exit(BadTurn);
t:= _0_5 / Distance(Targ.X - Me^.X, Targ.Y - Me^.Y);
Vx:= (Targ.X - Me^.X) * t;
Vy:= (Targ.Y - Me^.Y) * t;