diff options
-rw-r--r-- | Maps-that-require-Flash.md | 144 |
1 files changed, 25 insertions, 119 deletions
diff --git a/Maps-that-require-Flash.md b/Maps-that-require-Flash.md index f34a0ef..38c267f 100644 --- a/Maps-that-require-Flash.md +++ b/Maps-that-require-Flash.md @@ -1,10 +1,8 @@ This tutorial is for how to edit which maps require FLASH to see in. ## Contents - [Location of original code](#location-of-original-code) -- [0. Understanding the code setup for what needs FLASH](#0-understanding-the-code-setup-for-what-needs-flash) -- [1. Prepping the code for additions](#1-prepping-the-code-for-additions) +- [1. Understanding the code setup for what needs FLASH](#0-understanding-the-code-setup-for-what-needs-flash) - [2. Implementing a map](#2-implementing-a-map) -- [3. Code cleanup](#3-code-cleanup) ## Location of original code @@ -41,7 +39,7 @@ WarpFound2:: ``` -## 0. Understanding the code setup for what needs FLASH +## 1. Understanding the code setup for what needs FLASH What matters to us are the few lines at and after "cp ROCK_TUNNEL_1F" which are shown here below for simplification. ```diff @@ -65,152 +63,60 @@ When entering a new map, this line checks if the new map is ROCK_TUNNEL_1F or mo The next line gives a divergent destination based on if yes/no. "jr" means "Jump to close location". "nz" means "If equals zero", or in other words, "If not RockTunnel", since that is what we checked for. -It translates to "If not ROCK_TUNNEL_1F, then go to the sub-section ".notRockTunnel" +It translates to "If not ROCK_TUNNEL_1F, then skip the next few lines and go to the sub-section ".notRockTunnel" ```diff jr nz, .notRockTunnel ``` -If it is sent to the sub-section ".notRockTunnel", then it jumps (jr) here. -```diff -.notRockTunnel -``` - -Based on if .notRockTunnel or ROCK_TUNNEL_1F, will load 2 separate states. -Below is if it is a normal (no FLASH needed) map. -Nothing fancy, just loads the new map normally. -```diff - call PlayMapChangeSound -``` - -This is if it is meant to load a FLASH-required map. It is what sets up "needs FLASH to see". +If it is yes ROCK_TUNNEL_1F, then it continues down the command list and loads the next 3 lines that have as an effect to create the "FLASH needed" state. ```diff ld a, $06 ld [wMapPalOffset], a call GBFadeOutToBlack ``` -This is the termination of the entire action. -```diff - jr .done -``` - - - -## 1. Prepping the code for additions - -The problem with the original code is how it treats the default and the exception. -Due to the exception being .notRockTunnel, that means the default is Rock Tunnel. Which is fine for only have a single FLASH-required location. But we want more than just that. - -So first we are going to change the code to treat the default state as normal, and the exception to the rule as "needing FLASH". - -The base step is to change the "if, then jump" line. -What this will do is instead of a "not, then jump" we'll have a "yes, then jump" action. -```diff -- jr nz, .notRockTunnel -+ jr n, .yesRockTunnel -``` - -Then we need to rename the jumped to location. -```diff --.notRockTunnel -+.yesRockTunnel -``` - -Next we need to swap what is loaded via the default and the exception. - -Default state: -```diff -- ld a, $06 -- ld [wMapPalOffset], a -- call GBFadeOutToBlack -+ call PlayMapChangeSound -``` -Exception state: +If it is sent to the sub-section ".notRockTunnel", then it jumps (jr) here. ```diff -- call PlayMapChangeSound -+ ld a, $06 -+ ld [wMapPalOffset], a -+ call GBFadeOutToBlack +.notRockTunnel ``` -So what the entire section we changed should look like is the following: +Nothing fancy, just loads PlayMapChangeSound. +Whether iit skips down or continues down both will complete with the last 2 lines. +These are musical notation and completion. ```diff - cp ROCK_TUNNEL_1F -- jr nz, .notRockTunnel ; Old ; If no, then jump to exception -+ jr n, .yesRockTunnel ; New ; If yes, then jump to exception. -- ld a, $06 ; Old Normal ; needs FLASH -- ld [wMapPalOffset], a ; Old Normal ; needs FLASH -- call GBFadeOutToBlack ; Old Normal ; needs FLASH -+ call PlayMapChangeSound ; New Normal ; no FLASH needed --.notRockTunnel -+.yesRockTunnel -- call PlayMapChangeSound ; Old Exception ; no FLASH needed -+ ld a, $06 ; New Exception ; needs FLASH -+ ld [wMapPalOffset], a ; New Exception ; needs FLASH -+ call GBFadeOutToBlack ; New Exception ; needs FLASH + call PlayMapChangeSound jr .done ``` -Having made this change will have no discernible effect in game thus far. -But we'll have prepped the code for easy addition of other maps to require FLASH. - ## 2. Implementing a map -This is the easiest part. +This is the editing part. All we have to do is add in a new "check & jump" to the section. For example, if I wanted to make the Power Plant require FLASH then I would need to create and insert the following. ```diff cp POWER_PLANT ; Checks if POWER_PLANT - jr n, .yesPowerPlant ; If yes, then jump to .yesPowerPlant -.yesPowerPlant - ld a, $06 ; New Exception ; needs FLASH - ld [wMapPalOffset], a ; New Exception ; needs FLASH - call GBFadeOutToBlack ; New Exception ; needs FLASH + jr z, .needsFlash ; If yes, then jump to .needsFlash +.needsFlash ``` -We just have to insert the check after the Rock Tunnel check and the jump location after the .yesRockTunnel location. +We just have to insert the check before the Rock Tunnel check and the jump location after the .needsFlash location. +This applies the FLASH-needed states before it checks for notRockTunnel. -So the end result would be as follows: ```diff - cp ROCK_TUNNEL_1F ; Checks if ROCK_TUNNEL_1F - jr n, .yesRockTunnel ; If yes, then jump to .yesRockTunnel + cp POWER_PLANT ; Checks if POWER_PLANT -+ jr n, .yesPowerPlant ; If yes, then jump to .yesPowerPlant - call PlayMapChangeSound ; New Normal ; no FLASH needed -.yesRockTunnel - ld a, $06 ; New Exception ; needs FLASH - ld [wMapPalOffset], a ; New Exception ; needs FLASH - call GBFadeOutToBlack ; New Exception ; needs FLASH -+.yesPowerPlant -+ ld a, $06 ; New Exception ; needs FLASH -+ ld [wMapPalOffset], a ; New Exception ; needs FLASH -+ call GBFadeOutToBlack ; New Exception ; needs FLASH - jr .done -``` - - -## 3. Code cleanup - -If you plan on adding a significant number of locations, changing a bit might be best to have a cleaner code. Renaming the exception for ease. -```diff ++ jr z, .needsFlash ; If yes, then jump to .needsFlash cp ROCK_TUNNEL_1F ; Checks if ROCK_TUNNEL_1F -- jr nz, .notRockTunnel -+ jr n, .yesFlashNeeded ; New exception name & condition -+ cp POWER_PLANT ; Checks if POWER_PLANT -+ jr n, .yesFlashNeeded ; New exception name & condition -- ld a, $06 -- ld [wMapPalOffset], a -- call GBFadeOutToBlack -+ call PlayMapChangeSound ; New Normal ; no FLASH needed --.notRockTunnel -+.yesFlashNeeded -- call PlayMapChangeSound -+ ld a, $06 ; New Exception ; needs FLASH -+ ld [wMapPalOffset], a ; New Exception ; needs FLASH -+ call GBFadeOutToBlack ; New Exception ; needs FLASH + jr nz, .notRockTunnel ; If not, then jump to .notRockTunnel ++.needsFlash + ld a, $06 ; needs FLASH + ld [wMapPalOffset], a ; needs FLASH + call GBFadeOutToBlack ; needs FLASH +.notRockTunnel ; Jump-to location if skipping apply-FLASH + call PlayMapChangeSound jr .done +``` -Add as many location as you want, with the requirement being, it must be entered from the Overworld.
\ No newline at end of file +Add as many location as you want, with the requirement being, it must be entered from the Overworld. |