55 procedure doStepPickHammerWork(Gear: PGear); |
55 procedure doStepPickHammerWork(Gear: PGear); |
56 procedure doStepPickHammer(Gear: PGear); |
56 procedure doStepPickHammer(Gear: PGear); |
57 procedure doStepBlowTorchWork(Gear: PGear); |
57 procedure doStepBlowTorchWork(Gear: PGear); |
58 procedure doStepBlowTorch(Gear: PGear); |
58 procedure doStepBlowTorch(Gear: PGear); |
59 procedure doStepMine(Gear: PGear); |
59 procedure doStepMine(Gear: PGear); |
|
60 procedure doStepAirMine(Gear: PGear); |
60 procedure doStepSMine(Gear: PGear); |
61 procedure doStepSMine(Gear: PGear); |
61 procedure doStepDynamite(Gear: PGear); |
62 procedure doStepDynamite(Gear: PGear); |
62 procedure doStepRollingBarrel(Gear: PGear); |
63 procedure doStepRollingBarrel(Gear: PGear); |
63 procedure doStepCase(Gear: PGear); |
64 procedure doStepCase(Gear: PGear); |
64 procedure doStepTarget(Gear: PGear); |
65 procedure doStepTarget(Gear: PGear); |
1744 end |
1747 end |
1745 else // gsttmpFlag = 0 |
1748 else // gsttmpFlag = 0 |
1746 if (TurnTimeLeft = 0) |
1749 if (TurnTimeLeft = 0) |
1747 or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
1750 or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
1748 or (Gear^.Hedgehog^.Gear = nil) then |
1751 or (Gear^.Hedgehog^.Gear = nil) then |
|
1752 Gear^.State := Gear^.State or gsttmpFlag; |
|
1753 end; |
|
1754 |
|
1755 (* |
|
1756 Just keeping track for my own benefit. |
|
1757 Every second, locate new target. Clear if target radius has been set to 0 or no target in range. |
|
1758 Every... 16 milliseconds? Update vector to target. |
|
1759 *) |
|
1760 |
|
1761 procedure doStepAirMine(Gear: PGear); |
|
1762 var i,t,targDist,tmpDist: LongWord; |
|
1763 targ, tmpG: PGear; |
|
1764 trackSpeed, tX, tY: hwFloat; |
|
1765 begin |
|
1766 if Gear^.dX.QWordValue > Gear^.Pos then |
|
1767 dec(Gear^.dX.QWordValue,Gear^.Pos) |
|
1768 else Gear^.dX:= _0; |
|
1769 if Gear^.dY.QWordValue > Gear^.Pos then |
|
1770 dec(Gear^.dY.QWordValue,Gear^.Pos) |
|
1771 else Gear^.dY:= _0; |
|
1772 doStepFallingGear(Gear); |
|
1773 if (Gear^.Angle = 0) or (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.Gear = nil) then |
|
1774 begin |
|
1775 Gear^.Hedgehog:= nil; |
|
1776 targ:= nil; |
|
1777 end |
|
1778 else if Gear^.Hedgehog <> nil then |
|
1779 targ:= Gear^.Hedgehog^.Gear; |
|
1780 // todo, allow not finding new target, set timeout on target retention |
|
1781 if (Gear^.State and gsttmpFlag <> 0) and (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) then // recheck hunted hog |
|
1782 begin |
|
1783 if targ <> nil then |
|
1784 targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
|
1785 else targDist:= 0; |
|
1786 for t:= 0 to Pred(TeamsCount) do |
|
1787 with TeamsArray[t]^ do |
|
1788 for i:= 0 to cMaxHHIndex do |
|
1789 if Hedgehogs[i].Gear <> nil then |
|
1790 begin |
|
1791 tmpG:= Hedgehogs[i].Gear; |
|
1792 tX:=Gear^.X-tmpG^.X; |
|
1793 tY:=Gear^.Y-tmpG^.Y; |
|
1794 if (Gear^.Angle = $FFFFFFFF) or |
|
1795 ((tX.Round+tY.Round < Gear^.Angle) and |
|
1796 (hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle))) then |
|
1797 begin |
|
1798 if targ <> nil then tmpDist:= Distance(tX,tY).Round; |
|
1799 if (targ = nil) or (tmpDist < targDist) then |
|
1800 begin |
|
1801 if targ = nil then targDist:= Distance(tX,tY).Round |
|
1802 else targDist:= tmpDist; |
|
1803 Gear^.Hedgehog:= @Hedgehogs[i]; |
|
1804 targ:= tmpG; |
|
1805 end |
|
1806 end |
|
1807 end |
|
1808 end; |
|
1809 if targ <> nil then |
|
1810 begin |
|
1811 trackSpeed.QWordValue:= Gear^.Power; |
|
1812 if (Gear^.X < targ^.X) and (Gear^.dX < _0_1) then |
|
1813 Gear^.dX:= Gear^.dX+trackSpeed |
|
1814 else if (Gear^.X > targ^.X) and (Gear^.dX > -_0_1) then |
|
1815 Gear^.dX:= Gear^.dX-trackSpeed; |
|
1816 if (Gear^.Y < targ^.Y) and (Gear^.dY < _0_1) then |
|
1817 Gear^.dY:= Gear^.dY+trackSpeed |
|
1818 else if (Gear^.Y > targ^.Y) and (Gear^.dY > -_0_1) then |
|
1819 Gear^.dY:= Gear^.dY-trackSpeed; |
|
1820 end; |
|
1821 |
|
1822 if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
|
1823 if ((Gear^.State and gstAttacking) = 0) then |
|
1824 begin |
|
1825 if ((GameTicks and $1F) = 0) then |
|
1826 if targ <> nil then |
|
1827 begin |
|
1828 tX:=Gear^.X-targ^.X; |
|
1829 tY:=Gear^.Y-targ^.Y; |
|
1830 if (tX.Round+tY.Round < Gear^.Karma) and |
|
1831 (hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Karma)) then |
|
1832 Gear^.State := Gear^.State or gstAttacking |
|
1833 end |
|
1834 else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Karma, Gear^.Karma) <> nil) then |
|
1835 Gear^.State := Gear^.State or gstAttacking |
|
1836 end |
|
1837 else // gstAttacking <> 0 |
|
1838 begin |
|
1839 AllInactive := false; |
|
1840 if (Gear^.Timer and $FF) = 0 then |
|
1841 PlaySound(sndMineTick); |
|
1842 if Gear^.Timer = 0 then |
|
1843 begin |
|
1844 Gear^.Hedgehog:= CurrentHedgehog; |
|
1845 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
|
1846 DeleteGear(Gear); |
|
1847 exit |
|
1848 end; |
|
1849 dec(Gear^.Timer); |
|
1850 end |
|
1851 else // gsttmpFlag = 0 |
|
1852 if (TurnTimeLeft = 0) |
|
1853 or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
|
1854 or (CurrentHedgehog^.Gear = nil) then |
1749 Gear^.State := Gear^.State or gsttmpFlag; |
1855 Gear^.State := Gear^.State or gsttmpFlag; |
1750 end; |
1856 end; |
1751 |
1857 |
1752 //////////////////////////////////////////////////////////////////////////////// |
1858 //////////////////////////////////////////////////////////////////////////////// |
1753 procedure doStepSMine(Gear: PGear); |
1859 procedure doStepSMine(Gear: PGear); |