Ensure all fade-ins start from zero

This fixes a bug where fading music in but not going through the
music.play() path wouldn't start the fade volume from zero. If this
happened, then the previous volume would persist, and if the previous
volume was the max volume, then that essentially canceled out the
fade-in and prevented it from happening at all. But now all paths to
fadeMusicVolumeIn() set the volume to zero first, instead of only the
caller of music.play().
This commit is contained in:
Misa authored and Ethan Lee committed 2021-04-12 16:17:31 -04:00
1 parent f6919981e5
commit 27d0b1a1d4
1 file changed
+4 -1
+4 -1
View File
@@ -238,7 +238,6 @@ void musicclass::play(int t)
else
{
fadeMusicVolumeIn(3000);
musicVolume = 0;
}
}
}
@@ -290,6 +289,10 @@ void musicclass::fadeMusicVolumeIn(int ms)
{
m_doFadeInVol = true;
m_doFadeOutVol = false;
/* Ensure it starts at 0 */
musicVolume = 0;
setfadeamount(ms);
}