hedgewars/uAIAmmoTests.pas
changeset 1753 2ccba26f1aa4
parent 1689 3d0eee01f734
child 1849 2a989e5abda6
equal deleted inserted replaced
1752:769986d39202 1753:2ccba26f1aa4
   332 ap.Angle:= DxDy2AttackAngle(Vx, -Vy);
   332 ap.Angle:= DxDy2AttackAngle(Vx, -Vy);
   333 d:= 0;
   333 d:= 0;
   334 repeat
   334 repeat
   335   x:= x + vX;
   335   x:= x + vX;
   336   y:= y + vY;
   336   y:= y + vY;
   337   if ((hwRound(x) and $FFFFF800) = 0)and((hwRound(y) and $FFFFFC00) = 0)
   337   if ((hwRound(x) and LAND_WIDTH_MASK) = 0)and((hwRound(y) and LAND_HEIGHT_MASK) = 0)
   338      and (Land[hwRound(y), hwRound(x)] <> 0) then inc(d);
   338      and (Land[hwRound(y), hwRound(x)] <> 0) then inc(d);
   339 until (Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 4) or (x < _0) or (y < _0) or (x > _2048) or (y > _1024) or (d > 200);
   339 until (Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 4) or (x < _0) or (y < _0) or (x > _2048) or (y > _1024) or (d > 200);
   340 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then Result:= max(0, (4 - d div 50) * 7 * 1024)
   340 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then Result:= max(0, (4 - d div 50) * 7 * 1024)
   341                                                            else Result:= BadTurn;
   341                                                            else Result:= BadTurn;
   342 TestDesertEagle:= Result
   342 TestDesertEagle:= Result