hedgewars/HHHandlers.inc
branchhedgeroid
changeset 5530 25d4118056e1
parent 5526 70a5ec7b1020
child 5563 fc73b6e941f7
equal deleted inserted replaced
5516:8710987d3484 5530:25d4118056e1
   180      Gear^.Hedgehog^ do
   180      Gear^.Hedgehog^ do
   181      begin
   181      begin
   182      if ((State and gstHHDriven) <> 0)and
   182      if ((State and gstHHDriven) <> 0)and
   183         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   183         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   184         (((State and gstMoving) = 0) or
   184         (((State and gstMoving) = 0) or
       
   185             (CurAmmoType = amTeleport) or 
   185             // Allow attacks while moving on ammo with AltAttack
   186             // Allow attacks while moving on ammo with AltAttack
   186             ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or
   187             ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or
   187             ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and
   188             ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and
   188         ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then
   189         ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then
   189         begin
   190         begin
   299                                  newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
   300                                  newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
   300                                  newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
   301                                  newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
   301                                  end;
   302                                  end;
   302                        amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
   303                        amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
   303                          amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
   304                          amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
   304                     amSeduction: newGear:= AddGear(hwRound(lx + xx * cHHRadius * 2), hwRound(ly + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
   305                     amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0);
   305                    amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
   306                    amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
   306                   amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
   307                   amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
   307                         amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
   308                         amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
   308                       amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
   309                       amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
   309                     amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
   310                     amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
   371                       amJetpack, amBirdy,
   372                       amJetpack, amBirdy,
   372                  amFlamethrower, amLandGun,
   373                  amFlamethrower, amLandGun,
   373                   amResurrector, amStructure,
   374                   amResurrector, amStructure,
   374                        amTardis: CurAmmoGear:= newGear;
   375                        amTardis: CurAmmoGear:= newGear;
   375                   end;
   376                   end;
       
   377         if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
       
   378             begin
       
   379             newGear^.TargetX:= TargetPoint.X;
       
   380             newGear^.TargetY:= TargetPoint.Y
       
   381             end;
   376 
   382 
   377         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
   383         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
   378         if altUse then FollowGear:= nil;
   384         if altUse then FollowGear:= nil;
   379 
   385 
   380         if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then
   386         if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then
   414            if not CurrentTeam^.ExtDriven and
   420            if not CurrentTeam^.ExtDriven and
   415              ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a');
   421              ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a');
   416            AfterAttack;
   422            AfterAttack;
   417            end
   423            end
   418         end else Message:= Message and not gmAttack;
   424         end else Message:= Message and not gmAttack;
   419      end
   425      end;
       
   426      TargetPoint.X := NoPointX
   420 end;
   427 end;
   421 
   428 
   422 procedure AfterAttack;
   429 procedure AfterAttack;
   423 var s: shortstring;
   430 var s: shortstring;
   424     a: TAmmoType;
   431     a: TAmmoType;