1797 // then we aren't hunting |
1797 // then we aren't hunting |
1798 if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or |
1798 if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or |
1799 ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or |
1799 ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or |
1800 (Gear^.State and gsttmpFlag = 0) or |
1800 (Gear^.State and gsttmpFlag = 0) or |
1801 (Gear^.Angle = 0) then |
1801 (Gear^.Angle = 0) then |
1802 gear^.State:= gear^.State and (not gstHHChooseTarget) |
1802 gear^.State:= gear^.State and (not gstChooseTarget) |
1803 else if |
1803 else if |
1804 // todo, allow not finding new target, set timeout on target retention |
1804 // todo, allow not finding new target, set timeout on target retention |
1805 (Gear^.State and gstAttacking = 0) and |
1805 (Gear^.State and gstAttacking = 0) and |
1806 ((GameTicks and $FF) = 17) and |
1806 ((GameTicks and $FF) = 17) and |
1807 (GameTicks > Gear^.FlightTime) then // recheck hunted hog |
1807 (GameTicks > Gear^.FlightTime) then // recheck hunted hog |
1808 begin |
1808 begin |
1809 gear^.State:= gear^.State or gstHHChooseTarget; |
1809 gear^.State:= gear^.State or gstChooseTarget; |
1810 if targ <> nil then |
1810 if targ <> nil then |
1811 targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
1811 targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
1812 else targDist:= 0; |
1812 else targDist:= 0; |
1813 for t:= 0 to Pred(TeamsCount) do |
1813 for t:= 0 to Pred(TeamsCount) do |
1814 with TeamsArray[t]^ do |
1814 with TeamsArray[t]^ do |
2745 if warn <> nil then |
2745 if warn <> nil then |
2746 warn^.Tex := GetPlaceCollisionTex(Gear^.Target.X - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Width div 2, Gear^.Target.Y - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Height div 2, Ammoz[Gear^.AmmoType].PosSprite, Gear^.State); |
2746 warn^.Tex := GetPlaceCollisionTex(Gear^.Target.X - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Width div 2, Gear^.Target.Y - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Height div 2, Ammoz[Gear^.AmmoType].PosSprite, Gear^.State); |
2747 end; |
2747 end; |
2748 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2748 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2749 HHGear^.State := HHGear^.State and (not gstAttacking); |
2749 HHGear^.State := HHGear^.State and (not gstAttacking); |
2750 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2750 HHGear^.State := HHGear^.State or gstChooseTarget; |
2751 isCursorVisible := true; |
2751 isCursorVisible := true; |
2752 DeleteGear(Gear) |
2752 DeleteGear(Gear) |
2753 end |
2753 end |
2754 else |
2754 else |
2755 begin |
2755 begin |
2830 |
2830 |
2831 if not valid then |
2831 if not valid then |
2832 begin |
2832 begin |
2833 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2833 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2834 HHGear^.State := HHGear^.State and (not gstAttacking); |
2834 HHGear^.State := HHGear^.State and (not gstAttacking); |
2835 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
2835 HHGear^.State := HHGear^.State or gstChooseTarget; |
2836 isCursorVisible := true; |
2836 isCursorVisible := true; |
2837 warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true); |
2837 warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true); |
2838 if warn <> nil then |
2838 if warn <> nil then |
2839 warn^.Tex := GetPlaceCollisionTex(lx, ty, sprHHTelepMask, 0); |
2839 warn^.Tex := GetPlaceCollisionTex(lx, ty, sprHHTelepMask, 0); |
2840 DeleteGear(Gear); |
2840 DeleteGear(Gear); |