# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1536683667 -7200
# Node ID f26c9e931f5a65ff7321aaf1c3946c4eeef1bf8f
# Parent  baf15d31cd42c6e0d5f4b5859ec2c3952f49b4a5
Allow to change volume during pause

diff -r baf15d31cd42 -r f26c9e931f5a ChangeLog.txt
--- a/ChangeLog.txt	Tue Sep 11 17:22:54 2018 +0200
+++ b/ChangeLog.txt	Tue Sep 11 18:34:27 2018 +0200
@@ -9,6 +9,7 @@
  + Increase hedgehog limit to 64
  + Campaigns and missions now use the user's chosen custom clan colors
  + New default brown clan color for better contrast
+ + Allow to change volume during pause
  * Functionality of controllers restored
  * Fix crash when 2 or more controllers were connected
  * Fix hammer and pickhammer not digging correctly at wrap world edge
diff -r baf15d31cd42 -r f26c9e931f5a hedgewars/uGame.pas
--- a/hedgewars/uGame.pas	Tue Sep 11 17:22:54 2018 +0200
+++ b/hedgewars/uGame.pas	Tue Sep 11 18:34:27 2018 +0200
@@ -35,6 +35,37 @@
 var i,j : LongInt;
     s: ansistring;
 begin
+
+inc(SoundTimerTicks, Lag);
+if SoundTimerTicks >= 50 then
+    begin
+    SoundTimerTicks:= 0;
+    if cVolumeDelta <> 0 then
+        begin
+        j:= Volume;
+        i:= ChangeVolume(cVolumeDelta);
+        if (not cIsSoundEnabled) or (isAudioMuted and (j<>i)) then
+            AddCaption(trmsg[sidMute], capcolSetting, capgrpVolume)
+        else if not isAudioMuted then
+            begin
+            s:= ansistring(inttostr(i));
+            AddCaption(FormatA(trmsg[sidVolume], s), capcolSetting, capgrpVolume)
+            end
+        end
+    else if cMuteToggle then
+        begin
+        MuteAudio;
+        if isAudioMuted then
+            AddCaption(trmsg[sidMute], capcolSetting, capgrpVolume)
+        else
+            begin
+            s:= ansistring(inttostr(GetVolumePercent()));
+            AddCaption(FormatA(trmsg[sidVolume], s), capcolSetting, capgrpVolume);
+            end;
+        cMuteToggle:= false;
+        end;
+    end;
+
 if isPaused then
     exit;
 
@@ -78,35 +109,6 @@
 if cTestLua then
     Lag:= High(LongInt);
 
-inc(SoundTimerTicks, Lag);
-if SoundTimerTicks >= 50 then
-    begin
-    SoundTimerTicks:= 0;
-    if cVolumeDelta <> 0 then
-        begin
-        j:= Volume;
-        i:= ChangeVolume(cVolumeDelta);
-        if (not cIsSoundEnabled) or (isAudioMuted and (j<>i)) then
-            AddCaption(trmsg[sidMute], capcolSetting, capgrpVolume)
-        else if not isAudioMuted then
-            begin
-            s:= ansistring(inttostr(i));
-            AddCaption(FormatA(trmsg[sidVolume], s), capcolSetting, capgrpVolume)
-            end
-        end
-    else if cMuteToggle then
-        begin
-        MuteAudio;
-        if isAudioMuted then
-            AddCaption(trmsg[sidMute], capcolSetting, capgrpVolume)
-        else
-            begin
-            s:= ansistring(inttostr(GetVolumePercent()));
-            AddCaption(FormatA(trmsg[sidVolume], s), capcolSetting, capgrpVolume);
-            end;
-        cMuteToggle:= false;
-        end;
-    end;
 PlayNextVoice;
 i:= 1;
 while (GameState <> gsExit) and (i <= Lag) and allOK do