hedgewars/uAIMisc.pas
branchexperimental3D
changeset 4004 b1c2c2f6fc5e
parent 3894 9abce5468583
child 4357 a1fcfc341a52
equal deleted inserted replaced
3698:793386610068 4004:b1c2c2f6fc5e
    74 const KillScore = 200;
    74 const KillScore = 200;
    75 
    75 
    76 var friendlyfactor: LongInt = 300;
    76 var friendlyfactor: LongInt = 300;
    77     KnownExplosion: record
    77     KnownExplosion: record
    78                     X, Y, Radius: LongInt
    78                     X, Y, Radius: LongInt
    79                     end = (X: 0; Y: 0; Radius: 0); 
    79                     end = (X: 0; Y: 0; Radius: 0);
    80 
    80 
    81 procedure FillTargets;
    81 procedure FillTargets;
    82 var i, t: Longword;
    82 var i, t: Longword;
    83     f, e: Longword;
    83     f, e: Longword;
    84 begin
    84 begin
   193     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
   193     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
   194         begin
   194         begin
   195         MeX:= hwRound(Me^.X);
   195         MeX:= hwRound(Me^.X);
   196         MeY:= hwRound(Me^.Y);
   196         MeY:= hwRound(Me^.Y);
   197         // We are still inside the hog. Skip radius test
   197         // We are still inside the hog. Skip radius test
   198         if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and 
   198         if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and
   199            ((Land[y, x] and $FF00) = 0) then exit(false);
   199            ((Land[y, x] and $FF00) = 0) then exit(false);
   200         end;
   200         end;
   201     exit(TestColl(x, y, r))
   201     exit(TestColl(x, y, r))
   202 end;
   202 end;
   203 
   203 
   402       HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall
   402       HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall
   403       exit(bRes)
   403       exit(bRes)
   404       end;
   404       end;
   405    continue
   405    continue
   406    end;
   406    end;
   407    if (Gear^.Message and gm_Left  )<>0 then Gear^.dX:= -cLittle else
   407    if (Gear^.Message and gmLeft  )<>0 then Gear^.dX:= -cLittle else
   408    if (Gear^.Message and gm_Right )<>0 then Gear^.dX:=  cLittle else exit(bRes);
   408    if (Gear^.Message and gmRight )<>0 then Gear^.dX:=  cLittle else exit(bRes);
   409    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   409    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   410       begin
   410       begin
   411       if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
   411       if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
   412          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   412          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   413       if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))
   413       if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))