hedgewars/uSound.pas
changeset 14703 204fb862d0e4
parent 14619 62dea281e4d5
child 14840 fba15e2f5e5b
--- a/hedgewars/uSound.pas	Tue Feb 05 03:39:03 2019 +0100
+++ b/hedgewars/uSound.pas	Tue Feb 05 04:55:40 2019 +0100
@@ -116,7 +116,7 @@
 // Modifies the sound volume of the game by voldelta and returns the new volume level.
 function  ChangeVolume(voldelta: LongInt): LongInt;
 
-// Returns the current volume in percent
+// Returns the current volume in percent. Intended for display on UI.
 function  GetVolumePercent(): LongInt;
 
 // Returns a pointer to the voicepack with the given name.
@@ -867,6 +867,12 @@
 function GetVolumePercent(): LongInt;
 begin
     GetVolumePercent:= Volume * 100 div MIX_MAX_VOLUME;
+    // 0 and 100 will only be displayed when at min/max values
+    // to avoid confusion.
+    if ((GetVolumePercent = 0) and (Volume > 0)) then
+        GetVolumePercent:= 1
+    else if ((GetVolumePercent = 100) and (Volume < MIX_MAX_VOLUME)) then
+        GetVolumePercent:= 99;
 end;
 
 function ChangeVolume(voldelta: LongInt): LongInt;