hedgewars/uGearsUtils.pas
changeset 10508 1a91c1fcba0d
parent 10506 325f7bb60580
child 10512 25021aac078e
equal deleted inserted replaced
10507:ed5df9cd251f 10508:1a91c1fcba0d
    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);
    28 
    29 
    29 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    30 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
    30 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    31 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    31 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    32 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
    32 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
    33 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
  1439             RightImpactTimer:= 333;
  1440             RightImpactTimer:= 333;
  1440             Gear^.dX.isNegative:= true;
  1441             Gear^.dX.isNegative:= true;
  1441             Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1442             Gear^.X:= int2hwfloat(rightX-Gear^.Radius)
  1442             end;
  1443             end;
  1443         if (Gear^.Radius > 2) and (Gear^.dX.QWordValue > _0_001.QWordValue) then
  1444         if (Gear^.Radius > 2) and (Gear^.dX.QWordValue > _0_001.QWordValue) then
  1444             PlaySound(sndMelonImpact)
  1445             AddBounceEffectForGear(Gear);
  1445         end{
  1446         end{
  1446     else if WorldEdge = weSea then
  1447     else if WorldEdge = weSea then
  1447         begin
  1448         begin
  1448         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1449         if (hwRound(Gear^.Y) > cWaterLine) and (Gear^.State and gstSubmersible <> 0) then
  1449             Gear^.State:= Gear^.State and (not gstSubmersible)
  1450             Gear^.State:= Gear^.State and (not gstSubmersible)
  1474 *)
  1475 *)
  1475     WorldWrap:= true
  1476     WorldWrap:= true
  1476     end;
  1477     end;
  1477 end;
  1478 end;
  1478 
  1479 
       
  1480 procedure AddBounceEffectForGear(Gear: PGear);
       
  1481 var boing: PVisualGear;
       
  1482 begin
       
  1483     boing:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot, 0, false, 1);
       
  1484     if boing <> nil then
       
  1485         with boing^ do
       
  1486             begin
       
  1487             Angle:= random(360);
       
  1488             dx:= 0;
       
  1489             dy:= 0;
       
  1490             FrameTicks:= 200;
       
  1491             Scale:= hwFloat2Float(Gear^.Density * hwAbs(Gear^.dY) + hwAbs(Gear^.dX)) / 1.5;
       
  1492             State:= ord(sprBoing)
       
  1493             end;
       
  1494     PlaySound(sndMelonImpact, true)
       
  1495 end;
       
  1496 
  1479 end.
  1497 end.