1776 targ:= nil; |
1776 targ:= nil; |
1777 end |
1777 end |
1778 else if Gear^.Hedgehog <> nil then |
1778 else if Gear^.Hedgehog <> nil then |
1779 targ:= Gear^.Hedgehog^.Gear; |
1779 targ:= Gear^.Hedgehog^.Gear; |
1780 // todo, allow not finding new target, set timeout on target retention |
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 |
1781 if (Gear^.State and (gsttmpFlag or gstAttacking) = gsttmpFlag) and |
|
1782 (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and |
|
1783 (GameTicks > Gear^.FlightTime) then // recheck hunted hog |
1782 begin |
1784 begin |
1783 if targ <> nil then |
1785 if targ <> nil then |
1784 targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
1786 targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
1785 else targDist:= 0; |
1787 else targDist:= 0; |
1786 for t:= 0 to Pred(TeamsCount) do |
1788 for t:= 0 to Pred(TeamsCount) do |
1839 AllInactive := false; |
1842 AllInactive := false; |
1840 if (Gear^.Timer and $FF) = 0 then |
1843 if (Gear^.Timer and $FF) = 0 then |
1841 PlaySound(sndMineTick); |
1844 PlaySound(sndMineTick); |
1842 if Gear^.Timer = 0 then |
1845 if Gear^.Timer = 0 then |
1843 begin |
1846 begin |
1844 Gear^.Hedgehog:= CurrentHedgehog; |
1847 // recheck |
1845 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
1848 if targ <> nil then |
1846 DeleteGear(Gear); |
1849 begin |
1847 exit |
1850 tX:=Gear^.X-targ^.X; |
|
1851 tY:=Gear^.Y-targ^.Y; |
|
1852 if (tX.Round+tY.Round < Gear^.Karma) and |
|
1853 (hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Karma)) then |
|
1854 begin |
|
1855 Gear^.Hedgehog:= CurrentHedgehog; |
|
1856 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
|
1857 DeleteGear(Gear); |
|
1858 exit |
|
1859 end |
|
1860 end |
|
1861 else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Karma, Gear^.Karma) <> nil) then |
|
1862 begin |
|
1863 Gear^.Hedgehog:= CurrentHedgehog; |
|
1864 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
|
1865 DeleteGear(Gear); |
|
1866 exit |
|
1867 end; |
|
1868 Gear^.State:= Gear^.State and not gstAttacking; |
|
1869 Gear^.Timer:= Gear^.WDTimer |
1848 end; |
1870 end; |
1849 dec(Gear^.Timer); |
1871 dec(Gear^.Timer); |
1850 end |
1872 end |
1851 else // gsttmpFlag = 0 |
1873 else // gsttmpFlag = 0 |
1852 if (TurnTimeLeft = 0) |
1874 if (TurnTimeLeft = 0) |
1853 or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
1875 or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
1854 or (CurrentHedgehog^.Gear = nil) then |
1876 or (CurrentHedgehog^.Gear = nil) then |
1855 Gear^.State := Gear^.State or gsttmpFlag; |
1877 begin |
|
1878 Gear^.FlightTime:= GameTicks; |
|
1879 Gear^.State := Gear^.State or gsttmpFlag |
|
1880 end |
1856 end; |
1881 end; |
1857 |
1882 |
1858 //////////////////////////////////////////////////////////////////////////////// |
1883 //////////////////////////////////////////////////////////////////////////////// |
1859 procedure doStepSMine(Gear: PGear); |
1884 procedure doStepSMine(Gear: PGear); |
1860 var land: Word; |
1885 var land: Word; |