hedgewars/uGame.pas
changeset 8471 7681d14b9f01
parent 8204 9a6030d96273
child 8472 da6b569ac930
equal deleted inserted replaced
8470:01ddeb241c21 8471:7681d14b9f01
    24 procedure DoGameTick(Lag: LongInt);
    24 procedure DoGameTick(Lag: LongInt);
    25 
    25 
    26 ////////////////////
    26 ////////////////////
    27     implementation
    27     implementation
    28 ////////////////////
    28 ////////////////////
    29 uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, 
    29 uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, uLocale, uCaptions,
    30     uVisualGears, uTypes, uVariables, uCommands, uConsts
    30     uVisualGears, uTypes, uVariables, uCommands, uConsts
    31     {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
    31     {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
    32 
    32 
    33 procedure DoGameTick(Lag: LongInt);
    33 procedure DoGameTick(Lag: LongInt);
    34 var i: LongInt;
    34 var i,j : LongInt;
       
    35     s: shortstring;
    35 begin
    36 begin
    36 if isPaused then
    37 if isPaused then
    37     exit;
    38     exit;
    38 if (not CurrentTeam^.ExtDriven) then
    39 if (not CurrentTeam^.ExtDriven) then
    39     begin
    40     begin
    58             else if i < 8000 then Lag:= Lag*40
    59             else if i < 8000 then Lag:= Lag*40
    59             else Lag:= Lag*80;
    60             else Lag:= Lag*80;
    60             end
    61             end
    61         else if cOnlyStats then
    62         else if cOnlyStats then
    62             Lag:= High(LongInt)
    63             Lag:= High(LongInt)
       
    64     end;
       
    65 inc(SoundTimerTicks, Lag);
       
    66 if SoundTimerTicks >= 50 then
       
    67     begin
       
    68     SoundTimerTicks:= 0;
       
    69     if cVolumeDelta <> 0 then
       
    70         begin
       
    71         j:= Volume;
       
    72         i:= ChangeVolume(cVolumeDelta);
       
    73         if isAudioMuted and (j<>i) then
       
    74             AddCaption(trmsg[sidMute], cWhiteColor, capgrpVolume)
       
    75         else if not isAudioMuted then
       
    76             begin
       
    77             str(i, s);
       
    78             AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume)
       
    79             end
       
    80         end;
    63     end;
    81     end;
    64 PlayNextVoice;
    82 PlayNextVoice;
    65 i:= 1;
    83 i:= 1;
    66 while (GameState <> gsExit) and (i <= Lag) do
    84 while (GameState <> gsExit) and (i <= Lag) do
    67     begin
    85     begin