OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Music pause/resume restores the previously playing track #148

Closed pedro-w closed 2 years ago

pedro-w commented 2 years ago

Re-establishes the behaviour that:

Music.pause_music();
Music.play_music(...);
Music.resume_music();

will resume the music playing before pause_music was called. This is used in battles. Note that it is intended that the music resumes from where it was paused but SDL2 mixer doesn't implement Mix_GetMusicPosition for all music file types. In these cases it'll start from the beginning.

Fixes #143

OnlineCop commented 1 year ago

Wow, sorry for the 1-month delay in reviewing this PR. Life happened.

The original PR for this was deleted, but when I re-implemented your work, I've been getting a -1.0 from the Mix_GetMusicPosition() call for the overworld (waterw.xm) and Orc Camp (land.mod) songs, so my overworld theme music doesn't appear to allow resuming.

This is using SDL2_mixer (with libmodplug plugin) v2.6.1 and libmodplug version 0.8.9.0, which are the latest available for me on Windows via vcpkg. If you're using v2.6.2 or later, and you've been able to get it to resume, then this looks fine to me to merge in.