hedgewars/uGearsHandlersMess.pas
changeset 14028 cfbea054754c
parent 14027 105793e575d6
child 14029 967ed77d6aef
equal deleted inserted replaced
14027:105793e575d6 14028:cfbea054754c
  3328         Gear^.AdvBounce:= 1;
  3328         Gear^.AdvBounce:= 1;
  3329 
  3329 
  3330     HHGear := Gear^.Hedgehog^.Gear;
  3330     HHGear := Gear^.Hedgehog^.Gear;
  3331     if HHGear = nil then
  3331     if HHGear = nil then
  3332         begin
  3332         begin
       
  3333         ClearHitOrder();
       
  3334         ClearProximityCache();
  3333         DeleteGear(Gear);
  3335         DeleteGear(Gear);
  3334         exit
  3336         exit
  3335         end;
  3337         end;
  3336 
  3338 
  3337     HHGear^.State := HHGear^.State or gstNoDamage;
  3339     HHGear^.State := HHGear^.State or gstNoDamage;
  3359 
  3361 
  3360         // check for drowning
  3362         // check for drowning
  3361         if CheckGearDrowning(HHGear) then
  3363         if CheckGearDrowning(HHGear) then
  3362             begin
  3364             begin
  3363             AfterAttack;
  3365             AfterAttack;
       
  3366             ClearHitOrder();
       
  3367             ClearProximityCache();
  3364             DeleteGear(Gear);
  3368             DeleteGear(Gear);
  3365             exit;
  3369             exit;
  3366             end;
  3370             end;
  3367 
  3371 
  3368         inc(Gear^.Damage, 2);
  3372         inc(Gear^.Damage, 2);
  3383                 Gear^.Pos := 3
  3387                 Gear^.Pos := 3
  3384             else
  3388             else
  3385                 Gear^.Pos := 2;
  3389                 Gear^.Pos := 2;
  3386             end;
  3390             end;
  3387 
  3391 
  3388         AmmoShove(Gear, Gear^.Boom, 40);
  3392         AmmoShoveCache(Gear, Gear^.Boom, 40);
  3389 
  3393 
  3390         DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  3394         DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  3391                     HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
  3395                     HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
  3392         HHGear^.dX,
  3396         HHGear^.dX,
  3393         HHGear^.dY,
  3397         HHGear^.dY,
  3394         20 + cHHRadius * 2,
  3398         20 + cHHRadius * 2,
  3395         cHHRadius * 2 + 7);
  3399         cHHRadius * 2 + 7);
  3396 
  3400 
  3397         upd := 0
  3401         upd := 0
  3398         end;
  3402         end;
       
  3403 
       
  3404     inc(Gear^.Timer);
       
  3405     if (Gear^.Timer mod 100) = 0 then
       
  3406         RefillProximityCache(Gear, 300);
  3399 
  3407 
  3400     if Gear^.Health < Gear^.Damage then
  3408     if Gear^.Health < Gear^.Damage then
  3401         begin
  3409         begin
  3402         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3410         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3403         if hasWishes then
  3411         if hasWishes then
  3421         s:= ansistring(Gear^.Hedgehog^.Name);
  3429         s:= ansistring(Gear^.Hedgehog^.Name);
  3422         AddCaption(FormatA(GetEventString(eidKamikaze), s), capcolDefault, capgrpMessage);
  3430         AddCaption(FormatA(GetEventString(eidKamikaze), s), capcolDefault, capgrpMessage);
  3423         uStats.HedgehogSacrificed(Gear^.Hedgehog);
  3431         uStats.HedgehogSacrificed(Gear^.Hedgehog);
  3424         AfterAttack;
  3432         AfterAttack;
  3425         HHGear^.Message:= HHGear^.Message or gmDestroy;
  3433         HHGear^.Message:= HHGear^.Message or gmDestroy;
       
  3434         ClearHitOrder();
       
  3435         ClearProximityCache();
  3426         DeleteGear(Gear);
  3436         DeleteGear(Gear);
  3427         end
  3437         end
  3428     else
  3438     else
  3429         begin
  3439         begin
  3430         dec(Gear^.Health, Gear^.Damage);
  3440         dec(Gear^.Health, Gear^.Damage);
  3438     dec(Gear^.Timer);
  3448     dec(Gear^.Timer);
  3439     if Gear^.Timer = 0 then
  3449     if Gear^.Timer = 0 then
  3440         begin
  3450         begin
  3441         Gear^.Pos := 1;
  3451         Gear^.Pos := 1;
  3442         PlaySoundV(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack);
  3452         PlaySoundV(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack);
       
  3453         ClearHitOrder();
       
  3454         RefillProximityCache(Gear, 300);
  3443         Gear^.doStep := @doStepKamikazeWork
  3455         Gear^.doStep := @doStepKamikazeWork
  3444         end
  3456         end
  3445 end;
  3457 end;
  3446 
  3458 
  3447 procedure doStepKamikaze(Gear: PGear);
  3459 procedure doStepKamikaze(Gear: PGear);