1759 *) |
1759 *) |
1760 |
1760 |
1761 procedure doStepAirMine(Gear: PGear); |
1761 procedure doStepAirMine(Gear: PGear); |
1762 var i,t,targDist,tmpDist: LongWord; |
1762 var i,t,targDist,tmpDist: LongWord; |
1763 targ, tmpG: PGear; |
1763 targ, tmpG: PGear; |
1764 trackSpeed, tX, tY: hwFloat; |
1764 trackSpeed, airFriction, tX, tY: hwFloat; |
1765 begin |
1765 begin |
1766 if Gear^.dX.QWordValue > Gear^.Pos then |
1766 if Gear^.Pos > 0 then |
1767 dec(Gear^.dX.QWordValue,Gear^.Pos) |
1767 begin |
1768 else Gear^.dX:= _0; |
1768 airFriction:= _1; |
1769 if Gear^.dY.QWordValue > Gear^.Pos then |
1769 dec(airFriction.QWordValue,Gear^.Pos); |
1770 dec(Gear^.dY.QWordValue,Gear^.Pos) |
1770 Gear^.dX:= Gear^.dX*airFriction; |
1771 else Gear^.dY:= _0; |
1771 Gear^.dY:= Gear^.dY*airFriction |
|
1772 end; |
1772 doStepFallingGear(Gear); |
1773 doStepFallingGear(Gear); |
1773 if (Gear^.Angle = 0) or (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.Gear = nil) then |
1774 if (Gear^.Angle = 0) or (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.Gear = nil) then |
1774 begin |
1775 begin |
1775 Gear^.Hedgehog:= nil; |
1776 Gear^.Hedgehog:= nil; |
1776 targ:= nil; |
1777 targ:= nil; |
1777 end |
1778 end |
1778 else if Gear^.Hedgehog <> nil then |
1779 else if Gear^.Hedgehog <> nil then |
1779 targ:= Gear^.Hedgehog^.Gear; |
1780 targ:= Gear^.Hedgehog^.Gear; |
|
1781 if targ <> nil then |
|
1782 begin |
|
1783 tX:=Gear^.X-targ^.X; |
|
1784 tY:=Gear^.Y-targ^.Y; |
|
1785 // allow escaping - should maybe flag this too |
|
1786 if ((tX.Round+tY.Round > Gear^.Angle*4) and |
|
1787 (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*4))) then |
|
1788 targ:= nil |
|
1789 end; |
|
1790 |
1780 // todo, allow not finding new target, set timeout on target retention |
1791 // todo, allow not finding new target, set timeout on target retention |
1781 if (Gear^.State and (gsttmpFlag or gstAttacking) = gsttmpFlag) and |
1792 if (Gear^.State and (gsttmpFlag or gstAttacking) = gsttmpFlag) and |
1782 (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and |
1793 (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and |
1783 (GameTicks > Gear^.FlightTime) then // recheck hunted hog |
1794 (GameTicks > Gear^.FlightTime) then // recheck hunted hog |
1784 begin |
1795 begin |
1819 Gear^.dX:= Gear^.dX-trackSpeed; |
1830 Gear^.dX:= Gear^.dX-trackSpeed; |
1820 if (Gear^.Y < targ^.Y) and (Gear^.dY < _0_1) then |
1831 if (Gear^.Y < targ^.Y) and (Gear^.dY < _0_1) then |
1821 Gear^.dY:= Gear^.dY+trackSpeed |
1832 Gear^.dY:= Gear^.dY+trackSpeed |
1822 else if (Gear^.Y > targ^.Y) and (Gear^.dY > -_0_1) then |
1833 else if (Gear^.Y > targ^.Y) and (Gear^.dY > -_0_1) then |
1823 Gear^.dY:= Gear^.dY-trackSpeed; |
1834 Gear^.dY:= Gear^.dY-trackSpeed; |
1824 end; |
1835 end |
|
1836 else Gear^.Hedgehog:= nil; |
1825 |
1837 |
1826 if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
1838 if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
1827 begin |
1839 begin |
1828 if ((Gear^.State and gstAttacking) = 0) then |
1840 if ((Gear^.State and gstAttacking) = 0) then |
1829 begin |
1841 begin |