ref: 20e7bc3b09da3d5a6349489801b379a326ebb573
parent: 0dd5f7ab7a141698e19078653d89b704993c87ba
author: YamaArashi <shadow962@live.com>
date: Sat Jan 9 18:05:34 EST 2016
pokedex jumptable constants
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -1,3 +1,18 @@
+ const_def
+ const DEXSTATE_MAIN_SCR
+ const DEXSTATE_UPDATE_MAIN_SCR
+ const DEXSTATE_DEX_ENTRY_SCR
+ const DEXSTATE_UPDATE_DEX_ENTRY_SCR
+ const DEXSTATE_REINIT_DEX_ENTRY_SCR
+ const DEXSTATE_SEARCH_SCR
+ const DEXSTATE_UPDATE_SEARCH_SCR
+ const DEXSTATE_OPTION_SCR
+ const DEXSTATE_UPDATE_OPTION_SCR
+ const DEXSTATE_SEARCH_RESULTS_SCR
+ const DEXSTATE_UPDATE_SEARCH_RESULTS_SCR
+ const DEXSTATE_UNOWN_MODE
+ const DEXSTATE_UPDATE_UNOWN_MODE
+ const DEXSTATE_EXIT
Pokedex: ; 40000
@@ -31,7 +46,7 @@
ld a, [wJumptableIndex]
bit 7, a
jr nz, .exit
- call Pokedex_Main
+ call Pokedex_RunJumptable
call DelayFrame
jr .main
@@ -163,7 +178,7 @@
ld [wDexCurrentLocation], a
ret
-Pokedex_Main: ; 4010b
+Pokedex_RunJumptable: ; 4010b
ld a, [wJumptableIndex]
ld hl, .Jumptable
call Pokedex_LoadPointer
@@ -184,7 +199,7 @@
dw Pokedex_UpdateSearchResultsScreen
dw Pokedex_InitUnownMode
dw Pokedex_UpdateUnownMode
- dw Pokedex_CloseDex
+ dw Pokedex_Exit
Pokedex_IncrementDexPointer: ; 40131 (10:4131)
@@ -192,7 +207,7 @@
inc [hl]
ret
-Pokedex_CloseDex: ; 40136 (10:4136)
+Pokedex_Exit: ; 40136 (10:4136)
ld hl, wJumptableIndex
set 7, [hl]
ret
@@ -273,15 +288,15 @@
call Pokedex_GetSelectedMon
call Pokedex_CheckSeen
ret z
- ld a, $2
+ ld a, DEXSTATE_DEX_ENTRY_SCR
ld [wJumptableIndex], a
- ld a, $0
+ ld a, DEXSTATE_MAIN_SCR
ld [wDexEntryPrevJumptableIndex], a
ret
.select
call Pokedex_BlackOutBG
- ld a, $7
+ ld a, DEXSTATE_OPTION_SCR
ld [wJumptableIndex], a
xor a
ld [hSCX], a
@@ -292,7 +307,7 @@
.start
call Pokedex_BlackOutBG
- ld a, $5
+ ld a, DEXSTATE_SEARCH_SCR
ld [wJumptableIndex], a
xor a
ld [hSCX], a
@@ -302,7 +317,7 @@
ret
.b
- ld a, $d
+ ld a, DEXSTATE_EXIT
ld [wJumptableIndex], a
ret
@@ -534,7 +549,7 @@
.return_to_main_screen
call Pokedex_BlackOutBG
- ld a, $0
+ ld a, DEXSTATE_MAIN_SCR
ld [wJumptableIndex], a
ret
@@ -584,13 +599,13 @@
.skip_changing_mode
call Pokedex_BlackOutBG
- ld a, $0
+ ld a, DEXSTATE_MAIN_SCR
ld [wJumptableIndex], a
ret
.MenuAction_UnownMode: ; 4043a (10:443a)
call Pokedex_BlackOutBG
- ld a, $b
+ ld a, DEXSTATE_UNOWN_MODE
ld [wJumptableIndex], a
ret
@@ -636,7 +651,7 @@
.cancel
call Pokedex_BlackOutBG
- ld a, $0
+ ld a, DEXSTATE_MAIN_SCR
ld [wJumptableIndex], a
ret
@@ -688,13 +703,13 @@
ld [wDexListingScrollOffset], a
ld [wDexListingCursor], a
call Pokedex_BlackOutBG
- ld a, $9
+ ld a, DEXSTATE_SEARCH_RESULTS_SCR
ld [wJumptableIndex], a
ret
.MenuAction_Cancel: ; 40501
call Pokedex_BlackOutBG
- ld a, $0
+ ld a, DEXSTATE_MAIN_SCR
ld [wJumptableIndex], a
ret
@@ -755,9 +770,9 @@
call Pokedex_GetSelectedMon
call Pokedex_CheckSeen
ret z
- ld a, $2
+ ld a, DEXSTATE_DEX_ENTRY_SCR
ld [wJumptableIndex], a
- ld a, $9
+ ld a, DEXSTATE_SEARCH_RESULTS_SCR
ld [wDexEntryPrevJumptableIndex], a
ret
@@ -771,7 +786,7 @@
call Pokedex_BlackOutBG
call ClearSprites
call Pokedex_OrderMonsByMode
- ld a, $5
+ ld a, DEXSTATE_SEARCH_SCR
ld [wJumptableIndex], a
xor a
ld [hSCX], a
@@ -803,7 +818,7 @@
.a_b
call Pokedex_BlackOutBG
- ld a, $7
+ ld a, DEXSTATE_OPTION_SCR
ld [wJumptableIndex], a
call DelayFrame
call Pokedex_CheckSGB