hedgewars/GSHandlers.inc
changeset 4758 73aef6a577ba
parent 4708 aa1da6339eb3
child 4774 d81c6e14416d
equal deleted inserted replaced
4755:7df529b4335c 4758:73aef6a577ba
  2883 
  2883 
  2884     dec(Gear^.Tag);
  2884     dec(Gear^.Tag);
  2885 end;
  2885 end;
  2886 
  2886 
  2887 ////////////////////////////////////////////////////////////////////////////////
  2887 ////////////////////////////////////////////////////////////////////////////////
       
  2888 procedure doStepDrill(Gear: PGear);
       
  2889 forward;
       
  2890 
  2888 procedure doStepDrillDrilling(Gear: PGear);
  2891 procedure doStepDrillDrilling(Gear: PGear);
  2889 var 
  2892 var 
  2890     t: PGearArray;
  2893     t: PGearArray;
  2891     ox, oy: hwFloat;
  2894     ox, oy: hwFloat;
  2892 begin
  2895 begin
  2911     t := CheckGearsCollision(Gear);
  2914     t := CheckGearsCollision(Gear);
  2912     //fixes drill not exploding when touching HH bug
  2915     //fixes drill not exploding when touching HH bug
  2913     if (Gear^.Timer = 0)
  2916     if (Gear^.Timer = 0)
  2914        or (t^.Count <> 0)
  2917        or (t^.Count <> 0)
  2915        or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  2918        or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  2916        and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
  2919        and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))
       
  2920        and ((Gear^.State and gsttmpFlag) = 0)) 
  2917 // CheckLandValue returns true if the type isn't matched
  2921 // CheckLandValue returns true if the type isn't matched
  2918        or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then
  2922        or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then
  2919     begin
  2923         begin
  2920         //out of time or exited ground
  2924         //out of time or exited ground
  2921         StopSound(Gear^.SoundChannel);
  2925         StopSound(Gear^.SoundChannel);
  2922         if (Gear^.State and gsttmpFlag) <> 0 then
  2926         if (Gear^.State and gsttmpFlag) <> 0 then
  2923             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound)
  2927             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound)
  2924         else
  2928         else
  2925             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  2929             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  2926         DeleteGear(Gear);
  2930         DeleteGear(Gear);
  2927         exit
  2931         exit
  2928     end;
  2932         end
       
  2933     else if not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then
       
  2934         begin
       
  2935         StopSound(Gear^.SoundChannel);
       
  2936         Gear^.doStep := @doStepDrill
       
  2937         end;
  2929 
  2938 
  2930     dec(Gear^.Timer);
  2939     dec(Gear^.Timer);
  2931 end;
  2940 end;
  2932 
  2941 
  2933 procedure doStepDrill(Gear: PGear);
  2942 procedure doStepDrill(Gear: PGear);