hedgewars/HHHandlers.inc
changeset 3966 cbec77b5f706
parent 3965 09eea558ba83
child 3970 0f6e3219c108
equal deleted inserted replaced
3952:d6412423da45 3966:cbec77b5f706
    67         i:= 0;
    67         i:= 0;
    68         repeat
    68         repeat
    69         inc(ammoidx);
    69         inc(ammoidx);
    70         if (ammoidx > cMaxSlotAmmoIndex) then
    70         if (ammoidx > cMaxSlotAmmoIndex) then
    71             begin
    71             begin
    72             ammoidx:= 0;
       
    73             inc(i);
    72             inc(i);
    74             TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
    73             CurAmmoType:= amNothing;
       
    74             ammoidx:= -1;
       
    75             //TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
    75             end;
    76             end;
    76         until (Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)
    77         until ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)) or (i = 1)
    77         end 
    78         end 
    78     else
    79     else
    79         begin
    80         begin
    80         i:= 0;
    81         i:= 0;
    81         // check whether there is ammo in slot
    82         // check whether there is ammo in slot
   265                                Y:= _0;
   266                                Y:= _0;
   266                                FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
   267                                FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
   267                                PauseMusic
   268                                PauseMusic
   268                                end;
   269                                end;
   269                       amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
   270                       amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
       
   271                     amResurrector: CurAmmoGear:= AddGear(hwRound(lx),
       
   272                                            hwRound(ly), gtResurrector, 0, _0,
       
   273                                            _0, 0);
   270                   end;
   274                   end;
   271 
   275 
   272         uStats.AmmoUsed(CurAmmoType);
   276         uStats.AmmoUsed(CurAmmoType);
   273 
   277 
   274         if not (SpeechText = '') then
   278         if not (SpeechText = '') then
   321             begin
   325             begin
   322             isInMultiShoot:= true
   326             isInMultiShoot:= true
   323             end
   327             end
   324         else
   328         else
   325             begin
   329             begin
   326             OnUsedAmmo(CurrentHedgehog^);
       
   327             if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then
   330             if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then
   328                 begin
   331                 begin
   329                 TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn;
   332                 TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn;
   330                 end
   333                 State:= State or gstAttacked
   331             else ApplyAmmoChanges(CurrentHedgehog^);
   334                 end;
       
   335             if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0 then ApplyAmmoChanges(CurrentHedgehog^);
   332             if (GameFlags and gfInfAttack) <> 0 then State:= State or gstAttacked;
   336             if (GameFlags and gfInfAttack) <> 0 then State:= State or gstAttacked;
       
   337             OnUsedAmmo(CurrentHedgehog^)
   333             end;
   338             end;
   334         end
   339         end
   335     else
   340     else
   336         begin
   341         begin
   337         OnUsedAmmo(CurrentHedgehog^);
   342         OnUsedAmmo(CurrentHedgehog^);