hedgewars/GSHandlers.inc
changeset 6532 76d63e00002f
parent 6507 e462a57f432e
child 6535 51a7e71ad317
equal deleted inserted replaced
6531:c938a35588af 6532:76d63e00002f
  3167             StopSound(Gear^.SoundChannel);
  3167             StopSound(Gear^.SoundChannel);
  3168             exit
  3168             exit
  3169         end
  3169         end
  3170     end;
  3170     end;
  3171 
  3171 
  3172     t := CheckGearsCollision(Gear);
  3172     if GameTicks > Gear^.FlightTime then t := CheckGearsCollision(Gear)
       
  3173     else t := nil;
  3173     //fixes drill not exploding when touching HH bug
  3174     //fixes drill not exploding when touching HH bug
  3174     if (Gear^.Timer = 0) or (t^.Count <> 0) or 
  3175     if (Gear^.Timer = 0) or ((t <> nil) and (t^.Count <> 0)) or 
  3175        ( ((Gear^.State and gsttmpFlag) = 0) and
  3176        ( ((Gear^.State and gsttmpFlag) = 0) and
  3176          (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0)
  3177          (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0)
  3177          and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))))
  3178          and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))))
  3178 // CheckLandValue returns true if the type isn't matched
  3179 // CheckLandValue returns true if the type isn't matched
  3179        or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then
  3180        or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then
  3220     begin
  3221     begin
  3221         //hit
  3222         //hit
  3222         Gear^.dX := oldDx;
  3223         Gear^.dX := oldDx;
  3223         Gear^.dY := oldDy;
  3224         Gear^.dY := oldDy;
  3224 
  3225 
  3225         t := CheckGearsCollision(Gear);
  3226         if GameTicks > Gear^.FlightTime then t := CheckGearsCollision(Gear)
  3226         if (t^.Count = 0) then
  3227         else t := nil;
  3227         begin
  3228         if (t = nil) or (t^.Count = 0) then
       
  3229             begin
  3228             //hit the ground not the HH
  3230             //hit the ground not the HH
  3229             t2 := _0_5 / Distance(Gear^.dX, Gear^.dY);
  3231             t2 := _0_5 / Distance(Gear^.dX, Gear^.dY);
  3230             Gear^.dX := Gear^.dX * t2;
  3232             Gear^.dX := Gear^.dX * t2;
  3231             Gear^.dY := Gear^.dY * t2;
  3233             Gear^.dY := Gear^.dY * t2;
  3232         end
  3234             end
  3233         else
  3235         else if (t <> nil) then
  3234         begin
  3236             begin
  3235             //explode right on contact with HH
  3237             //explode right on contact with HH
  3236             if (Gear^.State and gsttmpFlag) <> 0 then
  3238             if (Gear^.State and gsttmpFlag) <> 0 then
  3237                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound)
  3239                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound)
  3238             else
  3240             else
  3239                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  3241                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  3240             DeleteGear(Gear);
  3242             DeleteGear(Gear);
  3241             exit;
  3243             exit;
  3242         end;
  3244             end;
  3243 
  3245 
  3244         Gear^.SoundChannel := LoopSound(sndDrillRocket);
  3246         Gear^.SoundChannel := LoopSound(sndDrillRocket);
  3245         Gear^.doStep := @doStepDrillDrilling;
  3247         Gear^.doStep := @doStepDrillDrilling;
  3246         if (Gear^.State and gsttmpFlag) <> 0 then
  3248         if (Gear^.State and gsttmpFlag) <> 0 then
  3247             gear^.RenderTimer:= true;
  3249             gear^.RenderTimer:= true;