Dizzy611 / DancingMadFF6

An MSU-1 modification for Final Fantasy 6
Other
25 stars 1 forks source link

Phantom Train music plays in the scene after you get off the train #74

Closed edale2 closed 6 years ago

edale2 commented 6 years ago

As reported by F-Bomb on Quimm: http://forums.qhimm.com/index.php?topic=16077.msg256337#msg256337

After some testing, I'm 75% certain this is a fading issue.

It might be related to a call to one of the 2 or 3 specially handled phantom train tracks, I think a different track may be called for the "train pulling away from the station" effect.

Dizzy611 commented 6 years ago

Yeah, the train does use different sub tracks, similarly to dancing mad, but there was no way to cleanly handle them given the music we had to hand. That said, I'm pretty sure you're right in that the music continuing to play is in and of itself just a fading issue.

On Wed, Mar 21, 2018 at 6:52 AM, edale2 notifications@github.com wrote:

As reported by F-Bomb on Quimm: http://forums.qhimm.com/index.php?topic=16077.msg256337#msg256337

After some testing, I'm 75% certain this is a fading issue.

It might be related to a call to one of the 2 or 3 specially handled phantom train tracks, I think a different track may be called for the "train pulling away from the station" effect.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Insidious611/DancingMadFF6/issues/74, or mute the thread https://github.com/notifications/unsubscribe-auth/AASag_tw8msmNOuDAeLStQR2wL0t_xZBks5tgjDsgaJpZM4SzWVS .

edale2 commented 6 years ago

The reason I think there's a chance it might not be a fading issue, is when watching the scene in the vanilla ROM, you have (from the train's defeat):

track effects (no music) into silence, with the train pulling into the station/stopping effect into train whistle, Caves of Narshe into train pulling off effect (no music) fade to world-map.

MSU mod:

Phantom Train music into silence, with the train pulling into the station/stopping effect into train whistle, Caves of Narshe into Phantom Train music fade to world-map.

I'd think if it was purely a fading issue, the switch to Caves of Narshe would fix it, because Phantom Train doesn't play at all after that.

What I think might be happening, is the train pulling off effect is linking to the Phantom Train track, rather than the SPC sound effect, causing the song to play when it should be silence with an SFX.

Also noticed while testing, when you get to the engine of the train, before initiating the fight, there's no music, just the track moving effect (I think this starts when the ghost leaves you, but might be from when you exit the engine's switch room), in the MSU-1 mod, Phantom Train track continues until the boss fight starts. This one's not too much of an issue, in my mind, compared to the other one, which is one of the more emotional scenes in the game.

edale2 commented 6 years ago

I'm guessing the track pulling off effect is the same one used at the beginning of the phantom train section of the game, which is where you probably did something to the coding for special handling, and this is a byproduct.

Then again, not sure you did anything to the coding for it, other than the track being listed as special handling in your notes, and not sure if that means by your mod, or by FFVI...

Dizzy611 commented 6 years ago

I just listed that one as potentially problematic in my notes, treat it like any other track, and was waiting to find out how/if it'd break. Kind of surprised I didn't notice this inconsistency myself during my earlier test playthrough. I'm not 100% sure how I'm going to handle this one. This, #73, and good old #38 are likely all going to need me to figure out workarounds for the moment while I try to dive deeper into the games coding as far as subsongs, fading, and volume change.

It is possible, however, that this particular case might be solved with a similar workaround to how dancing mad (the song) works, triggering on the subsong switch command. I would at the very least need PCMs for the train noises in order to set that up though.

edale2 commented 6 years ago

Do you know what track number the different train noises are on? If I get the track numbers, I might be able to rip the SPC train sounds to convert them for testing.

edale2 commented 6 years ago

https://mega.nz/#!PZYzSJ4B!6uOjSFyWoDX76hQDGYtpYgp5au6EwSdusJ_jhd2Rutg

Train pulling away from station effect non-looping, SPC converted to PCM. I normalized it to -6dB, so it should be considerably louder than the actual SPC audio, letting you tell the difference for testing.

Dizzy611 commented 6 years ago

So to answer your earlier question, the train noises are on the same track number as Phantom Train, that's the whole point. :P

They're both hex track 20, decimal track 32. If track $20 is loaded, and SPC command $89 is not called, it plays the train sound on a loop (thus your non-looped version is actually not all that useful except for testing, because it needs to be a loop of just the 'click-clack click-clack'. To see what I mean, go to the save room in the car to the right after you first enter the train, save, reload your save, and don't leave the room. You'll get an infinite loop of the noise.)

Fixing this is going to be much messier than I thought it was going to be

Dizzy611 commented 6 years ago

Okay so, current fix that I'm testing atm is as follows:

Given a memory address labelled "TrainFlag" that starts out set as 0:

When the Phantom Train track is called, default to letting the SPC handle it, unless TrainFlag is 1, in which case we play our MSU-based song.

If SPC command $89 is called with the Phantom Train playing, set TrainFlag to 1, then jump into the MSU code as if we were playing a new track.

From that point onwards, keep TrainFlag at 1 unless another track is called. Not setting it to 0 immediately prevents the game from continually playing SPC train noises due to the fact a "new track" is called on every scene switch. If another track is called for (such as silence, caves of narshe, you name it, anything other than Phantom Train), the MSU code immediately before doing anything else sets TrainFlag to 0, resetting the routine so it can be called again.

Basically, tl;dr, if this works it should replicate Vanilla behavior. I've got it working for resuming a saved game on the train, I'm testing to see how it behaves for the scene after you beat the train.

EDIT: I also need to make it so that TrainFlag isn't cleared if the battle or victory themes are called, otherwise we get infinite train noise after battles.

Dizzy611 commented 6 years ago

HAHA! That worked. I somehow guessed at how to perfectly replicate proper behavior. I was worried it might screw up after the boss battle, but then I realized calling the boss theme is not a normal battle theme, so that clears the flag properly... It now behaves exactly like you described, in chronological order starting from right before hitting the final button to trigger the battle with the train:

MSU Phantom Train (pre-battle) into MSU Decisive Battle (during battle) into MSU Victory theme (battle won) into SPC train noise (talking with train after battle) into silence, train pulling into station/stopping into train whistle, MSU Caves of Narshe into SPC train noise into complete silence fades to world map

Sadly this fix involved changing around my "random SPC command" handling code significantly, so I now need to also test Dancing Mad for regressions to its subsong handling. But the bug itself has now been fixed, afaict!

I don't think we should seek to replace the train noise loop with an MSU-1 track as I had originally intended with the first version of this fix, though I could figure out a way to do so. The reason I say that is that the game appears to slow down and speed up the loop procedurally to produce the necessary "train speeding up/slowing down" effect. IOW, it'd be impossible to synthesize this effect with the MSU-1.

edale2 commented 6 years ago

There's a bit of SPC train noise/PCM audio playing at the same time right when the PCM starts at the beginning of the Phantom Train section. I only really noticed because I'm using the OTH one that I added train sounds to, and it's noticeable that 2 different sets of train sounds are playing.

Other than that, works great.

edale2 commented 6 years ago

This branch has the new fadeout routines in it?

Dizzy611 commented 6 years ago

Not actually fading, but the routine that handles a fadeout as a set-volume-to-0, yes.

On Thu, Apr 19, 2018 at 11:05 PM, edale2 notifications@github.com wrote:

This branch has the new fadeout routines in it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Insidious611/DancingMadFF6/issues/74#issuecomment-382956551, or mute the thread https://github.com/notifications/unsubscribe-auth/AASag9iF8Y3cwc9BZmqASY5__Fok8H-Sks5tqVBugaJpZM4SzWVS .

edale2 commented 6 years ago

Ah, thought it might have had Madsiur's new fading code added in.

I'll get around to testing Dancing Mad probably tomorrow. Someone released a Ys III MSU-1 mod a few days ago, and I've been working on making a PCM pack out of the TGCD soundtrack (they used the Oath in Felghana soundtrack) pretty much all of today.

Finally mostly finished, and need to do a playthrough with just the TGCD tracks, and find out the guy doesn't have any SPC fallback code (not all the TGCD tracks are CD audio)...

edale2 commented 6 years ago

OK, tested Dancing Mad with this version of the patch.

After the 3rd segment ends, the music abruptly cuts off and there's a second or two of silence before the 4th and final part of Dancing Mad starts up.

I'm guessing this is from the fadeout = volume 0 code.

Everything else seems to be working perfectly.

Dizzy611 commented 6 years ago

That's the kind of thing I was expecting from the fadeout workaround, yeah. It's a very heavy-handed "fix".

That said good to see everything else is working.

Dizzy611 commented 6 years ago

I'm going to mark this bug closed for now, as I've confirmed this one is fixed with the current code, and doesn't bother any of the other special case code. If it doesn't fix it for F-Bomb after release, I'll re-open it.