hedgewars/uAIMisc.pas
changeset 7716 95117607b81a
parent 7651 4cd85eebc54b
child 7719 eeae1cb6b6bf
equal deleted inserted replaced
7715:8b653edac2a2 7716:95117607b81a
    64 function  TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
    64 function  TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
    65 function  TraceShoveFall(x, y, dX, dY: Real): LongInt;
    65 function  TraceShoveFall(x, y, dX, dY: Real): LongInt;
    66 
    66 
    67 function  RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline;
    67 function  RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline;
    68 function  RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
    68 function  RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
    69 function  RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    69 function  RateShove(x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
    70 function  RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    70 function  RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
    71 function  RateHammer(Me: PGear): LongInt;
    71 function  RateHammer(Me: PGear): LongInt;
    72 
    72 
    73 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
    73 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
    74 function  AIrndSign(num: LongInt): LongInt;
    74 function  AIrndSign(num: LongInt): LongInt;
    86         ar: array[0..Pred(MAXBONUS div 8)] of TBonus;  // don't use too many
    86         ar: array[0..Pred(MAXBONUS div 8)] of TBonus;  // don't use too many
    87         end;
    87         end;
    88 
    88 
    89 const KillScore = 200;
    89 const KillScore = 200;
    90 var friendlyfactor: LongInt = 300;
    90 var friendlyfactor: LongInt = 300;
    91        
    91 
    92 implementation
    92 implementation
    93 uses uCollisions, uVariables, uUtils, uDebug, uLandTexture;
    93 uses uCollisions, uVariables, uUtils, uLandTexture;
    94 
    94 
    95 var 
    95 var 
    96     KnownExplosion: record
    96     KnownExplosion: record
    97         X, Y, Radius: LongInt
    97         X, Y, Radius: LongInt
    98         end = (X: 0; Y: 0; Radius: 0);
    98         end = (X: 0; Y: 0; Radius: 0);
   362             exit(-1);
   362             exit(-1);
   363     end;
   363     end;
   364 end;
   364 end;
   365 
   365 
   366 function TraceShoveFall(x, y, dX, dY: Real): LongInt;
   366 function TraceShoveFall(x, y, dX, dY: Real): LongInt;
   367 var dmg, v: LongInt;
   367 var dmg: LongInt;
   368 begin
   368 begin
   369 v:= random($FFFFFFFF);
   369 //v:= random($FFFFFFFF);
   370     while true do
   370     while true do
   371     begin
   371     begin
   372         x:= x + dX;
   372         x:= x + dX;
   373         y:= y + dY;
   373         y:= y + dY;
   374         dY:= dY + cGravityf;
   374         dY:= dY + cGravityf;
   455             end;
   455             end;
   456         end;
   456         end;
   457 RateExplosion:= rate;
   457 RateExplosion:= rate;
   458 end;
   458 end;
   459 
   459 
   460 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
   460 function RateShove(x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
   461 var i, fallDmg, dmg, rate: LongInt;
   461 var i, fallDmg, dmg, rate: LongInt;
   462     dX, dY, dmgMod: real;
   462     dX, dY, dmgMod: real;
   463 begin
   463 begin
   464 fallDmg:= 0;
   464 fallDmg:= 0;
   465 dX:= gdX * 0.01 * kick;
   465 dX:= gdX * 0.01 * kick;