diff -r 7ee319134713 -r bc7b1d228a2c hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Thu Aug 30 12:47:41 2012 -0400 +++ b/hedgewars/uAIMisc.pas Thu Aug 30 13:02:19 2012 -0400 @@ -86,12 +86,13 @@ ar: array[0..Pred(MAXBONUS div 8)] of TBonus; // don't use too many end; +const KillScore = 200; +var friendlyfactor: LongInt = 300; + implementation uses uCollisions, uVariables, uUtils, uDebug, uLandTexture; -const KillScore = 200; - -var friendlyfactor: LongInt = 300; +var KnownExplosion: record X, Y, Radius: LongInt end = (X: 0; Y: 0; Radius: 0); @@ -170,7 +171,7 @@ begin case Gear^.Kind of gtCase: - AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 33, 25); + AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y) + 3, 37, 25); gtFlame: if (Gear^.State and gsttmpFlag) <> 0 then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 20, -50); @@ -371,13 +372,13 @@ x:= x + dX; y:= y + dY; dY:= dY + cGravityf; -(* - if ((trunc(y) and LAND_HEIGHT_MASK) = 0) and ((trunc(x) and LAND_WIDTH_MASK) = 0) then + +{ if ((trunc(y) and LAND_HEIGHT_MASK) = 0) and ((trunc(x) and LAND_WIDTH_MASK) = 0) then begin LandPixels[trunc(y), trunc(x)]:= v; UpdateLandTexture(trunc(X), 1, trunc(Y), 1, true); - end; -*) + end;} + // consider adding dX/dY calc here for fall damage if TestCollExcludingObjects(trunc(x), trunc(y), cHHRadius) then @@ -439,21 +440,21 @@ end; if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI if Score > 0 then - inc(rate, KillScore + Score div 10) // Add a bit of a bonus for bigger hog drownings + inc(rate, (KillScore + Score div 10) * 1024) // Add a bit of a bonus for bigger hog drownings else - dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs + dec(rate, (KillScore * friendlyfactor div 100 - Score div 10) * 1024) // and more of a punishment for drowning bigger friendly hogs else if (dmg+fallDmg) >= abs(Score) then if Score > 0 then - inc(rate, KillScore) + inc(rate, KillScore * 1024 + (dmg + fallDmg)) // tiny bonus for dealing more damage than needed to kill else - dec(rate, KillScore * friendlyfactor div 100) + dec(rate, KillScore * friendlyfactor div 100 * 1024) else if Score > 0 then - inc(rate, dmg+fallDmg) - else dec(rate, (dmg+fallDmg) * friendlyfactor div 100) + inc(rate, (dmg + fallDmg) * 1024) + else dec(rate, (dmg + fallDmg) * friendlyfactor div 100 * 1024) end; end; -RateExplosion:= rate * 1024; +RateExplosion:= rate; end; function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt; @@ -624,6 +625,12 @@ end; repeat + {if ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) then + begin + LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= Gear^.Hedgehog^.Team^.Clan^.Color; + UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true); + end;} + if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(false); if (Gear^.State and gstMoving) <> 0 then @@ -645,7 +652,7 @@ Gear^.Y:= Gear^.Y + Gear^.dY; if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then begin - Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); + Gear^.State:= Gear^.State and (not (gstMoving or gstHHJumping)); Gear^.dY:= _0; case JumpType of jmpHJump: @@ -673,6 +680,7 @@ var pX, pY, tY: LongInt; begin HHGo:= false; +Gear^.CollisionMask:= $FF7F; AltGear^:= Gear^; GoInfo.Ticks:= 0; @@ -680,6 +688,12 @@ GoInfo.JumpType:= jmpNone; tY:= hwRound(Gear^.Y); repeat + {if ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) then + begin + LandPixels[hwRound(Gear^.Y), hwRound(Gear^.X)]:= random($FFFFFFFF);//Gear^.Hedgehog^.Team^.Clan^.Color; + UpdateLandTexture(hwRound(Gear^.X), 1, hwRound(Gear^.Y), 1, true); + end;} + pX:= hwRound(Gear^.X); pY:= hwRound(Gear^.Y); if pY + cHHRadius >= cWaterLine then @@ -696,7 +710,7 @@ Gear^.dY:= Gear^.dY + cGravity; if Gear^.dY > _0_4 then begin - Goinfo.FallPix:= 0; + GoInfo.FallPix:= 0; // try ljump instead of fall with damage HHJump(AltGear, jmpLJump, GoInfo); if AltGear^.Hedgehog^.BotLevel < 4 then @@ -709,7 +723,7 @@ if TestCollisionYwithGear(Gear, 1) <> 0 then begin inc(GoInfo.Ticks, 410); - Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); + Gear^.State:= Gear^.State and (not (gstMoving or gstHHJumping)); Gear^.dY:= _0; // try ljump instead of fall HHJump(AltGear, jmpLJump, GoInfo);