hedgewars/HHHandlers.inc
changeset 3302 0973c5af5141
parent 3236 4ab3917d7d44
child 3310 e6e9b811d32f
equal deleted inserted replaced
3301:df0c2a29c3d7 3302:0973c5af5141
   108      begin
   108      begin
   109      if ((State and gstHHDriven) <> 0)and
   109      if ((State and gstHHDriven) <> 0)and
   110         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   110         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   111         (((State and gstMoving) = 0) or
   111         (((State and gstMoving) = 0) or
   112             // Allow attacks while moving on ammo with AltAttack
   112             // Allow attacks while moving on ammo with AltAttack
   113             ((CurAmmoGear <> nil) and ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)) or
   113             ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or
   114             ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0)) and
   114             ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0)) and
   115         ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
   115         ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
   116         begin
   116         begin
   117         State:= State or gstAttacking;
   117         State:= State or gstAttacking;
   118         if Power = cMaxPower then Message:= Message and not gm_Attack
   118         if Power = cMaxPower then Message:= Message and not gm_Attack
   224         Power:= 0;
   224         Power:= 0;
   225         if (CurAmmoGear <> nil)
   225         if (CurAmmoGear <> nil)
   226            and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
   226            and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
   227            begin
   227            begin
   228            CurAmmoGear^.Ammo:= @(Ammo^[CurSlot, CurAmmo]);
   228            CurAmmoGear^.Ammo:= @(Ammo^[CurSlot, CurAmmo]);
       
   229            CurAmmoGear^.AmmoType:= CurAmmoGear^.Ammo^.AmmoType;
   229            Message:= Message or gm_Attack;
   230            Message:= Message or gm_Attack;
   230            CurAmmoGear^.Message:= Message
   231            CurAmmoGear^.Message:= Message
   231            end else begin
   232            end else begin
   232            if not CurrentTeam^.ExtDriven and
   233            if not CurrentTeam^.ExtDriven and
   233              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   234              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   661     if (((Gear^.Message and gm_Attack) <> 0)
   662     if (((Gear^.Message and gm_Attack) <> 0)
   662         or ((Gear^.State and gstAttacking) <> 0)) then
   663         or ((Gear^.State and gstAttacking) <> 0)) then
   663         Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
   664         Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
   664     else
   665     else
   665 else with PHedgehog(Gear^.Hedgehog)^ do
   666 else with PHedgehog(Gear^.Hedgehog)^ do
   666      if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)
   667      if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
   667         and ((Gear^.Message and gm_LJump) <> 0)
   668         and ((Gear^.Message and gm_LJump) <> 0)
   668         and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then
   669         and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then
   669         begin
   670         begin
   670         Gear^.Message:= Gear^.Message and not gm_LJump;
   671         Gear^.Message:= Gear^.Message and not gm_LJump;
   671         Attack(Gear)
   672         Attack(Gear)
   672         end;
   673         end;
   673 
   674 
   674 if (CurAmmoGear = nil)
   675 if (CurAmmoGear = nil)
   675     or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then
   676     or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then
   676     begin
   677     begin
   677     if ((Gear^.Message and gm_Slot) <> 0) then
   678     if ((Gear^.Message and gm_Slot) <> 0) then
   678         begin
   679         begin
   679         ChangeAmmo(Gear);
   680         ChangeAmmo(Gear);
   680         ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)
   681         ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)