No problem, dACE!
So, after some thinking and a lot of testing (or vice-versa?) I have discovered that sounds/music with lower ID have priority to play. So the order they are listed in is not by chance. The programmer chose the main themes' (main theme, underworld theme and invincibility theme) square channels to have priority over everything else, but the rest of the songs (triangle and noise) are on the bottom of the list so sfx can play muting those music channels temporarily.
Which got me thinking (unrelated, but it just popped). The whole problem is that the game performs slowly because of the amount of sounds. So, instead of having a big list of sounds couldn't I divide them by groups? So I can have smaller lists and use a smaller compare value from 0x1FB17, effectively increasing the game's performance despite the sound engine's bad programming. Nice! But how?
Here's maybe how: I could make a sound manager to retrieve the correct sound list based on some condition, which is how the sounds would be grouped together. Such conditions could be "sounds that play during the overworld 1", or "sounds that play on cutscene, game over, ending and title screen". So I'd just need to have a ram address keeping track of which sound list is to be used and make sure it's updated on scene transitions, and I'm good to go.
So this may be a good course of action:
- make the lists on a txt to get a practical preview of how fast the game will run afterwards (it's easy to test the performance knowing the bigger list's length)
- find an unused RAM address and use it to make the condition. Test the condition by playing the game and observing the value
- program the manager that redirects the list
Why am I going through all this trouble? Well, it's because just two days ago I have managed to insert FCandChill's song into the game
I was keeping it a secret. He sent me a few more notes (huge help, thanks dude!) and his song in famitracker and I bashed my head on the keyboard real hard and it worked (just kidding, it was actually magic). I even got it to play on the title screen. Yes, I can choose any song to play anywhere now. I have that power.
So... Spoiler again, I have decided to do this:
- play the original main theme on the title screen.
- play FCandChill's song on all three of the overworld 2 areas (those areas that you play on when you warp, except for the darkworld).
- and I'm going to arrange the atari 2600's pitfall II three songs into one to be played on the overworld 1 (yes, I believe there is still enough free space for even that on bank 7). I have found a thread over at the famitracker forums where user rockmanx2002 made a ftm of that game's ost already (it sounds awesome), so I can use that as a base to convert just as I did with FCandChill's song. Nice. I'll credit both him and FCandChill for their songs. So good.
The songs in Super Pitfall only have three channels, and I have already adapted FCandChill's song to use 3 channels instead of his original 4, but now I realize that it really can have all 4 channels. All is needed is the the sound list to be correctly arranged for priorities (and an extra instruction to load that extra channel). So, I plan to make both his song and the new main theme 4 channels.
Phew! I hope the new manager works. If it doesn't, we will still have the new songs, just with the same bad old performance. If I can get it to work though all that will be missing for me to be really happy is to fix the controls.