Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
authorWuzzy <Wuzzy2@mail.ru>
Fri, 18 Jan 2019 07:24:39 +0100
changeset 14653 5132548cdb77
parent 14652 92ebe33c5eb6
child 14654 c9d2a5a9f6ba
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug #721)
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Fri Jan 18 00:36:48 2019 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Jan 18 07:24:39 2019 +0100
@@ -5681,7 +5681,12 @@
     HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight));
     HHGear^.State := HHGear^.State or gstNotKickable;
-    Gear^.SoundChannel := LoopSound(sndFlamethrower);
+    (* NOTE: Flamethrower sound is supposed to start instantly (no fade in),
+    but this would cause the game volume to screw up because of a bug in SDL_mixer:
+    https://bugzilla.libsdl.org/show_bug.cgi?id=4205
+    As workaround, a tiny fade-in delay was added.
+    FIXME: Remove the fade-in delay argument when the SDL bug has been fixed. *)
+    Gear^.SoundChannel := LoopSound(sndFlamethrower, 20);
     Gear^.doStep := @doStepFlamethrowerWork
 end;