hedgewars/GSHandlers.inc
changeset 4966 fa612a614317
parent 4956 48e1f9a04c28
child 4969 ffc9ac920985
equal deleted inserted replaced
4964:b3fa88210570 4966:fa612a614317
  1690         AllInactive := false
  1690         AllInactive := false
  1691     end
  1691     end
  1692     else
  1692     else
  1693         if ((GameTicks and $3F) = 25) then
  1693         if ((GameTicks and $3F) = 25) then
  1694             doStepFallingGear(Gear);
  1694             doStepFallingGear(Gear);
       
  1695     if (Gear^.Health = 0) then
       
  1696         begin
       
  1697             if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and TestCollisionYwithGear(Gear, 1) then
       
  1698                 inc(Gear^.Damage, hwRound(Gear^.dY * _70))
       
  1699             else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
       
  1700                  inc(Gear^.Damage, hwRound(Gear^.dX * _70))
       
  1701             else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and TestCollisionYwithGear(Gear, -1) then
       
  1702                  inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
       
  1703             else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
       
  1704                  inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
       
  1705         
       
  1706         if (Gear^.Damage > random(10)) and ((GameTicks and $FF) = 0) then
       
  1707             AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y), vgtSmoke);
       
  1708 
       
  1709         if (Gear^.Damage > 35) then
       
  1710             begin
       
  1711             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
       
  1712             DeleteGear(Gear);
       
  1713             exit
       
  1714             end
       
  1715         end;
  1695 
  1716 
  1696     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1717     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1697         if ((Gear^.State and gstAttacking) = 0) then
  1718         if ((Gear^.State and gstAttacking) = 0) then
  1698             begin
  1719             begin
  1699             if ((GameTicks and $1F) = 0) then
  1720             if ((GameTicks and $1F) = 0) then
  1717                     begin
  1738                     begin
  1718                     AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4),
  1739                     AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4),
  1719                     vgtSmoke);
  1740                     vgtSmoke);
  1720                     PlaySound(sndVaporize);
  1741                     PlaySound(sndVaporize);
  1721                     Gear^.Health := 0;
  1742                     Gear^.Health := 0;
       
  1743                     Gear^.Damage := 0;
       
  1744 AddFileLog('initial mine damage:'+IntToStr(Gear^.Damage));
  1722                     end;
  1745                     end;
  1723                 exit
  1746                 exit
  1724                 end;
  1747                 end;
  1725             dec(Gear^.Timer);
  1748             dec(Gear^.Timer);
  1726             end
  1749             end