Curse Of Monkey Island - glitched music transitions

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
Kasenshlogga
Posts: 63
Joined: Thu Jul 18, 2019 1:31 pm

Curse Of Monkey Island - glitched music transitions

Post by Kasenshlogga »

I've just played Curse Of Monkey Island in ScummVM and noticed a few music playback glitches that I don't remember happening in the normal version.

First one is in the beginning right after you shoot the cannon, there should be a small transition track to end that segment, but instread it just abrubtly goes from the cannon music back to the Wally music. A bit later, there is a track plays when you enter the Barbery Coast for the first time, which does play for a few seconds but as opposed to the original game it gets cut short and then plays the regular Barbery Coast music. There might be other instances where "transition" tracks are not played properly or cut short, but those are the first 2 I've noticed.
User avatar
Praetorian
ScummVM Developer
Posts: 787
Joined: Tue May 08, 2007 8:54 am
Location: Greece
Contact:

Re: Curse Of Monkey Island - glitched music transitions

Post by Praetorian »

Kasenshlogga wrote: Tue Jul 05, 2022 12:42 pm I've just played Curse Of Monkey Island in ScummVM and noticed a few music playback glitches that I don't remember happening in the normal version.

First one is in the beginning right after you shoot the cannon, there should be a small transition track to end that segment, but instread it just abrubtly goes from the cannon music back to the Wally music. A bit later, there is a track plays when you enter the Barbery Coast for the first time, which does play for a few seconds but as opposed to the original game it gets cut short and then plays the regular Barbery Coast music. There might be other instances where "transition" tracks are not played properly or cut short, but those are the first 2 I've noticed.
Which version of ScummVM are you testing with?
If you're not on ScummVM 2.6.0 (currently available as Release Candidate from our daily builds), or greater, then please try with that one as well, since this new version has a lot of improvements and changes to the way music is handled for SCUMM games.
Kasenshlogga
Posts: 63
Joined: Thu Jul 18, 2019 1:31 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by Kasenshlogga »

Praetorian wrote: Tue Jul 05, 2022 4:27 pm
Kasenshlogga wrote: Tue Jul 05, 2022 12:42 pm I've just played Curse Of Monkey Island in ScummVM and noticed a few music playback glitches that I don't remember happening in the normal version.

First one is in the beginning right after you shoot the cannon, there should be a small transition track to end that segment, but instread it just abrubtly goes from the cannon music back to the Wally music. A bit later, there is a track plays when you enter the Barbery Coast for the first time, which does play for a few seconds but as opposed to the original game it gets cut short and then plays the regular Barbery Coast music. There might be other instances where "transition" tracks are not played properly or cut short, but those are the first 2 I've noticed.
Which version of ScummVM are you testing with?
If you're not on ScummVM 2.6.0 (currently available as Release Candidate from our daily builds), or greater, then please try with that one as well, since this new version has a lot of improvements and changes to the way music is handled for SCUMM games.
I'm on the 2.7.0git build from yesterday.
AndywinXp
Posts: 27
Joined: Sun Jul 29, 2012 8:15 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by AndywinXp »

Kasenshlogga wrote: Tue Jul 05, 2022 12:42 pm I've just played Curse Of Monkey Island in ScummVM and noticed a few music playback glitches that I don't remember happening in the normal version.

First one is in the beginning right after you shoot the cannon, there should be a small transition track to end that segment, but instread it just abrubtly goes from the cannon music back to the Wally music. A bit later, there is a track plays when you enter the Barbery Coast for the first time, which does play for a few seconds but as opposed to the original game it gets cut short and then plays the regular Barbery Coast music. There might be other instances where "transition" tracks are not played properly or cut short, but those are the first 2 I've noticed.
Hiya! I'm the dev responsible for Curse's audio engine, thanks for bringing these up:
1) I thought it was a glitch myself, when I started work on the engine some years ago! Truth to be told, if you don't perform a perfect score with the cannon minigame, the game (via the scripts, so no intervention from ScummVM) immediately sends a SEQ_NULL message which stops that music track and gets back to the Wally music. Try performing a perfect score and let me know how it went, that's when the transition should happen (and even then, not fully, just a few notes will be played). Another trick to get the game to wait a little bit before cutting off the music when you don't have a perfect score is to constantly move the cannon left and right when you kill the last boat. Anyway, this behavior is exactly what should happen (and it does happen on the original exe, give it a go if you are able to)

2) This one surprises me, as fixing this was my first contribution to ScummVM about two years ago! Are you sure you're not using an older version (i.e. the one included on Steam)? Could you please recheck that? I have tested 2.7.0git and it works as it should on this matter
Kasenshlogga
Posts: 63
Joined: Thu Jul 18, 2019 1:31 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by Kasenshlogga »

AndywinXp wrote: Wed Jul 06, 2022 6:06 am
Kasenshlogga wrote: Tue Jul 05, 2022 12:42 pm I've just played Curse Of Monkey Island in ScummVM and noticed a few music playback glitches that I don't remember happening in the normal version.

First one is in the beginning right after you shoot the cannon, there should be a small transition track to end that segment, but instread it just abrubtly goes from the cannon music back to the Wally music. A bit later, there is a track plays when you enter the Barbery Coast for the first time, which does play for a few seconds but as opposed to the original game it gets cut short and then plays the regular Barbery Coast music. There might be other instances where "transition" tracks are not played properly or cut short, but those are the first 2 I've noticed.
Hiya! I'm the dev responsible for Curse's audio engine, thanks for bringing these up:
1) I thought it was a glitch myself, when I started work on the engine some years ago! Truth to be told, if you don't perform a perfect score with the cannon minigame, the game (via the scripts, so no intervention from ScummVM) immediately sends a SEQ_NULL message which stops that music track and gets back to the Wally music. Try performing a perfect score and let me know how it went, that's when the transition should happen (and even then, not fully, just a few notes will be played). Another trick to get the game to wait a little bit before cutting off the music when you don't have a perfect score is to constantly move the cannon left and right when you kill the last boat. Anyway, this behavior is exactly what should happen (and it does happen on the original exe, give it a go if you are able to)

2) This one surprises me, as fixing this was my first contribution to ScummVM about two years ago! Are you sure you're not using an older version (i.e. the one included on Steam)? Could you please recheck that? I have tested 2.7.0git and it works as it should on this matter
Ok I again downloaded the latest 2.7.0 build and tried it again, strangely enough the Barbery Coast track plays like it should now. Maybe I accidentally launched an older ScummVM build? Anyway, still on the same build, I can only hear like the first 1-2 seconds of the cannon music ending, even with a perfect "score" (I didn't even know that was a thing until you mentioned it lol), while on my virtual Windows 98 machine, I get the full ending like I remember it from back in the day.
AndywinXp
Posts: 27
Joined: Sun Jul 29, 2012 8:15 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by AndywinXp »

[*]
Kasenshlogga wrote: Wed Jul 06, 2022 12:35 pm
Ok I again downloaded the latest 2.7.0 build and tried it again, strangely enough the Barbery Coast track plays like it should now. Maybe I accidentally launched an older ScummVM build? Anyway, still on the same build, I can only hear like the first 1-2 seconds of the cannon music ending, even with a perfect "score" (I didn't even know that was a thing until you mentioned it lol), while on my virtual Windows 98 machine, I get the full ending like I remember it from back in the day.
Thanks for the follow up! I have fired up my Windows Xp virtual machine and the original exe, this is what happens: https://drive.google.com/file/d/1IVwJEf ... sp=sharing

Also, this is what happens on the same situation in ScummVM: https://drive.google.com/file/d/1hjAV7x ... sp=sharing

Both audios length are identical. Here's the relevant script for the game which handles this behavior:

Code: Select all

[0000] (81) beginCutscene([2])
[000B] (7C) stopScript(2007)
[0011] (B2) soundKludge([4097,2110]) // Set the current music sequence to the ending of the cannon music
[0021] (B2) soundKludge([4097,2000]) // Also immediately set the current music sequence to 2000 (alias for null sequence)
...
[003B] (65) if (bitvar655) { // If perfect score...
[0045] (91)   talkActor("/DBGT306/Perfect!",1)
[005D] (69)   wait.waitForMessage()
[005F] (**) }
[005F] (6A) delay(15)
...
[006F] (9D) loadRoom(9) // Reload the hold room...
...
[01C9] (91) talkActor("/CVGT003/Hey!  I'm getting pretty good at this...",1)
[0201] (69) wait.waitForMessage()
...
[0262] (91) talkActor("/CVGT004/Ewww, gross... all the bones and stuff are floating towards the ship.",1)
[02B7] (69) wait.waitForMessage()
...
END
As you can see that's what the game requests to the audio engine.
So, what's going on? Let's give some iMUSE terminology first:
- A state is a normal music track, which can associated to a file (or not, in the case of a null state);
- A sequence is a music track which overrides the current music state, interrupts it, and plays something else which can't be interrupted by a new state, unless the latest sequence being set is the null one; it can refer to a same file used for a state (exactly what happens in our case, the transition is in the same file); the sequence system has a queue which can contain at most two sequences at one time, scheduled to play one after the other.

Now, let's explain what actually happens during those script instructions (I'm reading the disassembled code for the original exe while I'm writing this, which is perfectly mirrored in our implementation):
- During the cannon minigame, state 1104 is playing (the minigame music);
- When the minigame has ended (each ship has been destroyed), set the sequence 2110 (the transition), which overrides the current music, also preventing any other music state from playing until the sequence queue as ended or the null sequence has been added to the queue;
- Immediately add the second sequence to the queue which is exactly the null one!
- What happens now? Well, as long as we're not getting back to the hold room, the transition music will play undisturbed. As a matter of fact, it does play undisturbed while Guybrush mutters "Perfect!"
- ...but as soon as the room is changed, the corresponding state music is played (the Wally one), and seeing that the latest sequence is the null one, it can play with no problems whatsoever, overriding the transition music.

Now, there's a trick to have the transition play for longer and it's just... lowering the text speed :D so that we can stay on that screen for longer after a perfect score, and have the track cut off at a later time, which is probably what you are experiencing on your Windows 98 machine.

EDIT: Another trick (well, not a trick but an intrinsic limitation) is CD speed: loading the hold room surely takes some time if you're playing from CD, so that loading time will reflect on the duration of the transition
Kasenshlogga
Posts: 63
Joined: Thu Jul 18, 2019 1:31 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by Kasenshlogga »

AndywinXp wrote: Wed Jul 06, 2022 4:39 pm EDIT: Another trick (well, not a trick but an intrinsic limitation) is CD speed: loading the hold room surely takes some time if you're playing from CD, so that loading time will reflect on the duration of the transition
That might be why I always remember the track playing to the end on my ancient PC when playing with the original CD-Roms. And on PCEM it's doing that because I'm emulating with a lower CD speed and a pretty low CPU clock. So while technically accurate, I'm pretty sure the transition was intended to play until the end. Maybe a pause can be added to the end of the Cannon minigame, so it will pause just like when playing from a CD? I don't know if this would be worth the effort to fix, though.
AndywinXp
Posts: 27
Joined: Sun Jul 29, 2012 8:15 pm

Re: Curse Of Monkey Island - glitched music transitions

Post by AndywinXp »

Hmm, I'll have to study the feasibility for it, as this kind of hacks usually break other related stuff (also, there's the question about how high the delay should be, given that every computer might perform slightly differently in this case). I'll put this in my backburner list for now.
Post Reply