hedgewars/uGearsUtils.pas
changeset 6986 409dd3851309
parent 6888 32a54322d262
child 6990 40e5af28d026
equal deleted inserted replaced
6985:caa41003f42c 6986:409dd3851309
    20 
    20 
    21 unit uGearsUtils;
    21 unit uGearsUtils;
    22 interface
    22 interface
    23 uses uTypes, math;
    23 uses uTypes, math;
    24 
    24 
    25 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord = $FFFFFFFF); 
    25 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline;
       
    26 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord); 
       
    27 
    26 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    28 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    27 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    29 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    28 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    30 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    29 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
    31 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
    30 procedure CheckHHDamage(Gear: PGear);
    32 procedure CheckHHDamage(Gear: PGear);
    31 procedure CalcRotationDirAngle(Gear: PGear);
    33 procedure CalcRotationDirAngle(Gear: PGear);
    32 procedure ResurrectHedgehog(gear: PGear);
    34 procedure ResurrectHedgehog(gear: PGear);
    33 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean = false);
    35 
       
    36 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline;
       
    37 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
       
    38 
    34 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
    39 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
    35 function  CheckGearDrowning(Gear: PGear): boolean;
    40 function  CheckGearDrowning(Gear: PGear): boolean;
    36 
    41 
    37 var doStepHandlers: array[TGearType] of TGearStepProcedure;
    42 var doStepHandlers: array[TGearType] of TGearStepProcedure;
    38 
    43 
    40 implementation
    45 implementation
    41 uses uFloat, uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
    46 uses uFloat, uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
    42     uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
    47     uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
    43     uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, uGears,
    48     uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, uGears,
    44     uGearsList;
    49     uGearsList;
       
    50 
       
    51 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline;
       
    52 begin
       
    53     doMakeExplosion(X, Y, Radius, AttackingHog, Mask, $FFFFFFFF);
       
    54 end;
    45 
    55 
    46 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
    56 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
    47 var Gear: PGear;
    57 var Gear: PGear;
    48     dmg, dmgBase: LongInt;
    58     dmg, dmgBase: LongInt;
    49     fX, fY, tdX, tdY: hwFloat;
    59     fX, fY, tdX, tdY: hwFloat;
   489     t:= t^.NextGear
   499     t:= t^.NextGear
   490     end;
   500     end;
   491 NoGearsToAvoid:= true
   501 NoGearsToAvoid:= true
   492 end;
   502 end;
   493 
   503 
       
   504 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline;
       
   505 begin
       
   506     FindPlace(Gear, withFall, Left, Right, false);
       
   507 end;
   494 
   508 
   495 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
   509 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
   496 var x: LongInt;
   510 var x: LongInt;
   497     y, sy: LongInt;
   511     y, sy: LongInt;
   498     ar: array[0..511] of TPoint;
   512     ar: array[0..511] of TPoint;