hedgewars/uGears.pas
changeset 11916 38fa4583e7f3
parent 11915 16ce211010cf
child 11918 9da78300c5d0
equal deleted inserted replaced
11915:16ce211010cf 11916:38fa4583e7f3
    44 procedure DrawGears;
    44 procedure DrawGears;
    45 procedure FreeGearsList;
    45 procedure FreeGearsList;
    46 procedure AddMiscGears;
    46 procedure AddMiscGears;
    47 procedure AssignHHCoords;
    47 procedure AssignHHCoords;
    48 function  GearByUID(uid : Longword) : PGear;
    48 function  GearByUID(uid : Longword) : PGear;
       
    49 function  IsClockRunning() : boolean;
    49 
    50 
    50 implementation
    51 implementation
    51 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics,
    52 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics,
    52     {$IFDEF USE_TOUCH_INTERFACE}uTouch,{$ENDIF}
    53     {$IFDEF USE_TOUCH_INTERFACE}uTouch,{$ENDIF}
    53     uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables,
    54     uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables,
   442             end
   443             end
   443         end
   444         end
   444     end;
   445     end;
   445 
   446 
   446 if TurnTimeLeft > 0 then
   447 if TurnTimeLeft > 0 then
   447     if CurrentHedgehog^.Gear <> nil then
   448     if IsClockRunning() then
   448         if (((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
   449         //(CurrentHedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])
   449             or (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttacking <> 0)
   450         begin
   450             or ((GameFlags and gfInfAttack) <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttackingInInfAttackMode <> 0))
   451         if (cHedgehogTurnTime >= 10000)
   451             and (not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0))) then
   452         and (not PlacingHogs)
   452             //(CurrentHedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])
   453         and (CurrentHedgehog^.Gear <> nil)
   453                 begin
   454         and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then
   454                 if (cHedgehogTurnTime >= 10000)
   455             if TurnTimeLeft = 5000 then
   455                 and (not PlacingHogs)
   456                 PlaySoundV(sndHurry, CurrentTeam^.voicepack)
   456                 and (CurrentHedgehog^.Gear <> nil)
   457             else if TurnTimeLeft = 4000 then
   457                 and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then
   458                 PlaySound(sndCountdown4)
   458                     if TurnTimeLeft = 5000 then
   459             else if TurnTimeLeft = 3000 then
   459                         PlaySoundV(sndHurry, CurrentTeam^.voicepack)
   460                 PlaySound(sndCountdown3)
   460                     else if TurnTimeLeft = 4000 then
   461             else if TurnTimeLeft = 2000 then
   461                         PlaySound(sndCountdown4)
   462                 PlaySound(sndCountdown2)
   462                     else if TurnTimeLeft = 3000 then
   463             else if TurnTimeLeft = 1000 then
   463                         PlaySound(sndCountdown3)
   464                 PlaySound(sndCountdown1);
   464                     else if TurnTimeLeft = 2000 then
   465         if ReadyTimeLeft > 0 then
   465                         PlaySound(sndCountdown2)
   466             begin
   466                     else if TurnTimeLeft = 1000 then
   467             if (ReadyTimeLeft = 2000) and (LastVoice.snd = sndNone) then
   467                         PlaySound(sndCountdown1);
   468                 AddVoice(sndComeonthen, CurrentTeam^.voicepack);
   468             if ReadyTimeLeft > 0 then
   469             dec(ReadyTimeLeft)
   469                 begin
   470             end
   470                 if (ReadyTimeLeft = 2000) and (LastVoice.snd = sndNone) then
   471         else
   471                     AddVoice(sndComeonthen, CurrentTeam^.voicepack);
   472             dec(TurnTimeLeft)
   472                 dec(ReadyTimeLeft)
   473         end;
   473                 end
       
   474             else
       
   475                 dec(TurnTimeLeft)
       
   476             end;
       
   477 
   474 
   478 if skipFlag then
   475 if skipFlag then
   479     begin
   476     begin
   480     if TagTurnTimeLeft = 0 then
   477     if TagTurnTimeLeft = 0 then
   481         TagTurnTimeLeft:= TurnTimeLeft;
   478         TagTurnTimeLeft:= TurnTimeLeft;
  1055         GearByUID:= gear;
  1052         GearByUID:= gear;
  1056         exit
  1053         exit
  1057         end;
  1054         end;
  1058     gear:= gear^.NextGear
  1055     gear:= gear^.NextGear
  1059     end
  1056     end
       
  1057 end;
       
  1058 
       
  1059 function IsClockRunning() : boolean;
       
  1060 begin
       
  1061     IsClockRunning :=
       
  1062     (CurrentHedgehog^.Gear <> nil)
       
  1063     and (((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
       
  1064     or (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttacking <> 0)
       
  1065     or ((GameFlags and gfInfAttack) <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerWhileAttackingInInfAttackMode <> 0))
       
  1066     and (not(isInMultiShoot and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_DoesntStopTimerInMultiShoot) <> 0)));
  1060 end;
  1067 end;
  1061 
  1068 
  1062 
  1069 
  1063 procedure chSkip(var s: shortstring);
  1070 procedure chSkip(var s: shortstring);
  1064 begin
  1071 begin