hedgewars/uAIMisc.pas
changeset 7437 a46ce1812419
parent 7432 6dc7ccc0b043
parent 7435 bf80e66d6131
child 7471 ce5d3e39361e
equal deleted inserted replaced
7432:6dc7ccc0b043 7437:a46ce1812419
   168 Gear:= GearsList;
   168 Gear:= GearsList;
   169 while Gear <> nil do
   169 while Gear <> nil do
   170     begin
   170     begin
   171         case Gear^.Kind of
   171         case Gear^.Kind of
   172             gtCase:
   172             gtCase:
   173             AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 33, 25);
   173                 AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y) + 3, 37, 25);
   174             gtFlame:
   174             gtFlame:
   175                 if (Gear^.State and gsttmpFlag) <> 0 then
   175                 if (Gear^.State and gsttmpFlag) <> 0 then
   176                     AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 20, -50);
   176                     AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 20, -50);
   177 // avoid mines unless they are very likely to be duds, or are duds. also avoid if they are about to blow 
   177 // avoid mines unless they are very likely to be duds, or are duds. also avoid if they are about to blow 
   178             gtMine:
   178             gtMine:
   369     while true do
   369     while true do
   370     begin
   370     begin
   371         x:= x + dX;
   371         x:= x + dX;
   372         y:= y + dY;
   372         y:= y + dY;
   373         dY:= dY + cGravityf;
   373         dY:= dY + cGravityf;
   374 (*
   374 
   375         if ((trunc(y) and LAND_HEIGHT_MASK) = 0) and ((trunc(x) and LAND_WIDTH_MASK) = 0) then 
   375 {        if ((trunc(y) and LAND_HEIGHT_MASK) = 0) and ((trunc(x) and LAND_WIDTH_MASK) = 0) then 
   376             begin
   376             begin
   377             LandPixels[trunc(y), trunc(x)]:= v;
   377             LandPixels[trunc(y), trunc(x)]:= v;
   378             UpdateLandTexture(trunc(X), 1, trunc(Y), 1, true);
   378             UpdateLandTexture(trunc(X), 1, trunc(Y), 1, true);
   379             end;
   379             end;}
   380 *)
   380 
   381 
   381 
   382         // consider adding dX/dY calc here for fall damage
   382         // consider adding dX/dY calc here for fall damage
   383         if TestCollExcludingObjects(trunc(x), trunc(y), cHHRadius) then
   383         if TestCollExcludingObjects(trunc(x), trunc(y), cHHRadius) then
   384         begin
   384         begin
   385             if 0.4 < dY then
   385             if 0.4 < dY then
   622             exit(false)
   622             exit(false)
   623         end
   623         end
   624 end;
   624 end;
   625 
   625 
   626 repeat
   626 repeat
       
   627         {if ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) then 
       
   628             begin
       
   629             LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= Gear^.Hedgehog^.Team^.Clan^.Color;
       
   630             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
       
   631             end;}
       
   632             
   627     if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then
   633     if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then
   628         exit(false);
   634         exit(false);
   629     if (Gear^.State and gstMoving) <> 0 then
   635     if (Gear^.State and gstMoving) <> 0 then
   630     begin
   636     begin
   631         if (GoInfo.Ticks = 350) then
   637         if (GoInfo.Ticks = 350) then
   671 
   677 
   672 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
   678 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
   673 var pX, pY, tY: LongInt;
   679 var pX, pY, tY: LongInt;
   674 begin
   680 begin
   675 HHGo:= false;
   681 HHGo:= false;
       
   682 Gear^.CollisionMask:= $FF7F;
   676 AltGear^:= Gear^;
   683 AltGear^:= Gear^;
   677 
   684 
   678 GoInfo.Ticks:= 0;
   685 GoInfo.Ticks:= 0;
   679 GoInfo.FallPix:= 0;
   686 GoInfo.FallPix:= 0;
   680 GoInfo.JumpType:= jmpNone;
   687 GoInfo.JumpType:= jmpNone;
   681 tY:= hwRound(Gear^.Y);
   688 tY:= hwRound(Gear^.Y);
   682 repeat
   689 repeat
       
   690         {if ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) then 
       
   691             begin
       
   692             LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= random($FFFFFFFF);//Gear^.Hedgehog^.Team^.Clan^.Color;
       
   693             UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true);
       
   694             end;}
       
   695 
   683     pX:= hwRound(Gear^.X);
   696     pX:= hwRound(Gear^.X);
   684     pY:= hwRound(Gear^.Y);
   697     pY:= hwRound(Gear^.Y);
   685     if pY + cHHRadius >= cWaterLine then
   698     if pY + cHHRadius >= cWaterLine then
   686         begin
   699         begin
   687         if AltGear^.Hedgehog^.BotLevel < 4 then
   700         if AltGear^.Hedgehog^.BotLevel < 4 then
   694         begin
   707         begin
   695         inc(GoInfo.Ticks);
   708         inc(GoInfo.Ticks);
   696         Gear^.dY:= Gear^.dY + cGravity;
   709         Gear^.dY:= Gear^.dY + cGravity;
   697         if Gear^.dY > _0_4 then
   710         if Gear^.dY > _0_4 then
   698             begin
   711             begin
   699             Goinfo.FallPix:= 0;
   712             GoInfo.FallPix:= 0;
   700             // try ljump instead of fall with damage
   713             // try ljump instead of fall with damage
   701             HHJump(AltGear, jmpLJump, GoInfo); 
   714             HHJump(AltGear, jmpLJump, GoInfo); 
   702             if AltGear^.Hedgehog^.BotLevel < 4 then
   715             if AltGear^.Hedgehog^.BotLevel < 4 then
   703                 AddWalkBonus(pX, tY, 175, -20);
   716                 AddWalkBonus(pX, tY, 175, -20);
   704             exit(false)
   717             exit(false)