I'm having a little bit of trouble understanding the game modes
that relate to the level loading routines, specifically about switching between levels and sublevels. From what I've gathered by looking through all.log, this is the process:
- Mario is in a level (GM 14).
- Mario enters a door or pipe, which freezes all sprites and triggers the Fade to Level game mode (GM 0F).
- The Fade to Level game mode triggers the mosaic effect and then increments the game mode counter to the so-called "Fade to Level (black)" mode (GM 10). I'm not exactly sure what that mode does, but then it transitions into Load Level (GM 11).
- I would assume that this actually loads the level data into RAM, though I'm not exactly sure about the specifics, but it seems relatively straightforward.
- The next mode is Prepare Level (GM 12), which I believe just sets things up and loads sprites, etc. Pretty obvious.
- Finally, there's Level: Fade In (GM 13) which actually fades into the level and starts it up.
Given this information, I wanted to see how quickly I could make a the level transition occur. Basically, which of these steps are required, and which are optional? The first thing I tried was cutting out the Fade to Level game mode and jumping straight to GM 10. This worked, but interestingly enough, it entered the level with the mosaic effect still in play. I assumed this occurs because the next mode was attempting to undo the effect that was no longer being applied, so I tried skipping Fade to Level (black) as well, just to see what would happen. Interestingly enough, I still saw no difference between skipping GM 0F and skipping GM 10. Still not sure what Fade to Level (black) actually does.
Obviously, skipping subsequent modes causes the game to glitch out a little bit, even if you're reloading the same level. However, I'm interested in that latter case, the case in which you're simply reloading the same level.
Why does Load Level need to be called again if the target level is the same as the one you're currently in? The game appears to fail to reset sprites' positions if Load Level is skipped, which means my earlier analysis was partially wrong, and the background graphics get garbled as well, which I don't really understand.
Any ideas? Are any of these at all documented?