summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaverns4 <Caverns4@users.noreply.github.com>2019-04-13 16:14:44 -0400
committerCaverns4 <Caverns4@users.noreply.github.com>2019-04-13 16:14:44 -0400
commit11b9496022939a5dc7eedca609ccbbdac1da5d01 (patch)
tree17a36f069996b3b75011c135a453e706b1c47742
parente464a87fd9eb6bec712f3c155944706f0f6d0d94 (diff)
Correct index numbers inside the Pokedex according to the oldmode order.
-rw-r--r--Custom-order-for-the-Old-Pokédex-mode.md86
1 files changed, 86 insertions, 0 deletions
diff --git a/Custom-order-for-the-Old-Pokédex-mode.md b/Custom-order-for-the-Old-Pokédex-mode.md
index fd986a5..f92a463 100644
--- a/Custom-order-for-the-Old-Pokédex-mode.md
+++ b/Custom-order-for-the-Old-Pokédex-mode.md
@@ -5,6 +5,7 @@ This tutorial allows you to give the Old Pokédex mode a different order than th
1. [Define the Old Mode order](#1-define-old-pokédex-order)
2. [Edit how Old Mode is implemented](#2-edit-how-old-mode-is-implemented)
+3. [Update the index numbers to reflect the Pokédex order](#3-update-the-index-numbers-to-reflect-the-pokédex-order)
## 1. Define the Old Mode order
@@ -78,3 +79,88 @@ Edit [engine/pokedex/pokedex.asm](../blob/master/engine/pokedex/pokedex.asm):
```
That's it! Now we have two Pokédex modes, Old and New, each with their own custom order that doesn't depend on the internal index order.
+
+##3. Update the index numbers to reflect the Pokédex order
+
+Now you have the old mode Pokédex showing a custom order. However, when you look at the Pokémon's index number both on the dex list, and in their actual dex entry, it still shows the old number. We're going to change that now.
+
+Edit [main.asm](../blob/master/main.asm):
+```diff
+SECTION "bank10", ROMX
+
+INCLUDE "data/moves/moves.asm"
+INCLUDE "engine/pokemon/evolve.asm"
+
+
+SECTION "bank11", ROMX
+
+INCLUDE "engine/events/fruit_trees.asm"
+INCLUDE "engine/battle/ai/move.asm"
+INCLUDE "engine/pokemon/mail.asm"
+INCLUDE "engine/pokedex/pokedex.asm"
+INCLUDE "engine/pokedex/pokedex_2.asm"
+```
+
+There should be plenty of space in that bacnk for both Pokedex ASMs. With this code, as I have it, you'll need to have them in the same bank, so with that done, move on to [engine/pokedex/pokedex.asm](../blob/master/engine/pokedex/pokedex.asm):
+```diff
+Pokedex_PrintNumberIfOldMode:
+ ld a, [wCurDexMode]
+ cp DEXMODE_OLD
+ jr z, .printnum
+ ret
+
+.printnum
+ push hl
+ ld de, -SCREEN_WIDTH
+ add hl, de
+ call Pokedex_GetDexNumber
+ ld de, wc296
+
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 3
+ call PrintNum
+ pop hl
+ ret
+```
+
+And add this code to any safe place in the file. I put it right before OldPokedexOrder:
+
+`Pokedex_GetDexNumber:`
+`; Get the intended number of the selected Pokémon.`
+ `push bc`
+ `push hl ;Store bc and hl to the stack`
+
+ `ld a, [wTempSpecies] ;a = current mon (internal number)`
+ `ld b, a ;b = Needed mon (a and b must be matched)`
+ `ld c, 0 ;c = index`
+ `ld hl,OldPokedexOrder ;hl = OldDexOrder`
+
+`.loop`
+ `inc c`
+ `ld a, [hli] ;save index of hl to a`
+ `cp b ;does a match b?`
+ `jr nz, .loop ;if not, loop`
+ `ld a, c`
+ `ld [wc296], a`
+ `pop hl ;Restore bc and hl in reverse order to keep the stack correct.`
+ `pop bc`
+ `ret`
+
+Before we move on, please note "wc296". This is a point in wRAM where the correct Pokedex number is stored. This variable is read from in some unused code, but never written too or read from otherwise, so it is safe to use in Crystal vanilla.
+
+Edit [pokedex_2.asm](../blob/master/engine/pokedex/pokedex_2.asm):
+```diff
+; Print dex number
+ hlcoord 2, 8
+ ld a, $5c ; No
+ ld [hli], a
+ ld a, $5d ; .
+ ld [hli], a
+ ;ld de, wTempSpecies
+ call Pokedex_GetDexNumber
+ ld de, wc296
+
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 3
+ call PrintNum
+```
+
+Build and test! All Pokemon will now show a correct Pokedex number corresponding to dex_order_old.asm! \ No newline at end of file