From babd86916c00f086e7748356edd26e764d8d5cf9 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 9 Mar 2021 21:49:07 -0800 Subject: [PATCH] Move resumesong assignment to songend() This fixes a bug where the resumemusic() script command would always play MMMMMM track 15 (or, if you're using PPPPPP, just not work). This is because musicclass::haltdasmusik() assigns resumesong AFTER calling Mix_HaltMusic(), but the songend() callback fires before the resumesong assignment, meaning resumesong gets set to -1 instead of whatever currentsong was previously. To fix this, just move the assignment into the callback itself (I don't know why this wasn't done before). I could have moved it to before the Mix_HaltMusic() call, but moving it into the callback itself fixes it for all cases of the music stopping (such as when the music fades out). --- desktop_version/src/Music.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 7121b676..d7b6c52a 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -145,6 +145,7 @@ static void songend(void) { extern musicclass music; music.songEnd = SDL_GetPerformanceCounter(); + music.resumesong = music.currentsong; music.currentsong = -1; } @@ -265,7 +266,6 @@ void musicclass::fadein(void) void musicclass::haltdasmusik(void) { Mix_HaltMusic(); - resumesong = currentsong; } void musicclass::silencedasmusik(void)