hedgewars/uGearsHandlersMess.pas
changeset 11070 f9a03078dd4f
parent 11057 adb5ef54da54
child 11152 3ac7f6d43200
equal deleted inserted replaced
11069:1997662b68d8 11070:f9a03078dd4f
  2805 procedure doStepTeleportAfter(Gear: PGear);
  2805 procedure doStepTeleportAfter(Gear: PGear);
  2806 var
  2806 var
  2807     HHGear: PGear;
  2807     HHGear: PGear;
  2808 begin
  2808 begin
  2809     HHGear := Gear^.Hedgehog^.Gear;
  2809     HHGear := Gear^.Hedgehog^.Gear;
  2810     doStepHedgehogMoving(HHGear);
  2810     if HHGear <> nil then doStepHedgehogMoving(HHGear);
  2811     // if not infattack mode wait for hedgehog finish falling to collect cases
  2811     // if not infattack mode wait for hedgehog finish falling to collect cases
  2812     if ((GameFlags and gfInfAttack) <> 0)
  2812     if ((GameFlags and gfInfAttack) <> 0)
       
  2813     or (HHGear = nil)
  2813     or ((HHGear^.State and gstMoving) = 0)
  2814     or ((HHGear^.State and gstMoving) = 0)
  2814     or (Gear^.Hedgehog^.Gear^.Damage > 0)
  2815     or (HHGear^.Damage > 0)
  2815     or ((HHGear^.State and gstDrowning) = 1) then
  2816     or ((HHGear^.State and gstDrowning) = 1) then
  2816         begin
  2817         begin
  2817         DeleteGear(Gear);
  2818         DeleteGear(Gear);
  2818         AfterAttack
  2819         AfterAttack
  2819         end
  2820         end
  2820 end;
  2821 end;
  2821 
  2822 
  2822 procedure doStepTeleportAnim(Gear: PGear);
  2823 procedure doStepTeleportAnim(Gear: PGear);
  2823 begin
  2824 begin
  2824     if (Gear^.Hedgehog^.Gear^.Damage > 0) then
  2825     if (Gear^.Hedgehog^.Gear = nil) or (Gear^.Hedgehog^.Gear^.Damage > 0) then
  2825         begin
  2826         begin
  2826         DeleteGear(Gear);
  2827         DeleteGear(Gear);
  2827         AfterAttack;
  2828         AfterAttack;
  2828         end;
  2829         end;
  2829     inc(Gear^.Timer);
  2830     inc(Gear^.Timer);
  2846     ytol = cHHRadius;
  2847     ytol = cHHRadius;
  2847 begin
  2848 begin
  2848     AllInactive := false;
  2849     AllInactive := false;
  2849 
  2850 
  2850     HHGear := Gear^.Hedgehog^.Gear;
  2851     HHGear := Gear^.Hedgehog^.Gear;
       
  2852     if HHGear = nil then
       
  2853     begin
       
  2854         DeleteGear(Gear);
       
  2855         exit
       
  2856     end; 
  2851 
  2857 
  2852     valid:= false;
  2858     valid:= false;
  2853 
  2859 
  2854     lx:= Gear^.Target.X - SpritesData[sprHHTelepMask].Width  div 2; // left
  2860     lx:= Gear^.Target.X - SpritesData[sprHHTelepMask].Width  div 2; // left
  2855     ty:= Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2; // top
  2861     ty:= Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2; // top