hedgewars/uAIMisc.pas
changeset 10354 56bd029245fc
parent 10164 0570d4b22187
child 10510 9329dab04490
equal deleted inserted replaced
10352:2af2309207b0 10354:56bd029245fc
   443                         exit(dmg)
   443                         exit(dmg)
   444                         end
   444                         end
   445                     end;
   445                     end;
   446             exit(0)
   446             exit(0)
   447             end;
   447             end;
   448         if (y > cWaterLine) or (x > rightX) or (x < leftX) then exit(-1)
   448         if CheckCoordInWater(round(x), round(y)) then exit(-1)
   449         end
   449         end
   450 end;
   450 end;
   451 
   451 
   452 function TraceShoveFall(var x, y: Real; dX, dY: Real; Target: TTarget): LongInt;
   452 function TraceShoveFall(var x, y: Real; dX, dY: Real; Target: TTarget): LongInt;
   453 var dmg: LongInt;
   453 var dmg: LongInt;
   495                         exit(dmg)
   495                         exit(dmg)
   496                         end
   496                         end
   497                     end;
   497                     end;
   498             exit(0)
   498             exit(0)
   499         end;
   499         end;
   500         if (y > cWaterLine) or (x > rightX) or (x < leftX) then
   500         if CheckCoordInWater(round(x), round(y)) then
   501             // returning -1 for drowning so it can be considered in the Rate routine
   501             // returning -1 for drowning so it can be considered in the Rate routine
   502             exit(-1)
   502             exit(-1)
   503     end;
   503     end;
   504 end;
   504 end;
   505 
   505 
   874             begin
   874             begin
   875             LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= Gear^.Hedgehog^.Team^.Clan^.Color;
   875             LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= Gear^.Hedgehog^.Team^.Clan^.Color;
   876             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
   876             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
   877             end;}
   877             end;}
   878 
   878 
   879     if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then
   879     if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius) then
   880         exit(false);
   880         exit(false);
   881     if (Gear^.State and gstMoving) <> 0 then
   881     if (Gear^.State and gstMoving) <> 0 then
   882     begin
   882     begin
   883         if (GoInfo.Ticks = 350) then
   883         if (GoInfo.Ticks = 350) then
   884             if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   884             if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   939             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
   939             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
   940             end;}
   940             end;}
   941 
   941 
   942     pX:= hwRound(Gear^.X);
   942     pX:= hwRound(Gear^.X);
   943     pY:= hwRound(Gear^.Y);
   943     pY:= hwRound(Gear^.Y);
   944     if pY + cHHRadius >= cWaterLine then
   944     if CheckCoordInWater(pX, pY + cHHRadius) then
   945         begin
   945         begin
   946         if AltGear^.Hedgehog^.BotLevel < 4 then
   946         if AltGear^.Hedgehog^.BotLevel < 4 then
   947             AddWalkBonus(pX, tY, 250, -40);
   947             AddWalkBonus(pX, tY, 250, -40);
   948         exit(false)
   948         exit(false)
   949         end;
   949         end;