hedgewars/uGearsHandlersMess.pas
changeset 11916 6145efcff302
parent 11865 0abbe6f1e4f2
child 11920 16ce211010cf
equal deleted inserted replaced
11915:245163aa3674 11916:6145efcff302
  1592     if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then
  1592     if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then
  1593         dec(TurnTimeLeft);
  1593         dec(TurnTimeLeft);
  1594 
  1594 
  1595     if Gear^.Hedgehog^.Gear = nil then
  1595     if Gear^.Hedgehog^.Gear = nil then
  1596         begin
  1596         begin
       
  1597         StopSoundChan(Gear^.SoundChannel);
  1597         DeleteGear(Gear);
  1598         DeleteGear(Gear);
  1598         AfterAttack;
  1599         AfterAttack;
  1599         exit
  1600         exit
  1600         end;
  1601         end;
  1601 
  1602 
  1669         end;
  1670         end;
  1670 
  1671 
  1671     if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
  1672     if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
  1672     or ((HHGear^.Message and gmAttack) <> 0) then
  1673     or ((HHGear^.Message and gmAttack) <> 0) then
  1673         begin
  1674         begin
       
  1675         StopSoundChan(Gear^.SoundChannel);
  1674         HHGear^.Message := 0;
  1676         HHGear^.Message := 0;
  1675         HHGear^.State := HHGear^.State and (not gstNotKickable);
  1677         HHGear^.State := HHGear^.State and (not gstNotKickable);
  1676         DeleteGear(Gear);
  1678         DeleteGear(Gear);
  1677         AfterAttack
  1679         AfterAttack
  1678         end
  1680         end
  1693         ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7),
  1695         ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7),
  1694         Gear^.dX, Gear^.dY,
  1696         Gear^.dX, Gear^.dY,
  1695         cHHStepTicks, cHHRadius * 2 + 7);
  1697         cHHStepTicks, cHHRadius * 2 + 7);
  1696     HHGear^.Message := 0;
  1698     HHGear^.Message := 0;
  1697     HHGear^.State := HHGear^.State or gstNotKickable;
  1699     HHGear^.State := HHGear^.State or gstNotKickable;
       
  1700     Gear^.SoundChannel := LoopSound(sndBlowTorch);
  1698     Gear^.doStep := @doStepBlowTorchWork
  1701     Gear^.doStep := @doStepBlowTorchWork
  1699 end;
  1702 end;
  1700 
  1703 
  1701 
  1704 
  1702 ////////////////////////////////////////////////////////////////////////////////
  1705 ////////////////////////////////////////////////////////////////////////////////
  3886                         bubble := AddVisualGear(hwRound(HHGear^.X) - 8 + random(16), hwRound(HHGear^.Y) + 16 + random(8), vgtBubble);
  3889                         bubble := AddVisualGear(hwRound(HHGear^.X) - 8 + random(16), hwRound(HHGear^.Y) + 16 + random(8), vgtBubble);
  3887                         if bubble <> nil then
  3890                         if bubble <> nil then
  3888                             bubble^.dY:= random(20)/10+0.1;
  3891                             bubble^.dY:= random(20)/10+0.1;
  3889                         end
  3892                         end
  3890                     end
  3893                     end
  3891                 else HHGear^.dY := HHGear^.dY - move;
  3894                 else
       
  3895                     begin
       
  3896                     PlaySound(sndJetpackBoost);
       
  3897                     HHGear^.dY := HHGear^.dY - move;
       
  3898                     end
  3892                 end;
  3899                 end;
  3893             dec(Gear^.Health, fuel);
  3900             dec(Gear^.Health, fuel);
  3894             Gear^.MsgParam := Gear^.MsgParam or gmUp;
  3901             Gear^.MsgParam := Gear^.MsgParam or gmUp;
  3895             Gear^.Timer := GameTicks
  3902             Gear^.Timer := GameTicks
  3896             end;
  3903             end;
  3912                             bubble^.dX:= bubble^.dX * (-1)
  3919                             bubble^.dX:= bubble^.dX * (-1)
  3913                             end
  3920                             end
  3914                         else bubble^.X := bubble^.X - 28;
  3921                         else bubble^.X := bubble^.X - 28;
  3915                         end;
  3922                         end;
  3916                     end
  3923                     end
  3917                 end;
  3924                 end
       
  3925             else PlaySound(sndJetpackBoost);
  3918             dec(Gear^.Health, fuel div 5);
  3926             dec(Gear^.Health, fuel div 5);
  3919             Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight));
  3927             Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight));
  3920             Gear^.Timer := GameTicks
  3928             Gear^.Timer := GameTicks
  3921             end
  3929             end
  3922         end;
  3930         end;
  3993 begin
  4001 begin
  3994     Gear^.Pos:= 0;
  4002     Gear^.Pos:= 0;
  3995     Gear^.doStep := @doStepJetpackWork;
  4003     Gear^.doStep := @doStepJetpackWork;
  3996 
  4004 
  3997     HHGear := Gear^.Hedgehog^.Gear;
  4005     HHGear := Gear^.Hedgehog^.Gear;
       
  4006 
       
  4007     PlaySound(sndJetpackLaunch);
  3998     FollowGear := HHGear;
  4008     FollowGear := HHGear;
  3999     AfterAttack;
  4009     AfterAttack;
  4000     with HHGear^ do
  4010     with HHGear^ do
  4001         begin
  4011         begin
  4002         State := State and (not gstAttacking);
  4012         State := State and (not gstAttacking);
  4252 begin
  4262 begin
  4253     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.Message and gmSwitch) <> 0) then
  4263     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.Message and gmSwitch) <> 0) then
  4254             with CurrentHedgehog^ do
  4264             with CurrentHedgehog^ do
  4255                 if (CurAmmoType = amPortalGun) then
  4265                 if (CurAmmoType = amPortalGun) then
  4256                     begin
  4266                     begin
       
  4267                     PlaySound(sndPortalSwitch);
  4257                     CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch);
  4268                     CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch);
  4258 
  4269 
  4259                     CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);
  4270                     CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);
  4260                     if CurWeapon^.Pos <> 0 then
  4271                     if CurWeapon^.Pos <> 0 then
  4261                         CurWeapon^.Pos := 0
  4272                         CurWeapon^.Pos := 0
  4663             Gear^.DirAngle := 180-Gear^.DirAngle;
  4674             Gear^.DirAngle := 180-Gear^.DirAngle;
  4664 
  4675 
  4665         if ((Gear^.LinkedGear = nil)
  4676         if ((Gear^.LinkedGear = nil)
  4666         or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then
  4677         or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then
  4667             begin
  4678             begin
       
  4679             PlaySound(sndPortalOpen);
  4668             loadNewPortalBall(Gear, false);
  4680             loadNewPortalBall(Gear, false);
  4669             inc(Gear^.Tag);
  4681             inc(Gear^.Tag);
  4670             Gear^.doStep := @doStepPortal;
  4682             Gear^.doStep := @doStepPortal;
  4671         end
  4683         end
  4672         else
  4684         else
  4704     s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s;
  4716     s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s;
  4705     newPortal^.dX := newPortal^.dX * s;
  4717     newPortal^.dX := newPortal^.dX * s;
  4706     newPortal^.dY := newPortal^.dY * s;
  4718     newPortal^.dY := newPortal^.dY * s;
  4707 
  4719 
  4708     newPortal^.LinkedGear := nil;
  4720     newPortal^.LinkedGear := nil;
       
  4721 
       
  4722     PlaySound(sndPortalShot);
  4709 
  4723 
  4710     if CurrentHedgehog <> nil then
  4724     if CurrentHedgehog <> nil then
  4711         with CurrentHedgehog^ do
  4725         with CurrentHedgehog^ do
  4712             begin
  4726             begin
  4713             CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);
  4727             CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^);