hedgewars/uGearsHandlersMess.pas
changeset 10831 19d056c10bbd
parent 10827 2b717f687c72
child 10874 059a6492176e
equal deleted inserted replaced
10830:f3e903ace2d3 10831:19d056c10bbd
  1380 
  1380 
  1381     if (TurnTimeLeft > 0) then
  1381     if (TurnTimeLeft > 0) then
  1382         dec(TurnTimeLeft)
  1382         dec(TurnTimeLeft)
  1383     else
  1383     else
  1384         begin
  1384         begin
       
  1385         HHGear^.State := HHGear^.State and (not gstNotKickable);
  1385         DeleteGear(Gear);
  1386         DeleteGear(Gear);
  1386         AfterAttack
  1387         AfterAttack
  1387         end;
  1388         end;
  1388 end;
  1389 end;
  1389 
  1390 
  3565     gX, gY: LongInt;
  3566     gX, gY: LongInt;
  3566 begin
  3567 begin
  3567     AllInactive := false;
  3568     AllInactive := false;
  3568     dec(Gear^.Timer);
  3569     dec(Gear^.Timer);
  3569     HHGear := Gear^.Hedgehog^.Gear;
  3570     HHGear := Gear^.Hedgehog^.Gear;
       
  3571     if HHGear = nil then
       
  3572         begin
       
  3573         DeleteGear(gear);
       
  3574         exit
       
  3575         end;
  3570     HedgehogChAngle(HHGear);
  3576     HedgehogChAngle(HHGear);
  3571     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  3577     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  3572     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  3578     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  3573     if (Gear^.Timer mod 100) = 0 then
  3579     if (Gear^.Timer mod 100) = 0 then
  3574         begin
  3580         begin
  3581         PlaySound(sndGun);
  3587         PlaySound(sndGun);
  3582         end;
  3588         end;
  3583 
  3589 
  3584     if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then
  3590     if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then
  3585         begin
  3591         begin
       
  3592         HHGear^.State := HHGear^.State and (not gstNotKickable);
  3586         DeleteGear(Gear);
  3593         DeleteGear(Gear);
  3587         AfterAttack
  3594         AfterAttack
  3588         end
  3595         end
  3589 end;
  3596 end;
  3590 
  3597 
  3637         if Gear^.Angle > 2048 then
  3644         if Gear^.Angle > 2048 then
  3638             dec(Gear^.Angle)
  3645             dec(Gear^.Angle)
  3639         else if Gear^.Angle < 2048 then
  3646         else if Gear^.Angle < 2048 then
  3640             inc(Gear^.Angle)
  3647             inc(Gear^.Angle)
  3641         else fChanged := false
  3648         else fChanged := false
  3642     end
  3649         end
  3643     else
  3650     else
  3644         begin
  3651         begin
  3645         if ((Gear^.Message and gmLeft) <> 0) then
  3652         if ((Gear^.Message and gmLeft) <> 0) then
  3646             begin
  3653             begin
  3647             fChanged := true;
  3654             fChanged := true;
  3712                 dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1);
  3719                 dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1);
  3713                 dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1);
  3720                 dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1);
  3714                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  3721                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  3715                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0);
  3722                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0);
  3716                 end;
  3723                 end;
       
  3724             if HHGear <> nil then HHGear^.State := HHGear^.State and (not gstNotKickable);
  3717             DeleteGear(Gear)
  3725             DeleteGear(Gear)
  3718             end;
  3726             end;
  3719 
  3727 
  3720         AfterAttack;
  3728         AfterAttack;
  3721         CurAmmoGear := nil;
  3729         CurAmmoGear := nil;
  4968     rx, ry, speed: hwFloat;
  4976     rx, ry, speed: hwFloat;
  4969     i, gX, gY: LongInt;
  4977     i, gX, gY: LongInt;
  4970 begin
  4978 begin
  4971     AllInactive := false;
  4979     AllInactive := false;
  4972     HHGear := Gear^.Hedgehog^.Gear;
  4980     HHGear := Gear^.Hedgehog^.Gear;
       
  4981     if HHGear = nil then
       
  4982         begin
       
  4983         DeleteGear(gear);
       
  4984         exit
       
  4985         end;
  4973     HedgehogChAngle(HHGear);
  4986     HedgehogChAngle(HHGear);
  4974     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  4987     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  4975     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  4988     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  4976 
  4989 
  4977     if (GameTicks and $FF) = 0 then
  4990     if (GameTicks and $FF) = 0 then
  5020         Gear^.Timer:= Gear^.Tag
  5033         Gear^.Timer:= Gear^.Tag
  5021         end;
  5034         end;
  5022 
  5035 
  5023     if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) then
  5036     if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) then
  5024         begin
  5037         begin
       
  5038         HHGear^.State := HHGear^.State and (not gstNotKickable);
  5025         DeleteGear(Gear);
  5039         DeleteGear(Gear);
  5026         AfterAttack
  5040         AfterAttack
  5027         end
  5041         end
  5028     else
  5042     else
  5029         begin
  5043         begin
  5055     rx, ry, speed: hwFloat;
  5069     rx, ry, speed: hwFloat;
  5056     i, gX, gY: LongInt;
  5070     i, gX, gY: LongInt;
  5057 begin
  5071 begin
  5058     AllInactive := false;
  5072     AllInactive := false;
  5059     HHGear := Gear^.Hedgehog^.Gear;
  5073     HHGear := Gear^.Hedgehog^.Gear;
       
  5074     if HHGear = nil then
       
  5075         begin
       
  5076         DeleteGear(gear);
       
  5077         exit
       
  5078         end;
  5060     HedgehogChAngle(HHGear);
  5079     HedgehogChAngle(HHGear);
  5061     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  5080     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
  5062     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  5081     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
  5063 
  5082 
  5064     if (GameTicks and $FF) = 0 then
  5083     if (GameTicks and $FF) = 0 then
  5097         end;
  5116         end;
  5098 
  5117 
  5099     if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then
  5118     if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then
  5100         begin
  5119         begin
  5101         HHGear^.Message:= HHGear^.Message and (not gmAttack);
  5120         HHGear^.Message:= HHGear^.Message and (not gmAttack);
       
  5121         HHGear^.State := HHGear^.State and (not gstNotKickable);
  5102         DeleteGear(Gear);
  5122         DeleteGear(Gear);
  5103         AfterAttack
  5123         AfterAttack
  5104         end
  5124         end
  5105     else
  5125     else
  5106         begin
  5126         begin