hedgewars/uGearsHedgehog.pas
branchicegun
changeset 8589 3bb505fc707e
parent 8576 286ebfcb3d97
parent 8566 d9627d65edf7
child 8616 c4536e98c712
equal deleted inserted replaced
8588:47084c6fcb4e 8589:3bb505fc707e
    52     begin
    52     begin
    53     HHGear^.Message:= HHGear^.Message and (not gmSlot);
    53     HHGear^.Message:= HHGear^.Message and (not gmSlot);
    54     prevAmmo:= CurAmmoType;
    54     prevAmmo:= CurAmmoType;
    55     ammoidx:= 0;
    55     ammoidx:= 0;
    56     if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0)
    56     if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0)
    57     or ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0))
       
    58     or ((HHGear^.State and gstHHDriven) = 0) then
    57     or ((HHGear^.State and gstHHDriven) = 0) then
    59         exit;
    58         exit;
    60     ChangeAmmo:= true;
    59     ChangeAmmo:= true;
    61 
    60 
    62     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do
    61     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do
    63         inc(ammoidx);
    62         inc(ammoidx);
    64 
    63 
    65     if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then
    64     if (MultiShootAttacks > 0) then
    66         OnUsedAmmo(HHGear^.Hedgehog^);
    65         begin
       
    66         if (CurAmmoType = amSniperRifle) and ((GameFlags and gfArtillery) = 0) then
       
    67             cArtillery := false;
       
    68         OnUsedAmmo(HHGear^.Hedgehog^)
       
    69         end;
    67 
    70 
    68     MultiShootAttacks:= 0;
    71     MultiShootAttacks:= 0;
    69     HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
    72     HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
    70     
    73     
    71     if Ammoz[CurAmmoType].Slot = slot then
    74     if Ammoz[CurAmmoType].Slot = slot then
   457 
   460 
   458             Power:= 0;
   461             Power:= 0;
   459             if (CurAmmoGear <> nil)
   462             if (CurAmmoGear <> nil)
   460                 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
   463                 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
   461                 begin
   464                 begin
   462                 if CurAmmoType = amRope then Message:= Message or gmAttack;
   465                 if CurAmmoType in [amRope,amResurrector] then Message:= Message or gmAttack;
   463                 CurAmmoGear^.Message:= Message
   466                 CurAmmoGear^.Message:= Message
   464                 end
   467                 end
   465             else
   468             else
   466                 begin
   469                 begin
   467                 if not CurrentTeam^.ExtDriven
   470                 if not CurrentTeam^.ExtDriven
  1000 var t: PGear;
  1003 var t: PGear;
  1001     wasJumping: boolean;
  1004     wasJumping: boolean;
  1002     Hedgehog: PHedgehog;
  1005     Hedgehog: PHedgehog;
  1003 begin
  1006 begin
  1004 Hedgehog:= HHGear^.Hedgehog;
  1007 Hedgehog:= HHGear^.Hedgehog;
  1005 // Some weapons, deagle in particular, wouldn't play so nice in infinite attack mode if hogs were still moving.  Most likely scenario
  1008 //if isInMultiShoot and not AllInactive and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) then HHGear^.Message:= HHGear^.Message and not gmAttack;
  1006 // is trying to shoot them twice while rolling.  This is mostly about not wasting ammo, but shouldn't apply to gears not using AmmoShove (portal
  1009 if isInMultiShoot and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) then
  1007 // Should we rethink AmmoShove? Presumably we'd need a way of knowing if current gear had already attacked a gear
  1010     begin
  1008 if isInMultiShoot and not AllInactive and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) then HHGear^.Message:= HHGear^.Message and not gmAttack;
  1011     AllInactive:= true;
  1009 (*
  1012     HHGear^.Message:= 0
  1010 if isInMultiShoot then
  1013     end
  1011     HHGear^.Message:= 0;
  1014 else AllInactive:= false;
  1012 *)
       
  1013 
       
  1014 (*if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then 
       
  1015     AllInactive:= true
       
  1016 else if not isInMultiShoot then
       
  1017    AllInactive:= false;*)
       
  1018  AllInactive:= false;
       
  1019 
  1015 
  1020 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then
  1016 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then
  1021     begin
  1017     begin
  1022     if (Hedgehog^.CurAmmoType = amKnife) then
  1018     if (Hedgehog^.CurAmmoType = amKnife) then
  1023        LoadHedgehogHat(Hedgehog^, Hedgehog^.Hat);
  1019        LoadHedgehogHat(Hedgehog^, Hedgehog^.Hat);
  1130             GHStepTicks:= 95
  1126             GHStepTicks:= 95
  1131         end;
  1127         end;
  1132     exit
  1128     exit
  1133     end;
  1129     end;
  1134 
  1130 
  1135     if Hedgehog^.Gear <> nil then
  1131     if not(isInMultiShoot and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])) and (Hedgehog^.Gear <> nil) then
  1136         begin
  1132         begin
  1137         if GHStepTicks > 0 then
  1133         if GHStepTicks > 0 then
  1138             dec(GHStepTicks);
  1134             dec(GHStepTicks);
  1139         if (GHStepTicks = 0) then
  1135         if (GHStepTicks = 0) then
  1140             HedgehogStep(HHGear)
  1136             HedgehogStep(HHGear)