hedgewars/uGame.pas
branchwebgl
changeset 8833 c13ebed437cb
parent 8446 c18ba8726f5a
parent 8472 da6b569ac930
child 9127 e350500c4edb
--- a/hedgewars/uGame.pas	Wed Feb 20 02:21:58 2013 +0100
+++ b/hedgewars/uGame.pas	Tue Apr 02 21:00:57 2013 +0200
@@ -27,20 +27,24 @@
     implementation
 ////////////////////
 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;
+
 if (not CurrentTeam^.ExtDriven) then
     begin
     NetGetNextCmd; // its for the case of receiving "/say" message
     isInLag:= false;
-    SendKeepAliveMessage(Lag)
+    FlushMessages(Lag)
     end;
+
 if GameType <> gmtRecord then
     begin
     if Lag > 100 then
@@ -61,6 +65,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