hedgewars/uGearsUtils.pas
changeset 13609 13f68f3e7153
parent 13604 73b096e1d895
child 13617 a6abc2c1fc1a
equal deleted inserted replaced
13608:92b87845beeb 13609:13f68f3e7153
    23 uses uTypes, uFloat;
    23 uses uTypes, uFloat;
    24 
    24 
    25 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline;
    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);
    26 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
    27 procedure AddSplashForGear(Gear: PGear; justSkipping: boolean);
    27 procedure AddSplashForGear(Gear: PGear; justSkipping: boolean);
       
    28 procedure AddBounceEffectForGear(Gear: PGear; imageScale: Single);
    28 procedure AddBounceEffectForGear(Gear: PGear);
    29 procedure AddBounceEffectForGear(Gear: PGear);
    29 
    30 
    30 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    31 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    31 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    32 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    32 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    33 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
  1721 *)
  1722 *)
  1722     WorldWrap:= true
  1723     WorldWrap:= true
  1723     end;
  1724     end;
  1724 end;
  1725 end;
  1725 
  1726 
       
  1727 
       
  1728 // Add an audiovisual bounce effect for gear after it bounced from bouncy material.
       
  1729 // Graphical effect is based on speed.
  1726 procedure AddBounceEffectForGear(Gear: PGear);
  1730 procedure AddBounceEffectForGear(Gear: PGear);
       
  1731 begin
       
  1732     AddBounceEffectForGear(Gear, hwFloat2Float(Gear^.Density * hwAbs(Gear^.dY) + hwAbs(Gear^.dX)) / 1.5);
       
  1733 end;
       
  1734 
       
  1735 // Same as above, but can specify the size of bounce image with imageScale manually.
       
  1736 procedure AddBounceEffectForGear(Gear: PGear; imageScale: Single);
  1727 var boing: PVisualGear;
  1737 var boing: PVisualGear;
  1728 begin
  1738 begin
  1729     if Gear^.Density < _0_01 then
  1739     if Gear^.Density < _0_01 then
  1730         exit;
  1740         exit;
  1731     boing:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot, 0, false, 1);
  1741     boing:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot, 0, false, 1);
  1734             begin
  1744             begin
  1735             Angle:= random(360);
  1745             Angle:= random(360);
  1736             dx:= 0;
  1746             dx:= 0;
  1737             dy:= 0;
  1747             dy:= 0;
  1738             FrameTicks:= 200;
  1748             FrameTicks:= 200;
  1739             Scale:= hwFloat2Float(Gear^.Density * hwAbs(Gear^.dY) + hwAbs(Gear^.dX)) / 1.5;
  1749             Scale:= imageScale;
  1740             State:= ord(sprBoing)
  1750             State:= ord(sprBoing)
  1741             end;
  1751             end;
  1742     if Gear^.Kind = gtDuck then
  1752     if Gear^.Kind = gtDuck then
  1743         PlaySound(sndDuckDrop, true)
  1753         PlaySound(sndDuckDrop, true)
  1744     else
  1754     else