hedgewars/uGame.pas
changeset 8471 7681d14b9f01
parent 8204 9a6030d96273
child 8472 da6b569ac930
--- a/hedgewars/uGame.pas	Sat Feb 02 14:33:35 2013 +0100
+++ b/hedgewars/uGame.pas	Tue Feb 05 17:28:12 2013 -0500
@@ -26,12 +26,13 @@
 ////////////////////
     implementation
 ////////////////////
-uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, 
+uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, uLocale, uCaptions,
     uVisualGears, uTypes, uVariables, uCommands, uConsts
     {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF};
 
 procedure DoGameTick(Lag: LongInt);
-var i: LongInt;
+var i,j : LongInt;
+    s: shortstring;
 begin
 if isPaused then
     exit;
@@ -61,6 +62,23 @@
         else if cOnlyStats then
             Lag:= High(LongInt)
     end;
+inc(SoundTimerTicks, Lag);
+if SoundTimerTicks >= 50 then
+    begin
+    SoundTimerTicks:= 0;
+    if cVolumeDelta <> 0 then
+        begin
+        j:= Volume;
+        i:= ChangeVolume(cVolumeDelta);
+        if isAudioMuted and (j<>i) then
+            AddCaption(trmsg[sidMute], cWhiteColor, capgrpVolume)
+        else if not isAudioMuted then
+            begin
+            str(i, s);
+            AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume)
+            end
+        end;
+    end;
 PlayNextVoice;
 i:= 1;
 while (GameState <> gsExit) and (i <= Lag) do