Allow to change volume during pause
authorWuzzy <Wuzzy2@mail.ru>
Tue, 11 Sep 2018 18:34:27 +0200
changeset 13800 f26c9e931f5a
parent 13799 baf15d31cd42
child 13803 effef930bd57
Allow to change volume during pause
ChangeLog.txt
hedgewars/uGame.pas
--- 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
--- 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