From: Holger Schemel Date: Wed, 16 Aug 2023 15:16:50 +0000 (+0200) Subject: fixed stopping music if global anim music differs from current music X-Git-Tag: 4.3.7.0~37 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ebd52bd119746407c06131563cc9b5c1b7c3d01d;p=rocksndiamonds.git fixed stopping music if global anim music differs from current music As there is only one single music channel, the following edge case could happen before this commit: The current screen plays music from a global animation, while the next screen plays background music as defined for this screen (as it might happen with two title screens). When going from one screen to the other screen, the global animation music from the first screen is stopped and the background music for the second screen is started. If there is a delay between both screens (typically by fading from one screen to the next one), the first music is stopped and the second music is started shortly after. Everything works as expected. However, if there is no delay between both screens (if fading is disabled by setup menu or by graphics configuration), stopping and starting old and new music happens in the same screen frame. But as global animations (including music) are applied *after* the screen is prepared (also including music), the music for the new screen is started and immediately stopped again by the global animation code, which notices the screen change and stops the global animation for the previous screen (including stopping music for it). This is fixed now by only stoping the global animation's music if it is still the same as the currently playing music (which would not be the case in the edge case described above). --- diff --git a/src/anim.c b/src/anim.c index eff54726..39f7e646 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1082,6 +1082,13 @@ static void StopGlobalAnimMusic(struct GlobalAnimPartControlInfo *part) if (music == MUS_UNDEFINED) return; + char *anim_music = getMusicInfoEntryFilename(music); + char *curr_music = getCurrentlyPlayingMusicFilename(); + + // do not stop music if global anim music differs from current music + if (!strEqual(curr_music, anim_music)) + return; + StopMusic(); #if 0