band-aid fix for the border block glitch #40
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you look through the LoadSAV0 function, you'll notice that it sets bit 7 of wCurMapTileset when the game loads. Why does it do this?
You see, all the current map data is included as part of the save. That means it gets copied into all the right places in wram when the save file loads. When you go from the main title menu and actually enter the map, the game is doing it using the same code as special map entry warp (like when you go through a door). These kinds of warps load all the map data as you would expect.
But wait, didn't I just say that the act of loading the save file already loads the map data? That means it would needlessly get loaded twice! Apparently Gamefreak thought the same thing.
Remember how bit 7of wCurMapTileset is set when the game loads? The function LoadMapHeader actually checks for that bit and clears it. If that bit was detected as set, then the function knows that it is being run upon selecting CONTINUE from the main menu. If so, it skips loading all the map data since it has already been loaded.
This check can be bypassed to make the map header data always load upon continuing the game. Doing so will force the border block to refresh to the correct value.
Changing ret nz here to nop is a change of 1 byte in rom with no shifting of addresses, thus preserving the ability to keep using the same save file.