hedgewars/GSHandlers.inc
changeset 5197 9fa96377a69c
parent 5186 a05c14510c8a
child 5218 bc31676ae108
equal deleted inserted replaced
5196:04ce9666a692 5197:9fa96377a69c
  4868     HHGear := Gear^.Hedgehog^.Gear;
  4868     HHGear := Gear^.Hedgehog^.Gear;
  4869     if (Distance(tx - x, ty - y) > _256) or
  4869     if (Distance(tx - x, ty - y) > _256) or
  4870        not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
  4870        not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
  4871        TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
  4871        TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
  4872        sprHHTelepMask, 0, false, false) then
  4872        sprHHTelepMask, 0, false, false) then
  4873     begin
  4873         begin
  4874         HHGear^.Message := HHGear^.Message and not gmAttack;
  4874         HHGear^.Message := HHGear^.Message and not gmAttack;
  4875         HHGear^.State := HHGear^.State and not gstAttacking;
  4875         HHGear^.State := HHGear^.State and not gstAttacking;
  4876         HHGear^.State := HHGear^.State or gstHHChooseTarget;
  4876         HHGear^.State := HHGear^.State or gstHHChooseTarget;
  4877         DeleteGear(Gear);
  4877         DeleteGear(Gear);
  4878         isCursorVisible := true;
  4878         isCursorVisible := true;
  4879         PlaySound(sndDenied)
  4879         PlaySound(sndDenied)
  4880     end
  4880         end
  4881     else
  4881     else
  4882     begin
  4882         begin
  4883         DeleteCI(HHGear);
  4883         DeleteCI(HHGear);
  4884         SetAllHHToActive;
  4884         SetAllHHToActive;
  4885         PlaySound(sndPlaced);
  4885         PlaySound(sndPlaced);
  4886         CurAmmoGear:= nil;
  4886         CurAmmoGear:= nil;
  4887         AfterAttack;
  4887         AfterAttack;
  4892         hog^.GearHidden:= hog^.Gear;
  4892         hog^.GearHidden:= hog^.Gear;
  4893         RemoveGearFromList(hog^.Gear);
  4893         RemoveGearFromList(hog^.Gear);
  4894         hog^.Gear:= nil;
  4894         hog^.Gear:= nil;
  4895         Gear^.Hedgehog := hog;
  4895         Gear^.Hedgehog := hog;
  4896         Gear^.doStep := @doStepStructure;
  4896         Gear^.doStep := @doStepStructure;
  4897     end;
  4897         end;
  4898     TargetPoint.X := NoPointX;
  4898     TargetPoint.X := NoPointX;
  4899 end;
  4899 end;
  4900 
  4900 
       
  4901 procedure doStepTardis(Gear: PGear);
       
  4902 (*var 
       
  4903     i, x, y: LongInt;
       
  4904     dX, dY: hwFloat;
       
  4905     Fire: PGear;
       
  4906     vg: PVisualGear;*)
       
  4907 begin
       
  4908     if (Gear^.State and gstTmpFlag) = 0 then dec(Gear^.Timer);
       
  4909     if (Gear^.Timer = 0) and (CurAmmoGear = Gear) then
       
  4910         begin
       
  4911         if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then 
       
  4912             begin
       
  4913             DeleteGear(Gear);
       
  4914             exit
       
  4915             end;
       
  4916         if Gear = CurAmmoGear then CurAmmoGear := nil;
       
  4917         Gear^.Hedgehog:= CurrentHedgehog;
       
  4918         RemoveGearFromList(CurrentHedgehog^.Gear);
       
  4919         CurrentHedgehog^.Gear^.Z := cHHZ;
       
  4920         CurrentHedgehog^.Gear^.Active := false;
       
  4921         CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstHHDriven;
       
  4922         CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear;
       
  4923         CurrentHedgehog^.Gear:= nil;
       
  4924         Gear^.State:= Gear^.State or gstTmpFlag;
       
  4925         Gear^.Timer:= GameTicks + GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime;
       
  4926         end
       
  4927     else if (((Gear^.State and gstTmpFlag) <> 0) and (Gear^.Timer = GameTicks)) or SuddenDeath then
       
  4928         begin
       
  4929         if Gear^.Hedgehog <> nil then
       
  4930             begin
       
  4931             Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden;
       
  4932             Gear^.Hedgehog^.GearHidden:= nil;
       
  4933             FindPlace(Gear^.Hedgehog^.Gear, false, 0, LAND_WIDTH,true);
       
  4934             InsertGearToList(Gear^.Hedgehog^.Gear);
       
  4935             Gear^.Hedgehog^.Gear^.State:= (Gear^.Hedgehog^.Gear^.State or gstTmpFlag or gstAttacked) and not gstHHDriven;
       
  4936             Gear^.Hedgehog^.Gear^.Timer:= $FF;
       
  4937             Gear^.Hedgehog^.Gear^.doStep:= @doStepHedgehogReturn;
       
  4938             SetAllHHToActive;
       
  4939             end;
       
  4940             DeleteGear(Gear)
       
  4941         end
       
  4942 end;