hedgewars/GSHandlers.inc
changeset 8952 a6ee1e7310fb
parent 8945 145bf64a9579
child 8958 3818b38d72c0
equal deleted inserted replaced
8951:95dd846caf5d 8952:a6ee1e7310fb
  1423         end
  1423         end
  1424     else if (GameTicks and $3F) = 25 then
  1424     else if (GameTicks and $3F) = 25 then
  1425         doStepFallingGear(Gear);
  1425         doStepFallingGear(Gear);
  1426     if (Gear^.Health = 0) then
  1426     if (Gear^.Health = 0) then
  1427         begin
  1427         begin
  1428         if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1428         if (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1429             inc(Gear^.Damage, hwRound(Gear^.dY * _70))
  1429             inc(Gear^.Damage, hwRound(Gear^.dY * _70))
  1430         else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
  1430         else if (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
  1431             inc(Gear^.Damage, hwRound(Gear^.dX * _70))
  1431             inc(Gear^.Damage, hwRound(Gear^.dX * _70))
  1432         else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
  1432         else if  (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
  1433             inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
  1433             inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
  1434         else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
  1434         else if (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
  1435             inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
  1435             inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
  1436 
  1436 
  1437         if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then
  1437         if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then
  1438             begin
  1438             begin
  1439             vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
  1439             vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
  1583     if ((Gear^.dX.QWordValue <> 0)
  1583     if ((Gear^.dX.QWordValue <> 0)
  1584     or (Gear^.dY.QWordValue <> 0))  then
  1584     or (Gear^.dY.QWordValue <> 0))  then
  1585         begin
  1585         begin
  1586         DeleteCI(Gear);
  1586         DeleteCI(Gear);
  1587         AllInactive := false;
  1587         AllInactive := false;
  1588         if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1588         if (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1589             begin
  1589             begin
  1590             Gear^.State := Gear^.State or gsttmpFlag;
  1590             Gear^.State := Gear^.State or gsttmpFlag;
  1591             inc(Gear^.Damage, hwRound(Gear^.dY * _70));
  1591             inc(Gear^.Damage, hwRound(Gear^.dY * _70));
  1592             for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do
  1592             for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do
  1593                 begin
  1593                 begin
  1594                 particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust);
  1594                 particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust);
  1595                 if particle <> nil then
  1595                 if particle <> nil then
  1596                     particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
  1596                     particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
  1597                 end
  1597                 end
  1598             end
  1598             end
  1599         else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
  1599         else if (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
  1600                 inc(Gear^.Damage, hwRound(Gear^.dX * _70))
  1600                 inc(Gear^.Damage, hwRound(Gear^.dX * _70))
  1601 
  1601 
  1602         else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
  1602         else if (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then
  1603                 inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
  1603                 inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
  1604 
  1604 
  1605         else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
  1605         else if (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
  1606                 inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
  1606                 inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
  1607 
  1607 
  1608         doStepFallingGear(Gear);
  1608         doStepFallingGear(Gear);
  1609         CalcRotationDirAngle(Gear);
  1609         CalcRotationDirAngle(Gear);
  1610         //CheckGearDrowning(Gear)
  1610         //CheckGearDrowning(Gear)