Wargus / wargus

Importer and scripts for Warcraft II: Tides of Darkness, the expansion Beyond the Dark Portal, and Aleonas Tales
GNU General Public License v2.0
357 stars 55 forks source link

Game music is all over the place in latest release #345

Closed DinkyDyeAussie closed 2 years ago

DinkyDyeAussie commented 3 years ago

All the music files have been extracted, but the Briefing music isn't the right track - always something random that ends up being the first track played once you start actually playing the game. Same with the Victory/Defeat screen music too - always random.

What file can I edit to make this work like it should again? Code or Lua. Just tell me.

timfel commented 3 years ago

This is all done in Lua

timfel commented 2 years ago

Argh, this is a bug I introduced with the new sound backend. I'll put the diff that fixes it here for later:

modified   src/sound/music.cpp
@@ -51,7 +51,7 @@
 -- Variables
 ----------------------------------------------------------------------------*/

-static volatile bool MusicFinished;       /// Music ended and we need a new file
+volatile bool MusicFinished;       /// Music ended and we need a new file

 bool CallbackMusic;                       /// flag true callback ccl if stops

modified   src/sound/sound_server.cpp
@@ -60,6 +60,8 @@ static bool EffectsEnabled = true;
 static double VolumeScale = 1.0;
 static int MusicVolume = 0;

+extern volatile bool MusicFinished;
+
 /// Channels for sound effects and unit speech
 struct SoundChannel {
    Origin *Unit;          /// pointer to unit, who plays the sound, if any
@@ -346,6 +348,7 @@ int PlayMusic(Mix_Music *sample)
 {
    if (sample) {
        Mix_VolumeMusic(MusicVolume);
+       MusicFinished = false;
        Mix_PlayMusic(sample, 0);
        Mix_VolumeMusic(MusicVolume / 4.0);
        return 0;
@@ -371,6 +374,7 @@ int PlayMusic(const std::string &file)
    Mix_Music *music = LoadMusic(file);

    if (music) {
+       MusicFinished = false;
        Mix_FadeInMusic(music, 0, 200);
        return 0;
    } else {
DinkyDyeAussie commented 2 years ago

Thanks @timfel. I've noticed this too.

timfel commented 2 years ago

@DinkyDyeAussie I'm planning to take a week around new year to fix a bunch of these issues and then do a new release

DinkyDyeAussie commented 2 years ago

Sweet mate looking forward to it!