4811 procedure doStepStructure(Gear: PGear); |
4811 procedure doStepStructure(Gear: PGear); |
4812 var |
4812 var |
4813 x, y: LongInt; |
4813 x, y: LongInt; |
4814 hog: PHedgehog; |
4814 hog: PHedgehog; |
4815 begin |
4815 begin |
4816 if (Gear^.Hedgehog <> nil) and (Gear^.Tag = TotalRounds) then |
4816 if CurAmmoGear = Gear then |
4817 begin |
4817 begin |
4818 hog:= Gear^.Hedgehog; |
4818 if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then |
4819 hog^.Gear:= hog^.GearHidden; |
4819 begin |
4820 hog^.Gear^.X:= Gear^.X; |
4820 DeleteGear(Gear); |
4821 hog^.Gear^.Y:= Gear^.Y - Int2hwFloat(Gear^.Radius); |
4821 exit |
4822 hog^.Gear^.Active:= false; |
4822 end; |
4823 hog^.Gear^.State:= hog^.Gear^.State And not gstHHdriven; |
4823 if Gear = CurAmmoGear then CurAmmoGear := nil; |
4824 InsertGearToList(hog^.Gear); |
4824 Gear^.Hedgehog:= CurrentHedgehog; |
4825 hog^.GearHidden:= nil; |
4825 RemoveGearFromList(CurrentHedgehog^.Gear); |
4826 Gear^.Hedgehog:= nil; |
4826 CurrentHedgehog^.Gear^.Z := cHHZ; |
|
4827 CurrentHedgehog^.Gear^.Active := false; |
|
4828 CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstHHDriven; |
|
4829 CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear; |
|
4830 CurrentHedgehog^.Gear:= nil; |
|
4831 Gear^.Tag:= TotalRounds + Gear^.Tag; |
|
4832 AddGearCI(Gear); |
4827 end; |
4833 end; |
4828 |
4834 |
4829 dec(Gear^.Health, Gear^.Damage); |
4835 dec(Gear^.Health, Gear^.Damage); |
4830 Gear^.Damage := 0; |
4836 Gear^.Damage := 0; |
4831 |
4837 |
|
4838 if (Gear^.Tag = TotalRounds) or (Gear^.Health <= 0) then |
|
4839 begin |
|
4840 if Gear^.Hedgehog <> nil then |
|
4841 begin |
|
4842 Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden; |
|
4843 Gear^.Hedgehog^.GearHidden:= nil; |
|
4844 Gear^.Hedgehog^.Gear^.X:= Gear^.X; |
|
4845 Gear^.Hedgehog^.Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Radius + cHHRadius); |
|
4846 InsertGearToList(Gear^.Hedgehog^.Gear); |
|
4847 Gear^.Hedgehog:= nil; |
|
4848 SetAllHHToActive; |
|
4849 end; |
|
4850 end; |
|
4851 |
4832 if Gear^.Health <= 0 then |
4852 if Gear^.Health <= 0 then |
4833 begin |
4853 begin |
4834 if Gear^.Hedgehog <> nil then |
|
4835 begin |
|
4836 hog:= Gear^.Hedgehog; |
|
4837 hog^.Gear:= hog^.GearHidden; |
|
4838 hog^.Gear^.X:= Gear^.X; |
|
4839 hog^.Gear^.Y:= Gear^.Y; |
|
4840 InsertGearToList(hog^.Gear); |
|
4841 hog^.GearHidden:= nil; |
|
4842 Gear^.Hedgehog:= nil; |
|
4843 end; |
|
4844 |
|
4845 x := hwRound(Gear^.X); |
4854 x := hwRound(Gear^.X); |
4846 y := hwRound(Gear^.Y); |
4855 y := hwRound(Gear^.Y); |
4847 |
4856 |
|
4857 DeleteCI(Gear); |
4848 DeleteGear(Gear); |
4858 DeleteGear(Gear); |
4849 |
4859 |
4850 doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound); |
4860 doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound); |
4851 end; |
4861 end; |
4852 end; |
|
4853 |
|
4854 procedure doStepPlaceStructure(Gear: PGear); |
|
4855 var |
|
4856 hog: PHedgehog; |
|
4857 HHGear: PGear; |
|
4858 x, y, tx, ty: hwFloat; |
|
4859 begin |
|
4860 AllInactive := false; |
|
4861 |
|
4862 HHGear := Gear^.Hedgehog^.Gear; |
|
4863 tx := int2hwFloat(TargetPoint.X); |
|
4864 ty := int2hwFloat(TargetPoint.Y); |
|
4865 x := HHGear^.X; |
|
4866 y := HHGear^.Y; |
|
4867 |
|
4868 HHGear := Gear^.Hedgehog^.Gear; |
|
4869 if (Distance(tx - x, ty - y) > _256) or |
|
4870 not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
4871 TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
4872 sprHHTelepMask, 0, false, false) then |
|
4873 begin |
|
4874 HHGear^.Message := HHGear^.Message and not gmAttack; |
|
4875 HHGear^.State := HHGear^.State and not gstAttacking; |
|
4876 HHGear^.State := HHGear^.State or gstHHChooseTarget; |
|
4877 DeleteGear(Gear); |
|
4878 isCursorVisible := true; |
|
4879 PlaySound(sndDenied) |
|
4880 end |
|
4881 else |
|
4882 begin |
|
4883 DeleteCI(HHGear); |
|
4884 SetAllHHToActive; |
|
4885 PlaySound(sndPlaced); |
|
4886 CurAmmoGear:= nil; |
|
4887 AfterAttack; |
|
4888 Gear^.X := tx; |
|
4889 Gear^.Y := ty; |
|
4890 Gear^.Tag := TotalRounds + Gear^.Tag; |
|
4891 hog:= CurrentHedgehog; |
|
4892 hog^.GearHidden:= hog^.Gear; |
|
4893 RemoveGearFromList(hog^.Gear); |
|
4894 hog^.Gear:= nil; |
|
4895 Gear^.Hedgehog := hog; |
|
4896 Gear^.doStep := @doStepStructure; |
|
4897 end; |
|
4898 TargetPoint.X := NoPointX; |
|
4899 end; |
4862 end; |
4900 |
4863 |
4901 procedure doStepTardis(Gear: PGear); |
4864 procedure doStepTardis(Gear: PGear); |
4902 (*var |
4865 (*var |
4903 i, x, y: LongInt; |
4866 i, x, y: LongInt; |