hedgewars/HHHandlers.inc
changeset 3842 fc94291ca1d9
parent 3837 47a623d9cdaa
child 3851 fbe2e9722fc9
equal deleted inserted replaced
3841:4fe0427855be 3842:fc94291ca1d9
    41 end;
    41 end;
    42 
    42 
    43 // Shouldn't more of this ammo switching stuff be moved to uAmmos ?
    43 // Shouldn't more of this ammo switching stuff be moved to uAmmos ?
    44 procedure ChangeAmmo(Gear: PGear);
    44 procedure ChangeAmmo(Gear: PGear);
    45 var slot, ammoidx, i: Longword;
    45 var slot, ammoidx, i: Longword;
    46     CurWeapon: PAmmo;
       
    47 begin
    46 begin
    48 slot:= Gear^.MsgParam;
    47 slot:= Gear^.MsgParam;
    49 
    48 
    50 with PHedgehog(Gear^.Hedgehog)^ do
    49 with PHedgehog(Gear^.Hedgehog)^ do
    51     begin
    50     begin
    52     Gear^.Message:= Gear^.Message and not gm_Slot;
    51     Gear^.Message:= Gear^.Message and not gm_Slot;
    53     ammoidx:= 0;
    52     ammoidx:= 0;
    54     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx);
    53     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx);
    55     CurWeapon:= @Ammo^[slot, ammoidx];
       
    56 
    54 
    57     if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or
    55     if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or
    58        ((MultiShootAttacks > 0) and ((CurWeapon^.Propz and ammoprop_NoRoundEndHint) = 0)) or
    56        ((MultiShootAttacks > 0) and (CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0)) or
    59        ((Gear^.State and gstHHDriven) = 0) then exit;
    57        ((Gear^.State and gstHHDriven) = 0) then exit;
    60 
    58 
    61     if ((CurWeapon^.Propz and ammoprop_NoRoundEndHint) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^);
    59     if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^);
    62 
    60 
    63     MultiShootAttacks:= 0;
    61     MultiShootAttacks:= 0;
    64     Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
    62     Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
    65     
    63     
    66     if Ammoz[CurAmmoType].Slot = slot then
    64     if Ammoz[CurAmmoType].Slot = slot then
   772             Gear^.Message:= Gear^.Message and not gm_LJump;
   770             Gear^.Message:= Gear^.Message and not gm_LJump;
   773             Attack(Gear)
   771             Attack(Gear)
   774             end;
   772             end;
   775 
   773 
   776 if (CurAmmoGear = nil)
   774 if (CurAmmoGear = nil)
   777     or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then
   775     or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) 
       
   776     or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) then
   778     begin
   777     begin
   779     if ((Gear^.Message and gm_Slot) <> 0) then
   778     if ((Gear^.Message and gm_Slot) <> 0) then
   780         begin
   779         begin
   781         ChangeAmmo(Gear);
   780         ChangeAmmo(Gear);
   782         ApplyAmmoChanges(Hedgehog^)
   781         ApplyAmmoChanges(Hedgehog^)