ref: d9c5c2c55ba1ae2a1697e90a58a52050317e6e6d
parent: 5097747404dedd617a9a41a8e6f4cb105ea0240b
author: yenatch <[email protected]>
date: Sat Apr 12 11:45:19 EDT 2014
Boxes, trading, assorted incbins.
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -3,6 +3,9 @@
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
+; boxes
+NUM_BOXES EQU 14
+
; predefs
PREDEF_FLAG EQU $03
--- a/main.asm
+++ b/main.asm
@@ -3884,7 +3884,7 @@
call Function5ca1
xor a
- ld [$db72], a
+ ld [wCurBox], a
ld [$d4b4], a
call Function5ca6
@@ -11648,8 +11648,8 @@
ret z
dec [hl]
ld a, [hl]
- ld hl, $54f2
- rst $28
+ ld hl, Jumptable_d4f2
+ rst JumpTable
ret
; no known jump sources
@@ -13024,7 +13024,7 @@
Functiondd21: ; dd21
ld a, [BreedMon1Species]
ld [CurPartySpecies], a
- ld de, $0022
+ ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call Functione698
@@ -13040,7 +13040,7 @@
Functiondd42: ; dd42
ld a, [BreedMon2Species]
ld [CurPartySpecies], a
- ld de, $0022
+ ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call Functione6b3
@@ -14355,7 +14355,7 @@
; e5d9
Functione5d9: ; e5d9
- ld a, [$db72]
+ ld a, [wCurBox]
cp b
jr z, .asm_e5f1
ld a, b
@@ -16067,7 +16067,7 @@
ld [$cf63], a
ld [$cf64], a
push de
- ld de, $62
+ ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
@@ -16077,7 +16077,7 @@
ld [$cf63], a
ld [$cf64], a
push de
- ld de, $62
+ ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
@@ -16099,9 +16099,9 @@
ret
.asm_1093d
callba Function2490c
- ld de, $20
+ ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
- ld de, $20
+ ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
.asm_1094f
xor a
@@ -24387,7 +24387,7 @@
call Function14e0c
pop de
ld a, e
- ld [$db72], a
+ ld [wCurBox], a
call Function15021
call Function14be6
call Function14b5a
@@ -24415,7 +24415,7 @@
call Function14e0c
pop de
ld a, e
- ld [$db72], a
+ ld [wCurBox], a
call Function15021
call Function14b5a
ret
@@ -24427,7 +24427,7 @@
call Function14e0c
pop de
ld a, e
- ld [$db72], a
+ ld [wCurBox], a
ld a, $1
ld [$cfcd], a
callba Function14056
@@ -24588,7 +24588,7 @@
call PrintText
pop af
ld [Options], a
- ld de, $0025
+ ld de, SFX_SAVE
call WaitPlaySFX
call WaitSFX
ld c, $1e
@@ -25231,11 +25231,11 @@
Function150d8: ; 150d8
- ld a, [$db72]
- cp $e
+ ld a, [wCurBox]
+ cp NUM_BOXES
jr c, .asm_150e3
xor a
- ld [$db72], a
+ ld [wCurBox], a
.asm_150e3
ld e, a
@@ -26365,8 +26365,7 @@
db %10100000 ; bit7
db 0 ; # items?
dw .KrissPCMenuList1
- db $8d
- db $1f
+ dw Function1f8d
dw .KrissPCMenuPointers
.KrissPCMenuPointers ; 0x15746
@@ -38824,7 +38823,7 @@
Function2926d: ; 2926d
call Function29114
- ld de, $00b7
+ ld de, SFX_GIVE_TRADEMON
call PlaySFX
ret
; 29277
@@ -38831,7 +38830,7 @@
Function29277: ; 29277
call Function29114
- ld de, $00b8
+ ld de, SFX_GET_TRADEMON
call PlaySFX
ret
; 29281
@@ -38969,7 +38968,7 @@
call DmgToCgbBGPals
ld de, $e4e4
call DmgToCgbObjPals
- ld de, $0004
+ ld de, SFX_POTION
call PlaySFX
call Function2910f
ret
@@ -39405,7 +39404,7 @@
call Function29114
ld a, $10
ld [$cf64], a
- ld de, $0029
+ ld de, SFX_BALL_POOF
call PlaySFX
ret
; 29660
@@ -39881,7 +39880,7 @@
ld a, [hli]
cp $ff
jr z, .asm_29c0c
- cp $98
+ cp 151 + 1
jr nc, .asm_29c42
dec b
jr nz, .asm_29c00
@@ -39909,7 +39908,7 @@
ld c, $4
.asm_29c30
ld a, [hli]
- cp $a6
+ cp STRUGGLE + 1
jr nc, .asm_29c4c
dec c
jr nz, .asm_29c30
@@ -50883,7 +50882,7 @@
ld [hli], a
dec b
jr nz, .asm_48c76
- ld hl, $455b
+ ld hl, Aichi
ld a, c
call GetNthString
.asm_48c81
@@ -51085,9 +51084,9 @@
call Function48e64
call Function3200
call Function32f9
- ld hl, $4e0f
+ ld hl, UnknownText_0x48e0f
call PrintText
- ld hl, $4dfc
+ ld hl, Unknown_48dfc
call LoadMenuDataHeader
call Function3200
call Function1d81
@@ -51100,8 +51099,15 @@
ret
; 48dfc (12:4dfc)
-INCBIN "baserom.gbc",$48dfc,$48e14 - $48dfc
+Unknown_48dfc: ; 48dfc
+INCBIN "baserom.gbc", $48dfc, $48e0f - $48dfc
+UnknownText_0x48e0f: ; 0x48e0f
+ ; Are you a boy? Or are you a girl?
+ text_jump UnknownText_0x1c0ca3
+ db "@"
+; 0x48e14
+
; known jump sources: 48dcb (12:4dcb)
Function48e14: ; 48e14 (12:4e14)
ld a, $10
@@ -51231,7 +51237,7 @@
; 492b9
Function492b9: ; 492b9
- ld hl, $530a
+ ld hl, Unknown_4930a
call LoadMenuDataHeader
ld a, $e
call Predef
@@ -51247,8 +51253,8 @@
ld de, SFX_WRONG
call PlaySFX
pop de
- ld a, $b
- ld hl, $48ce
+ ld a, BANK(UnknownText_0x2c8ce)
+ ld hl, UnknownText_0x2c8ce
call FarPrintText
jr .asm_49300
@@ -51275,6 +51281,7 @@
ret
; 4930a
+Unknown_4930a: ; 4930a
INCBIN "baserom.gbc",$4930a,$4930f - $4930a
; known jump sources: 480a0 (12:40a0), 48690 (12:4690)
@@ -51288,20 +51295,25 @@
callba Function9673
pop af
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
- ld de, $5330
+ ld de, Jumptable_49330
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, $532f
+ ld de, .done
push de
jp [hl]
+.done
ret
; 49330 (12:5330)
-INCBIN "baserom.gbc",$49330,$49336 - $49330
+Jumptable_49330: ; 49330
+ dw Function4936e
+ dw Function4942f
+ dw Function49706
+; 49336
Function49336: ; 49336
.asm_49336
@@ -51332,14 +51344,14 @@
; known jump sources: 4936e (12:536e), 4a0af (12:60af)
Function49351: ; 49351 (12:5351)
ld de, Unkn1Pals ; $d000
- ld hl, $53e1
+ ld hl, Palette_493e1
ld bc, $28
- ld a, $5
+ ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
- ld de, $d038
- ld hl, $5418
+ ld de, Unkn1Pals + $38
+ ld hl, Palette_49418
ld bc, $8
- ld a, $5
+ ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
ret
@@ -51391,11 +51403,36 @@
ret
; 493e1 (12:53e1)
-INCBIN "baserom.gbc",$493e1,$49409 - $493e1
+Palette_493e1: ; 493e1
+ RGB 03, 07, 09
+ RGB 26, 31, 00
+ RGB 20, 16, 03
+ RGB 31, 31, 31
+ RGB 13, 24, 29
+ RGB 11, 16, 30
+ RGB 07, 11, 22
+ RGB 05, 06, 18
+ RGB 31, 31, 31
+ RGB 20, 26, 31
+ RGB 13, 24, 29
+ RGB 11, 16, 30
+
+ RGB 31, 31, 31
+ RGB 20, 26, 31
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 20, 16, 08
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+; 49409
+
+
Function49409:: ; 49409
- ld hl, $5418
+ ld hl, Palette_49418
ld de, $d038
ld bc, $0008
ld a, $5
@@ -51403,20 +51440,89 @@
ret
; 49418
-INCBIN "baserom.gbc",$49418,$49420 - $49418
+Palette_49418: ; 49418
+ RGB 31, 31, 31
+ RGB 08, 19, 28
+ RGB 05, 05, 16
+ RGB 00, 00, 00
+; 49420
; no known jump sources
Function49420:: ; 49420 (12:5420)
- ld hl, $56bd
- ld de, $d030
+ ld hl, Palette_496bd
+ ld de, Unkn1Pals + $30
ld bc, $8
- ld a, $5
+ ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
ret
; 4942f (12:542f)
-INCBIN "baserom.gbc",$4942f,$494ac - $4942f
+Function4942f: ; 4942f
+ call Function49351
+ ld de, Unkn1Pals + $38
+ ld hl, Palette_49478
+ ld bc, $8
+ ld a, $5 ; BANK(Unkn1Pals)
+ call FarCopyWRAM
+ call Function49346
+ ld hl, AttrMap
+ ld bc, $0168
+ xor a
+ call ByteFill
+ ld hl, $cef1
+ ld bc, $0050
+ ld a, $7
+ call ByteFill
+ ld a, [DefaultFlypoint]
+ bit 6, a
+ jr z, .asm_49464
+ call Function49480
+ jr .asm_49467
+.asm_49464
+ call Function49496
+
+.asm_49467
+ callba Function96b3
+ callba Function96a4
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 49478
+
+Palette_49478: ; 49478
+ RGB 31, 31, 31
+ RGB 26, 31, 00
+ RGB 20, 16, 03
+ RGB 00, 00, 00
+; 49480
+
+Function49480: ; 49480
+ ld hl, AttrMap
+ ld bc, $0414
+ ld a, $7
+ call Function49336
+ ld hl, $ce01
+ ld a, $4
+ ld [hl], a
+ ld hl, $ce14
+ ld [hl], a
+ ret
+; 49496
+
+Function49496: ; 49496
+ ld hl, AttrMap
+ ld bc, $0214
+ ld a, $7
+ call Function49336
+ ld hl, $cded
+ ld a, $4
+ ld [hl], a
+ ld hl, $ce00
+ ld [hl], a
+ ret
+; 494ac
+
Function494ac: ; 494ac
ld a, [$d199]
cp $15
@@ -51475,84 +51581,422 @@
Function494f2: ; 494f2
ld a, $5
ld de, Unkn1Pals
- ld hl, $5501
+ ld hl, Palette_49501
ld bc, $0040
call FarCopyWRAM
ret
; 49501
-INCBIN "baserom.gbc",$49501,$49541 - $49501
+Palette_49501: ; 49501
+ RGB 30, 28, 26
+ RGB 19, 19, 19
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 18, 24, 09
+ RGB 15, 20, 01
+ RGB 09, 13, 00
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 17, 19, 31
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+
+ RGB 31, 26, 21
+ RGB 31, 20, 01
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+
+ RGB 21, 17, 07
+ RGB 17, 19, 31
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+ RGB 05, 05, 16
+ RGB 08, 19, 28
+ RGB 00, 00, 00
+ RGB 31, 31, 31
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 49541
+
Function49541: ; 49541
ld a, $5
ld de, Unkn1Pals
- ld hl, $5550
+ ld hl, Palette_49550
ld bc, $0040
call FarCopyWRAM
ret
; 49550
-INCBIN "baserom.gbc",$49550,$49590 - $49550
+Palette_49550: ; 49550
+ RGB 30, 28, 26
+ RGB 19, 19, 19
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 18, 24, 09
+ RGB 15, 20, 01
+ RGB 09, 13, 00
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 15, 16, 31
+ RGB 09, 09, 31
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 07, 07, 07
+
+ RGB 26, 24, 17
+ RGB 21, 17, 07
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+ RGB 05, 05, 16
+ RGB 08, 19, 28
+ RGB 00, 00, 00
+ RGB 31, 31, 31
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 49590
+
Function49590: ; 49590
ld a, $5
ld de, Unkn1Pals
- ld hl, $559f
+ ld hl, Palette_4959f
ld bc, $0040
call FarCopyWRAM
ret
; 4959f
-INCBIN "baserom.gbc",$4959f,$495df - $4959f
+Palette_4959f: ; 4959f
+ RGB 15, 14, 24
+ RGB 11, 11, 19
+ RGB 07, 07, 12
+ RGB 00, 00, 00
+ RGB 15, 14, 24
+ RGB 14, 07, 17
+ RGB 13, 00, 08
+ RGB 00, 00, 00
+
+ RGB 22, 29, 31
+ RGB 10, 27, 31
+ RGB 31, 31, 31
+ RGB 05, 00, 09
+
+ RGB 15, 14, 24
+ RGB 05, 05, 17
+ RGB 03, 03, 10
+ RGB 00, 00, 00
+
+ RGB 30, 30, 11
+ RGB 16, 14, 18
+ RGB 16, 14, 10
+ RGB 00, 00, 00
+
+ RGB 15, 14, 24
+ RGB 12, 09, 15
+ RGB 08, 04, 05
+ RGB 00, 00, 00
+
+ RGB 25, 31, 31
+ RGB 09, 28, 31
+ RGB 16, 11, 31
+ RGB 05, 00, 09
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 495df
+
Function495df: ; 495df
ld a, $5
ld de, Unkn1Pals
- ld hl, $55ee
+ ld hl, Palette_495ee
ld bc, $0040
call FarCopyWRAM
ret
; 495ee
-INCBIN "baserom.gbc",$495ee,$4962e - $495ee
+Palette_495ee: ; 495ee
+ RGB 30, 28, 26
+ RGB 19, 19, 19
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 15, 20, 01
+ RGB 09, 13, 00
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 15, 16, 31
+ RGB 09, 09, 31
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 07, 07, 07
+
+ RGB 26, 24, 17
+ RGB 21, 17, 07
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 4962e
+
Function4962e: ; 4962e
ld a, $5
ld de, Unkn1Pals
- ld hl, $563d
+ ld hl, Palette_4963d
ld bc, $0040
call FarCopyWRAM
ret
; 4963d
-INCBIN "baserom.gbc",$4963d,$496c5 - $4963d
+Palette_4963d: ; 4963d
+ RGB 27, 31, 27
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+ RGB 27, 31, 27
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 08, 12, 31
+ RGB 12, 25, 01
+ RGB 05, 14, 00
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 08, 12, 31
+ RGB 01, 04, 31
+ RGB 07, 07, 07
+
+ RGB 27, 31, 27
+ RGB 12, 25, 01
+ RGB 05, 14, 00
+ RGB 07, 07, 07
+
+ RGB 27, 31, 27
+ RGB 24, 18, 07
+ RGB 20, 15, 03
+ RGB 07, 07, 07
+
+ RGB 27, 31, 27
+ RGB 15, 31, 31
+ RGB 05, 17, 31
+ RGB 07, 07, 07
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 4967d
+
+Palette_4967d: ; 4967d
+ RGB 30, 28, 26
+ RGB 19, 19, 19
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 18, 24, 09
+ RGB 15, 20, 01
+ RGB 09, 13, 00
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 15, 16, 31
+ RGB 09, 09, 31
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 07, 07, 07
+
+ RGB 26, 24, 17
+ RGB 21, 17, 07
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+Palette_496ad: ; 496ad
+ RGB 30, 28, 26
+ RGB 17, 19, 31
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 496bd
+
+Palette_496bd: ; 496bd
+ RGB 05, 05, 16
+ RGB 08, 19, 28
+ RGB 00, 00, 00
+ RGB 31, 31, 31
+; 496c5
+
Function496c5: ; 496c5
ld a, $5
ld de, Unkn1Pals
- ld hl, $567d
+ ld hl, Palette_4967d
ld bc, $0040
call FarCopyWRAM
ld a, $5
ld de, $d020
- ld hl, $56fe
+ ld hl, Palette_496fe
ld bc, $0008
call FarCopyWRAM
ld a, $5
ld de, $d018
- ld hl, $56ad
+ ld hl, Palette_496ad
ld bc, $0008
call FarCopyWRAM
ld a, $5
ld de, $d030
- ld hl, $56bd
+ ld hl, Palette_496bd
ld bc, $0008
call FarCopyWRAM
ret
; 496fe
-INCBIN "baserom.gbc",$496fe,$49797 - $496fe
+Palette_496fe: ; 496fe
+ RGB 25, 24, 23
+ RGB 20, 19, 19
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+; 49706
+Function49706: ; 49706
+ ld hl, Palette_49732
+ ld de, Unkn1Pals
+ ld bc, $0008
+ ld a, $5
+ call FarCopyWRAM
+ callba Function96a4
+ call Function49346
+ callba Function96b3
+ ld hl, Palette_4973a
+ ld de, Unkn2Pals
+ ld bc, $0008
+ ld a, $5
+ call FarCopyWRAM
+ ret
+; 49732
+
+Palette_49732: ; 49732
+ RGB 31, 31, 31
+ RGB 23, 16, 07
+ RGB 23, 07, 07
+ RGB 03, 07, 20
+; 4973a
+
+Palette_4973a: ; 4973a
+ RGB 00, 00, 00
+ RGB 07, 05, 31
+ RGB 14, 18, 31
+ RGB 31, 31, 31
+; 49742
+
+Function49742: ; 49742
+ ld hl, Palette_49757
+ ld de, Unkn1Pals
+ ld bc, $0040
+ ld a, $5
+ call FarCopyWRAM
+ callba Function96a4
+ ret
+; 49757
+
+Palette_49757: ; 49757
+ RGB 31, 31, 63
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 63
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 31, 00, 00
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 30, 16, 26
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 16, 16, 16
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 31, 12, 12
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 07, 08, 31
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 29, 28, 09
+ RGB 31, 31, 31
+; 49797
+
Function49797: ; 49797
ld hl, AttrMap
ld bc, $1002
@@ -51606,7 +52050,7 @@
; 49811
Function49811: ; 49811
- ld hl, $5826
+ ld hl, Palette_49826
ld de, $d010
ld bc, $0030
ld a, $5
@@ -51615,8 +52059,38 @@
ret
; 49826
-INCBIN "baserom.gbc",$49826,$49856 - $49826
+Palette_49826: ; 49826
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 31, 00, 00
+ RGB 31, 31, 31
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 15, 23, 30
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 16, 16, 16
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 25, 07, 04
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 03, 22, 08
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 29, 28, 09
+ RGB 31, 31, 31
+; 49856
+
Function49856: ; 49856
call Function49797
ret
@@ -51694,13 +52168,13 @@
Function49912: ; 49912
callba Function8cf53
- ld de, $5962
+ ld de, SpecialCelebiLeafGFX
ld hl, VTiles1
- ld bc, $1204
+ lb bc, BANK(SpecialCelebiLeafGFX), 4
call Request2bpp
- ld de, $59a2
+ ld de, SpecialCelebiGFX
ld hl, $8840
- ld bc, $1210
+ lb bc, BANK(SpecialCelebiGFX), $10
call Request2bpp
xor a
ld [$cf63], a
@@ -51721,10 +52195,29 @@
ret
; 49944
-INCBIN "baserom.gbc",$49944,$49962 - $49944
+Function49944: ; 49944
+ ld hl, $cf65
+ ld a, [hl]
+ inc [hl]
+ and $7
+ ret nz
+ ld a, [hl]
+ and $18
+ sla a
+ add $40
+ ld d, a
+ ld e, $0
+ ld a, $18
+ call Function3b2a
+ ld hl, $0003
+ add hl, bc
+ ld [hl], $80
+ ret
+; 49962
-SpecialCelebiGFX:
+SpecialCelebiLeafGFX: ; 49962
INCBIN "gfx/special/celebi/leaf.2bpp"
+SpecialCelebiGFX: ; 499a2
INCBIN "gfx/special/celebi/1.2bpp"
INCBIN "gfx/special/celebi/2.2bpp"
INCBIN "gfx/special/celebi/3.2bpp"
@@ -51854,7 +52347,7 @@
ld e, a
ld a, d
ld d, $0
- ld hl, $5b6e
+ ld hl, Unknown_49b6e
add hl, de
add hl, de
ld e, [hl]
@@ -51873,7 +52366,14 @@
ret
; 49b6e (12:5b6e)
-INCBIN "baserom.gbc",$49b6e,$49bae - $49b6e
+Unknown_49b6e: ; 49b6e
+; Yet another sine wave.
+x set 0
+ rept $20
+ dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up
+x set x + $100 * $40000
+ endr
+; 49bae
Function49bae: ; 49bae
push hl
@@ -51961,7 +52461,9 @@
ret
; 49c0c
+GFX_49c0c: ; 49c0c
INCBIN "baserom.gbc",$49c0c,$49cdc - $49c0c
+; 49cdc
MainMenu: ; 49cdc
xor a
@@ -52885,9 +53387,9 @@
; known jump sources: 4a0b2 (12:60b2), 4a3a7 (12:63a7)
Function4a485: ; 4a485 (12:6485)
- ld de, $5c0c
+ ld de, GFX_49c0c
ld hl, $9000
- ld bc, $120d
+ lb bc, BANK(GFX_49c0c), $d
call Get2bpp
ret
@@ -52924,7 +53426,6 @@
; 4a4c4
-
; known jump sources: 4a0bf (12:60bf), 4a6c2 (12:66c2)
Function4a4c4: ; 4a4c4 (12:64c4)
call WhiteBGMap
@@ -52939,19 +53440,19 @@
ld c, $e
call Function48cdc
ld hl, $c4cc
- ld de, $65c5
+ ld de, String_4a5c5
call PlaceString
ld hl, $c4f4
- ld de, $65cd
+ ld de, String_4a5cd
call PlaceString
ld hl, $c51c
- ld de, $65da
+ ld de, String_4a5da
call PlaceString
ld hl, $c544
- ld de, $65e6
+ ld de, String_4a5e6
call PlaceString
ld hl, $c56c
- ld de, $65f2
+ ld de, String_4a5f2
call PlaceString
ld hl, $c590
ld b, $4
@@ -52958,13 +53459,13 @@
ld c, $12
call TextBox
xor a
- ld hl, $65f6
+ ld hl, Strings_4a5f6
ld d, h
ld e, l
ld hl, $c5b9
call PlaceString
ld a, $1
- ld hl, $65f6
+ ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
@@ -53016,7 +53517,7 @@
dec a
add a
push af
- ld hl, $65f6
+ ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
@@ -53028,7 +53529,7 @@
call PlaceString
pop af
inc a
- ld hl, $65f6
+ ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
@@ -53049,8 +53550,31 @@
jp Function4a545
; 4a5c5 (12:65c5)
-INCBIN "baserom.gbc",$4a5c5,$4a680 - $4a5c5
+String_4a5c5: ; 4a5c5
+ db "じこしょうかい@"
+String_4a5cd: ; 4a5cd
+ db "たいせん ", $4a, "はじまるとき@"
+String_4a5da: ; 4a5da
+ db "たいせん ", $1d, "かったとき@"
+String_4a5e6: ; 4a5e6
+ db "たいせん ", $1d, "まけたとき@"
+String_4a5f2: ; 4a5f2
+ db "もどる@"
+; 4a5f6
+Strings_4a5f6: ; 4a5f6
+ db "めいし や ニュース ", $1d, "のせる@"
+ db "あなた", $25, "あいさつです@"
+ db "モバイル たいせん", $4a, "はじまるとき@"
+ db "あいて", $1d, "みえる あいさつです@"
+ db "モバイル たいせんで かったとき@"
+ db "あいて", $1d, "みえる あいさつです@"
+ db "モバイル たいせんで まけたとき@"
+ db "あいて", $1d, "みえる あいさつです@"
+ db "まえ", $25, "がめん ", $1d, "もどります@"
+ db "@"
+; 4a680
+
; known jump sources: 4a4cd (12:64cd), 4a5b0 (12:65b0)
Function4a680: ; 4a680 (12:6680)
ld hl, $cfa1
@@ -53127,10 +53651,8 @@
SpecialBeastsCheck: ; 0x4a6e8
; Check if the player owns all three legendary beasts.
; They must exist in either party or PC, and have the player's OT and ID.
+; Return the result in ScriptVar.
-; outputs:
-; ScriptVar is 1 if the Pokémon exist, otherwise 0.
-
ld a, RAIKOU
ld [ScriptVar], a
call CheckOwnMonAnywhere
@@ -53147,7 +53669,7 @@
jr nc, .notexist
; they exist
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
@@ -53156,12 +53678,11 @@
ld [ScriptVar], a
ret
+
SpecialMonCheck: ; 0x4a711
-; Check if a Pokémon exists in PC or party.
-; It must exist in either party or PC, and have the player's OT and ID.
+; Check if the player owns any monsters of the species in ScriptVar.
+; Return the result in ScriptVar.
-; inputs:
-; ScriptVar contains species to search for
call CheckOwnMonAnywhere
jr c, .exists
@@ -53171,22 +53692,28 @@
ret
.exists
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
+
CheckOwnMonAnywhere: ; 0x4a721
+; Check if the player owns any monsters of the species in ScriptVar.
+; It must exist in either party or PC, and have the player's OT and ID.
+
+ ; If there are no monsters in the party,
+ ; the player must not own any yet.
ld a, [PartyCount]
and a
- ret z ; no pokémon in party
+ ret z
ld d, a
- ld e, $0
+ ld e, 0
ld hl, PartyMon1Species
ld bc, PartyMon1OT
-; run CheckOwnMon on each Pokémon in the party
-.loop
+ ; Run CheckOwnMon on each Pokémon in the party.
+.partymon
call CheckOwnMon
ret c ; found!
@@ -53196,41 +53723,50 @@
pop bc
call UpdateOTPointer
dec d
- jr nz, .loop ; 0x4a73d $f0
+ jr nz, .partymon
-; XXX the below could use some cleanup
-; run CheckOwnMon on each Pokémon in the PC
- ld a, $1
+ ; Run CheckOwnMon on each Pokémon in the PC.
+ ld a, 1
call GetSRAMBank
ld a, [BoxCount]
and a
- jr z, .asm_4a766 ; 0x4a748 $1c
+ jr z, .boxes
+
ld d, a
ld hl, BoxMon1Species
ld bc, BoxMon1OT
-.asm_4a751
+.openboxmon
call CheckOwnMon
- jr nc, .asm_4a75a ; 0x4a754 $4
+ jr nc, .next
+
+ ; found!
call CloseSRAM
ret
-.asm_4a75a
+
+.next
push bc
- ld bc, $0020
+ ld bc, BoxMon2 - BoxMon1
add hl, bc
pop bc
call UpdateOTPointer
dec d
- jr nz, .asm_4a751 ; 0x4a764 $eb
-.asm_4a766
+ jr nz, .openboxmon
+
+ ; Run CheckOwnMon on each monster in the other 13 PC boxes.
+.boxes
call CloseSRAM
- ld c, $0
-.asm_4a76b
- ld a, [$db72]
+
+ ld c, 0
+.box
+ ; Don't search the current box again.
+ ld a, [wCurBox]
and $f
cp c
- jr z, .asm_4a7af ; 0x4a771 $3c
- ld hl, $6810
- ld b, $0
+ jr z, .nextbox
+
+ ; Load the box.
+ ld hl, Unknown_4a810
+ ld b, 0
add hl, bc
add hl, bc
add hl, bc
@@ -53239,47 +53775,60 @@
ld a, [hli]
ld h, [hl]
ld l, a
+
+ ; Number of monsters in the box
ld a, [hl]
and a
- jr z, .asm_4a7af ; 0x4a784 $29
+ jr z, .nextbox
+
push bc
+
push hl
- ld de, $0016
+ ld de, BoxMons - BoxCount
add hl, de
ld d, h
ld e, l
pop hl
push de
- ld de, $0296
+ ld de, BoxMonOT - BoxCount
add hl, de
ld b, h
ld c, l
pop hl
+
ld d, a
-.asm_4a798
+
+.boxmon
call CheckOwnMon
- jr nc, .asm_4a7a2 ; 0x4a79b $5
+ jr nc, .nextboxmon
+
+ ; found!
pop bc
call CloseSRAM
ret
-.asm_4a7a2
+
+.nextboxmon
push bc
- ld bc, $0020
+ ld bc, BoxMon2 - BoxMon1
add hl, bc
pop bc
call UpdateOTPointer
dec d
- jr nz, .asm_4a798 ; 0x4a7ac $ea
+ jr nz, .boxmon
pop bc
-.asm_4a7af
+
+.nextbox
inc c
ld a, c
- cp $e
- jr c, .asm_4a76b ; 0x4a7b3 $b6
+ cp NUM_BOXES
+ jr c, .box
+
+ ; not found
call CloseSRAM
- and a ; clear carry
+ and a
ret
+
CheckOwnMon: ; 0x4a7ba
; Check if a Pokémon belongs to the player and is of a specific species.
@@ -53320,6 +53869,7 @@
ld hl, PlayerName
+ rept 4
ld a, [de]
cp [hl]
jr nz, .notfound
@@ -53327,41 +53877,19 @@
jr z, .found ; reached end of string
inc hl
inc de
+ endr
ld a, [de]
cp [hl]
- jr nz, .notfound
- cp $50
jr z, .found
- inc hl
- inc de
- ld a, [de]
- cp [hl]
- jr nz, .notfound
- cp $50
- jr z, .found
- inc hl
- inc de
-
- ld a, [de]
- cp [hl]
- jr nz, .notfound
- cp $50
- jr z, .found
- inc hl
- inc de
-
- ld a, [de]
- cp [hl]
- jr z, .found
-
.notfound
pop de
pop hl
pop bc
- and a ; clear carry
+ and a
ret
+
.found
pop de
pop hl
@@ -53368,10 +53896,26 @@
pop bc
scf
ret
-
; 0x4a810
-INCBIN "baserom.gbc",$4a810,$4a83a - $4a810
+Unknown_4a810: ; 4a810
+ ; bank, address
+ dbw $02, $a000
+ dbw $02, $a450
+ dbw $02, $a8a0
+ dbw $02, $acf0
+ dbw $02, $b140
+ dbw $02, $b590
+ dbw $02, $b9e0
+ dbw $03, $a000
+ dbw $03, $a450
+ dbw $03, $a8a0
+ dbw $03, $acf0
+ dbw $03, $b140
+ dbw $03, $b590
+ dbw $03, $b9e0
+; 4a83a
+
UpdateOTPointer: ; 0x4a83a
push hl
ld hl, PartyMon2OT - PartyMon1OT
@@ -53382,8 +53926,170 @@
ret
; 0x4a843
-INCBIN "baserom.gbc",$4a843,$4a927 - $4a843
+Function4a843: ; 4a843
+; Like CheckOwnMonAnywhere, but only check for species.
+; OT/ID don't matter.
+
+ ld a, [PartyCount]
+ and a
+ ret z
+
+ ld d, a
+ ld e, 0
+ ld hl, PartyMon1Species
+ ld bc, PartyMon1OT
+.asm_4a851
+ call Function4a8dc
+ ret c
+ push bc
+ ld bc, PartyMon2 - PartyMon1
+ add hl, bc
+ pop bc
+ call Function4a91e
+ dec d
+ jr nz, .asm_4a851
+ ld a, 1
+ call GetSRAMBank
+ ld a, [BoxCount]
+ and a
+ jr z, .asm_4a888
+ ld d, a
+ ld hl, BoxMon1Species
+ ld bc, BoxMon1OT
+.asm_4a873
+ call Function4a8dc
+ jr nc, .asm_4a87c
+ call CloseSRAM
+ ret
+
+.asm_4a87c
+ push bc
+ ld bc, BoxMon2 - BoxMon1
+ add hl, bc
+ pop bc
+ call Function4a91e
+ dec d
+ jr nz, .asm_4a873
+
+.asm_4a888
+ call CloseSRAM
+ ld c, 0
+.asm_4a88d
+ ld a, [wCurBox]
+ and $f
+ cp c
+ jr z, .asm_4a8d1
+ ld hl, Unknown_4a8f4
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ call GetSRAMBank
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [hl]
+ and a
+ jr z, .asm_4a8d1
+ push bc
+ push hl
+ ld de, BoxMons - BoxCount
+ add hl, de
+ ld d, h
+ ld e, l
+ pop hl
+ push de
+ ld de, BoxMonOT - BoxCount
+ add hl, de
+ ld b, h
+ ld c, l
+ pop hl
+ ld d, a
+.asm_4a8ba
+ call Function4a8dc
+ jr nc, .asm_4a8c4
+ pop bc
+ call CloseSRAM
+ ret
+
+.asm_4a8c4
+ push bc
+ ld bc, BoxMon2 - BoxMon1
+ add hl, bc
+ pop bc
+ call Function4a91e
+ dec d
+ jr nz, .asm_4a8ba
+ pop bc
+
+.asm_4a8d1
+ inc c
+ ld a, c
+ cp NUM_BOXES
+ jr c, .asm_4a88d
+ call CloseSRAM
+ and a
+ ret
+; 4a8dc
+
+Function4a8dc: ; 4a8dc
+ push bc
+ push hl
+ push de
+ ld d, b
+ ld e, c
+ ld a, [ScriptVar]
+ ld b, [hl]
+ cp b
+ jr nz, .no_match
+ jr .match
+
+.no_match
+ pop de
+ pop hl
+ pop bc
+ and a
+ ret
+
+.match
+ pop de
+ pop hl
+ pop bc
+ scf
+ ret
+; 4a8f4
+
+Unknown_4a8f4: ; 4a8f4
+ ; bank, address
+ dbw $02, $a000
+ dbw $02, $a450
+ dbw $02, $a8a0
+ dbw $02, $acf0
+ dbw $02, $b140
+ dbw $02, $b590
+ dbw $02, $b9e0
+ dbw $03, $a000
+ dbw $03, $a450
+ dbw $03, $a8a0
+ dbw $03, $acf0
+ dbw $03, $b140
+ dbw $03, $b590
+ dbw $03, $b9e0
+; 4a91e
+
+Function4a91e: ; 4a91e
+ push hl
+ ld hl, PartyMon2OT - PartyMon1OT
+ add hl, bc
+ ld b, h
+ ld c, l
+ pop hl
+ ret
+; 4a927
+
+
Function4a927: ; 4a927
ld a, [ScriptVar]
ld [CurItem], a
@@ -53390,17 +54096,19 @@
ld hl, PCItems
call CheckItem
jr c, .asm_4a948
+
ld a, [ScriptVar]
ld [CurItem], a
ld hl, NumItems
call CheckItem
jr c, .asm_4a948
+
xor a
ld [ScriptVar], a
ret
.asm_4a948
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
; 4a94e
@@ -53461,14 +54169,18 @@
ret
.asm_4a9b0
- ld de, $0019
+ ld de, SFX_WRONG
call PlaySFX
- ld hl, $69be
+ ld hl, UnknownText_0x4a9be
call PrintText
jr .asm_4a974
; 4a9be
-INCBIN "baserom.gbc",$4a9be,$4a9c3 - $4a9be
+UnknownText_0x4a9be: ; 0x4a9be
+ ; Pick three #MON for battle.
+ text_jump UnknownText_0x1c51d7
+ db "@"
+; 0x4a9c3
Function4a9c3: ; 4a9c3
ld hl, DefaultFlypoint
@@ -53514,13 +54226,17 @@
ld de, $d012
ld bc, $0006
call CopyBytes
- ld hl, $6a1d
+ ld hl, UnknownText_0x4aa1d
call PrintText
call YesNoBox
ret
; 4aa1d
-INCBIN "baserom.gbc",$4aa1d,$4aa22 - $4aa1d
+UnknownText_0x4aa1d: ; 0x4aa1d
+ ; , @ and @ . Use these three?
+ text_jump UnknownText_0x1c51f4
+ db "@"
+; 0x4aa22
Function4aa22: ; 4aa22
call WhiteBGMap
@@ -53529,6 +54245,8 @@
callba Function5004f
callba Function50405
call Function4aad3
+
+Function4aa34: ; 4aa34
ld a, $9
ld [PartyMenuActionText], a
callba WritePartyMenuTilemap
@@ -53558,7 +54276,13 @@
ret
; 4aa6e
-INCBIN "baserom.gbc",$4aa6e,$4aa7a - $4aa6e
+Function4aa6e: ; 4aa6e
+ pop af
+ ld de, SFX_WRONG
+ call PlaySFX
+ call WaitSFX
+ jr Function4aa34
+; 4aa7a
Function4aa7a: ; 4aa7a
ld hl, DefaultFlypoint
@@ -53642,6 +54366,7 @@
ld a, [hli]
and a
ret z
+
ld c, a
xor a
ld [hConnectedMapWidth], a
@@ -53648,7 +54373,7 @@
.asm_4aadd
push bc
push hl
- ld e, $0
+ ld e, 0
callba Function8e83f
ld a, [hConnectedMapWidth]
inc a
@@ -53657,6 +54382,7 @@
pop bc
dec c
jr nz, .asm_4aadd
+
call Function4aa7a
callba Function8cf69
ret
@@ -53664,7 +54390,7 @@
Function4aafb: ; 4aafb
ld a, [CurPartySpecies]
- cp $fd
+ cp EGG
jr z, .asm_4ab04
and a
ret
@@ -53676,7 +54402,7 @@
Function4ab06: ; 4ab06
ld a, [CurPartyMon]
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
@@ -53724,7 +54450,7 @@
add hl, bc
ld a, [hl]
ld [CurPartySpecies], a
- ld de, $0008
+ ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
ld a, $1
@@ -53735,7 +54461,7 @@
ld a, [$cfa9]
ld [$d0d8], a
.asm_4ab73
- ld de, $0008
+ ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
scf
@@ -53747,7 +54473,7 @@
ld a, [$cfaa]
cp $2
jr z, .asm_4ab73
- ld de, $0008
+ ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
xor a
@@ -53889,7 +54615,7 @@
ld hl, $c5cd
call ClearBox
callba Function8ea4a
- ld hl, $6ca2
+ ld hl, Unknown_4aca2
call LoadMenuDataHeader
ld hl, $d019
bit 1, [hl]
@@ -53899,7 +54625,7 @@
ld c, $7
call TextBox
ld hl, $c5c5
- ld de, $6da7
+ ld de, String_4ada7
call PlaceString
jr .asm_4ac96
@@ -53919,6 +54645,7 @@
ret
; 4aca2
+Unknown_4aca2: ; 4aca2
INCBIN "baserom.gbc",$4aca2,$4acaa - $4aca2
Function4acaa: ; 4acaa
@@ -53949,7 +54676,7 @@
ld hl, $cfa5
set 6, [hl]
call Function1bc9
- ld de, $0008
+ ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit 0, a
@@ -53993,7 +54720,7 @@
inc hl
cp [hl]
jr z, .asm_4ad39
- ld de, $0019
+ ld de, SFX_WRONG
call WaitPlaySFX
ld hl, UnknownText_0x4ad51
call PrintText
@@ -54032,21 +54759,23 @@
ret
; 4ad67
-INCBIN "baserom.gbc",$4ad67,$4ad68 - $4ad67
+Function4ad67: ; 4ad67
+ ret
+; 4ad68
Function4ad68: ; 4ad68
ld hl, $c59d
- ld de, $6d88
+ ld de, String_4ad88
call PlaceString
call Function4adb2
jr c, .asm_4ad7e
ld hl, $c575
- ld de, $6da0
+ ld de, String_4ada0
jr .asm_4ad84
.asm_4ad7e
ld hl, $c575
- ld de, $6d9a
+ ld de, String_4ad9a
.asm_4ad84
call PlaceString
@@ -54053,8 +54782,25 @@
ret
; 4ad88
-INCBIN "baserom.gbc",$4ad88,$4adb2 - $4ad88
+String_4ad88: ; 4ad88
+ db "つよさをみる"
+ next "つかえるわざ"
+ next "もどる@"
+; 4ad9a
+String_4ad9a: ; 4ad9a
+ db "さんかする@"
+; 4ada0
+
+String_4ada0: ; 4ada0
+ db "さんかしない@"
+; 4ada7
+
+String_4ada7: ; 4ada7
+ db "つよさをみる"
+ next "もどる@" ; BACK
+; 4adb2
+
Function4adb2: ; 4adb2
ld hl, DefaultFlypoint
ld a, [CurPartyMon]
@@ -55364,7 +56110,7 @@
call CloseSRAM
ld c, $0
.asm_4d8cd
- ld a, [$db72]
+ ld a, [wCurBox]
and $f
cp c
jr z, .asm_4d90b
@@ -55391,8 +56137,9 @@
.asm_4d8f1
ld a, [bc]
inc bc
- cp $fd
+ cp EGG
jr z, .asm_4d901
+
call Function4d939
jr nc, .asm_4d901
ld a, $1
@@ -55410,8 +56157,9 @@
.asm_4d90b
inc c
ld a, c
- cp $e
+ cp NUM_BOXES
jr c, .asm_4d8cd
+
call CloseSRAM
ld a, [ScriptVar]
and a
@@ -56400,8 +57148,8 @@
ld a, [$cf64]
and $3
dec a
- ld hl, $600d
- rst $28
+ ld hl, Jumptable_4e00d
+ rst JumpTable
ret
; no known jump sources
@@ -56726,8 +57474,8 @@
; known jump sources: 4e22e (13:622e), 4e497 (13:6497)
Function4e2ad: ; 4e2ad (13:62ad)
ld a, [MonType] ; $cf5f
- ld hl, $62b5
- rst $28
+ ld hl, Jumptable_4e2b5
+ rst JumpTable
ret
; no known jump sources
@@ -66657,10 +67405,10 @@
ld a, [$cfa9]
ld c, a
push bc
- ld hl, $5e04
+ ld hl, Jumptable_89e04
ld a, e
dec a
- rst $28
+ rst JumpTable
pop bc
jr .asm_89dea
.asm_89dfd
@@ -66681,8 +67429,8 @@
call Function89160
call Function8b3b0
call CloseSRAM
- ld hl, $5e18
- rst $28
+ ld hl, Jumptable_89e18
+ rst JumpTable
ret
; no known jump sources
@@ -66704,8 +67452,8 @@
; known jump sources: 89e3a (22:5e3a)
asm_89e2e: ; 89e2e (22:5e2e)
ld a, [$d02d]
- ld hl, $5e3c
- rst $28
+ ld hl, Jumptable_89e3c
+ rst JumpTable
ret
; known jump sources: 89e97 (22:5e97), 89ede (22:5ede), 89f67 (22:5f67), 89fea (22:5fea), 89ff3 (22:5ff3), 8a03a (22:603a), 8a049 (22:6049), 8a052 (22:6052), 8a09e (22:609e), 8a0e9 (22:60e9), 8a0f2 (22:60f2), 8a0ff (22:60ff)
@@ -67735,12 +68483,12 @@
pop bc
jr z, .asm_8a639
ld c, a
- ld hl, $6671
+ ld hl, Jumptable_8a671
ld a, b
ld [MenuSelection], a ; $cf74
ld a, c
dec a
- rst $28
+ rst JumpTable
jr .asm_8a639
.asm_8a66a
call Function891fe
@@ -67776,9 +68524,9 @@
jr c, .asm_8a6a3
and a
jr z, Function8a679
- ld hl, $66bc
+ ld hl, Jumptable_8a6bc
dec a
- rst $28
+ rst JumpTable
jr c, Function8a679
call Function891fe
call Function8b677
@@ -67833,8 +68581,8 @@
call PlayClickSFX
call Function89448
ld a, [$d011]
- ld hl, $674f
- rst $28
+ ld hl, Jumptable_8a74f
+ rst JumpTable
jr nc, .asm_8a6e5
jr .asm_8a742
.asm_8a718
@@ -68127,9 +68875,9 @@
ld hl, DefaultFlypoint ; $d002
ld bc, $25
call CopyBytes
- ld de, $20
+ ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
- ld de, $20
+ ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
.asm_8a995
call CloseSRAM
@@ -68137,7 +68885,7 @@
; no known jump sources
Function8a999: ; 8a999 (22:6999)
- ld hl, $69c9
+ ld hl, Unknown_8a9c9
call LoadMenuDataHeader
ld c, $1
.asm_8a9a1
@@ -68149,8 +68897,8 @@
pop de
dec e
ld a, e
- ld hl, $69c5
- rst $28
+ ld hl, Jumptable_8a9c5
+ rst JumpTable
call Function891fe
call Function89b28
pop bc
@@ -68165,10 +68913,11 @@
Jumptable_8a9c5: ; 8a9c5 (22:69c5)
dw Function8aa0a
dw Function8ab3b
-
; 8a9c9 (22:69c9)
+Unknown_8a9c9: ; 8a9c9
INCBIN "baserom.gbc",$8a9c9,$8a9ce - $8a9c9
+; 8a9ce
; known jump sources: 8a9a1 (22:69a1)
Function8a9ce: ; 8a9ce (22:69ce)
@@ -68179,9 +68928,9 @@
call Function89b3b
pop bc
ld a, c
- ld hl, $69f2
+ ld hl, Unknown_8a9f2
call Function89d5e
- ld hl, $6a09
+ ld hl, Function8aa09
call Function89d85
jr c, .asm_8a9ed
ld c, a
@@ -68195,8 +68944,14 @@
ret
; 8a9f2 (22:69f2)
-INCBIN "baserom.gbc",$8a9f2,$8aa0a - $8a9f2
+Unknown_8a9f2: ; 8a9f2
+INCBIN "baserom.gbc",$8a9f2,$8aa09 - $8a9f2
+; 8aa09
+Function8aa09: ; 8aa09
+ ret
+; 8aa0a
+
; no known jump sources
Function8aa0a: ; 8aa0a (22:6a0a)
ld a, $1
@@ -68231,8 +68986,8 @@
call Function89448
ld a, [$d011]
dec a
- ld hl, $6a6d
- rst $28
+ ld hl, Jumptable_8aa6d
+ rst JumpTable
jr nc, .asm_8aa3a
jr .asm_8aa69
.asm_8aa61
@@ -69435,9 +70190,9 @@
push bc
call Function8923c
call Function8b521
- ld hl, $74a0
+ ld hl, Jumptable_8b4a0
pop bc
- rst $28
+ rst JumpTable
ret
; no known jump sources
@@ -69475,7 +70230,7 @@
; known jump sources: 8b474 (22:7474), 8b4ae (22:74ae), 8b4c2 (22:74c2)
Function8b4cc: ; 8b4cc (22:74cc)
push bc
- ld hl, $7529
+ ld hl, Unknown_8b529
call Function8b50a
ld a, [hli]
ld h, [hl]
@@ -69485,7 +70240,7 @@
; known jump sources: 8b4a6 (22:74a6)
Function8b4d8: ; 8b4d8 (22:74d8)
- ld hl, $7529
+ ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
@@ -69502,7 +70257,7 @@
; known jump sources: 8b4ba (22:74ba)
Function8b4ea: ; 8b4ea (22:74ea)
- ld hl, $7529
+ ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
@@ -69520,7 +70275,7 @@
; known jump sources: 8b47e (22:747e), 8b549 (22:7549), 8b5fa (22:75fa)
Function8b4fd: ; 8b4fd (22:74fd)
- ld hl, $752d
+ ld hl, Unknown_8b529 + 4
call Function8b50a
ld a, [hli]
ld c, a
@@ -69555,13 +70310,18 @@
; known jump sources: 8b497 (22:7497)
Function8b521: ; 8b521 (22:7521)
- ld hl, $7530
+ ld hl, Unknown_8b529 + 7
call Function8b50a
ld a, [hl]
ret
; 8b529 (22:7529)
-INCBIN "baserom.gbc",$8b529,$8b539 - $8b529
+Unknown_8b529: ; 8b529
+ dw $c506
+ db 1, 4, $20, $49, 0, 1
+ dw $c4f7
+ db 1, 4, $48, $41, 0, 0
+; 8b539
; known jump sources: 8a0e6 (22:60e6)
Function8b539: ; 8b539 (22:7539)
@@ -69579,7 +70339,7 @@
; known jump sources: 8a0f5 (22:60f5), 8b57a (22:757a), 8b588 (22:7588)
Function8b555: ; 8b555 (22:7555)
- ld hl, $75ce
+ ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, $d017
call Function8b45c
@@ -69590,11 +70350,11 @@
ld bc, $d017
call Function8b664
jr nz, .asm_8b57c
- ld hl, $75e2
+ ld hl, UnknownText_0x8b5e2
call PrintText
jr Function8b555
.asm_8b57c
- ld hl, $75d3
+ ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, $d013
call Function8b45c
@@ -69606,7 +70366,7 @@
call Function89448
ld bc, $d013
call Function8b493
- ld hl, $75d8
+ ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
.asm_8b5a6
@@ -69619,7 +70379,7 @@
call Function89448
ld bc, $d013
call Function8b493
- ld hl, $75dd
+ ld hl, UnknownText_0x8b5dd
call PrintText
and a
.asm_8b5c8
@@ -69629,8 +70389,36 @@
ret
; 8b5ce (22:75ce)
-INCBIN "baserom.gbc",$8b5ce,$8b5e7 - $8b5ce
+UnknownText_0x8b5ce: ; 0x8b5ce
+ ; Please enter any four-digit number.
+ text_jump UnknownText_0x1bc187
+ db "@"
+; 0x8b5d3
+UnknownText_0x8b5d3: ; 0x8b5d3
+ ; Enter the same number to confirm.
+ text_jump UnknownText_0x1bc1ac
+ db "@"
+; 0x8b5d8
+
+UnknownText_0x8b5d8: ; 0x8b5d8
+ ; That's not the same number.
+ text_jump UnknownText_0x1bc1cf
+ db "@"
+; 0x8b5dd
+
+UnknownText_0x8b5dd: ; 0x8b5dd
+ ; Your PASSCODE has been set. Enter this number next time to open the CARD FOLDER.
+ text_jump UnknownText_0x1bc1eb
+ db "@"
+; 0x8b5e2
+
+UnknownText_0x8b5e2: ; 0x8b5e2
+ ; 0000 is invalid!
+ text_jump UnknownText_0x1bc23e
+ db "@"
+; 0x8b5e7
+
; known jump sources: 8a2a6 (22:62a6)
Function8b5e7: ; 8b5e7 (22:75e7)
ld bc, $d013
@@ -69644,7 +70432,7 @@
ld e, $0
call Function89c44
.asm_8b602
- ld hl, $7642
+ ld hl, UnknownText_0x8b642
call PrintText
ld bc, $d013
call Function8b45c
@@ -69657,13 +70445,13 @@
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635
- ld hl, $7647
+ ld hl, UnknownText_0x8b647
call PrintText
ld bc, $d013
call Function8b36c
jr .asm_8b602
.asm_8b635
- ld hl, $764c
+ ld hl, UnknownText_0x8b64c
call PrintText
and a
.asm_8b63c
@@ -69673,8 +70461,36 @@
ret
; 8b642 (22:7642)
-INCBIN "baserom.gbc",$8b642,$8b664 - $8b642
+UnknownText_0x8b642: ; 0x8b642
+ ; Enter the CARD FOLDER PASSCODE.
+ text_jump UnknownText_0x1bc251
+ db "@"
+; 0x8b647
+UnknownText_0x8b647: ; 0x8b647
+ ; Incorrect PASSCODE!
+ text_jump UnknownText_0x1bc272
+ db "@"
+; 0x8b64c
+
+UnknownText_0x8b64c: ; 0x8b64c
+ ; CARD FOLDER open.@ @
+ text_jump UnknownText_0x1bc288
+ start_asm
+; 0x8b651
+
+Function8b651: ; 8b651
+ ld de, SFX_TWINKLE
+ call PlaySFX
+ call WaitSFX
+ ld c, $8
+ call DelayFrames
+ ld hl, .string_8b663
+ ret
+.string_8b663
+ db "@"
+; 8b664
+
; known jump sources: 8b56f (22:756f)
Function8b664: ; 8b664 (22:7664)
push bc
@@ -69729,7 +70545,7 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, $76d5
+ ld hl, Unknown_8b6d5
ld de, Unkn1Pals
ld bc, $0018
call CopyBytes
@@ -69739,6 +70555,7 @@
ret
; 8b6d5
+Unknown_8b6d5: ; 8b6d5
INCBIN "baserom.gbc",$8b6d5,$8b6ed - $8b6d5
Function8b6ed: ; 8b6ed
@@ -84278,7 +85095,7 @@
xor a
ld [$ffde], a
call Functione2963
- ld a, [$db72]
+ ld a, [wCurBox]
and $f
inc a
ld [$cb2e], a
@@ -84305,13 +85122,213 @@
Functione27a2: ; e27a2
ld a, [$cf63]
- ld hl, $67ac
+ ld hl, Jumptable_e27ac
call Functione33df
jp [hl]
; e27ac
-INCBIN "baserom.gbc", $e27ac, $e2963 - $e27ac
+Jumptable_e27ac: ; e27ac
+ dw Functione27ba
+ dw Functione27eb
+ dw Functione283d
+ dw Functione285d
+ dw Functione28df
+ dw Functione2903
+ dw Functione2992
+; e27ba
+Functione27ba: ; e27ba
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2d30
+ ld de, $74dd
+ call Functione2a6e
+ ld a, $5
+ ld [$cb2d], a
+ call Functione2c2c
+ call Functione2a80
+ call Functione2ac6
+ ld a, $ff
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ call WaitBGMap
+ call Functione2e01
+ call Functione298d
+ ret
+; e27eb
+
+Functione27eb: ; e27eb
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and $2
+ jr nz, .asm_e2837
+ ld a, [hl]
+ and $1
+ jr nz, .asm_e2823
+ call Functione29d0
+ jr c, .asm_e2816
+ and a
+ ret z
+ call Functione2e01
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ call Functione2ac6
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+
+.asm_e2816
+ xor a
+ ld [$cb2b], a
+ ld [$cb2a], a
+ ld a, $0
+ ld [$cf63], a
+ ret
+
+.asm_e2823
+ call Functione2def
+ and a
+ ret z
+ cp $ff
+ jr z, .asm_e2837
+ ld a, $2
+ ld [$cf63], a
+ ret
+
+ ld hl, $cf63
+ dec [hl]
+ ret
+
+.asm_e2837
+ ld a, $6
+ ld [$cf63], a
+ ret
+; e283d
+
+Functione283d: ; e283d
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ld de, $74ea
+ call Functione2a6e
+ ld a, $1
+ ld [$cfa9], a
+ call Functione298d
+ ret
+; e285d
+
+Functione285d: ; e285d
+ ld hl, $68c3
+ call Function1d3c
+ ld a, [$cfa9]
+ call Function1d4b
+ call Function1d81
+ jp c, Functione28bd
+ ld a, [$cfa9]
+ dec a
+ and $3
+ ld e, a
+ ld d, $0
+ ld hl, $6881
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e2881
+
+INCBIN "baserom.gbc", $e2881, $e28bd - $e2881
+
+Functione28bd: ; e28bd
+ ld a, $0
+ ld [$cf63], a
+ ret
+; e28c3
+
+INCBIN "baserom.gbc", $e28c3, $e28df - $e28c3
+
+Functione28df: ; e28df
+ xor a
+ ld [hBGMapMode], a
+ call Functione2d30
+ ld de, $7500
+ call Functione2a6e
+ ld a, $5
+ ld [$cb2d], a
+ call Functione2c2c
+ call Functione2a80
+ call ClearSprites
+ call Functione2e8c
+ call WaitBGMap
+ call Functione298d
+ ret
+; e2903
+
+Functione2903: ; e2903
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and $2
+ jr nz, .asm_e294b
+ ld a, [hl]
+ and $1
+ jr nz, .asm_e2938
+ call Functione29f4
+ jr c, .asm_e292b
+ and a
+ ret z
+ call Functione2e8c
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+
+.asm_e292b
+ xor a
+ ld [$cb2b], a
+ ld [$cb2a], a
+ ld a, $4
+ ld [$cf63], a
+ ret
+
+.asm_e2938
+ call Functione2ee5
+ jr c, .asm_e2946
+ call Functione31e7
+ ld a, $0
+ ld [$cf63], a
+ ret
+
+.asm_e2946
+ ld hl, $cf63
+ dec [hl]
+ ret
+
+.asm_e294b
+ ld a, [$cb2f]
+ ld [$cb2a], a
+ ld a, [$cb30]
+ ld [$cb2b], a
+ ld a, [$cb31]
+ ld [$cb2e], a
+ ld a, $0
+ ld [$cf63], a
+ ret
+; e2963
+
; known jump sources: e23aa (38:63aa), e259c (38:659c)
Functione2963: ; e2963 (38:6963)
call WhiteBGMap
@@ -84356,10 +85373,10 @@
ld e, a
ld a, [hl]
and $40
- jr nz, asm_e2a18
+ jr nz, Functione2a18
ld a, [hl]
and $80
- jr nz, asm_e2a2c
+ jr nz, Functione2a2c
.asm_e29b2
jp Functione2a65
@@ -84374,22 +85391,71 @@
jr z, .asm_e29cd
ld a, [hl]
and $40
- jr nz, asm_e2a18
+ jr nz, Functione2a18
ld a, [hl]
and $80
- jr nz, asm_e2a2c
+ jr nz, Functione2a2c
.asm_e29cd
jp Functione2a65
; e29d0 (38:69d0)
-INCBIN "baserom.gbc",$e29d0,$e2a18 - $e29d0
-asm_e2a18: ; e2a18 (38:6a18)
+Functione29d0: ; e29d0
+ ld hl, $ffa9
+ ld a, [$cb2d]
+ ld d, a
+ ld a, [$cb2c]
+ ld e, a
+ and a
+ jr z, .asm_e29e8
+ ld a, [hl]
+ and $40
+ jr nz, Functione2a18
+ ld a, [hl]
+ and $80
+ jr nz, Functione2a2c
+
+.asm_e29e8
+ ld a, [hl]
+ and $20
+ jr nz, Functione2a48
+ ld a, [hl]
+ and $10
+ jr nz, Functione2a56
+ jr Functione2a65
+
+Functione29f4: ; e29f4
+ ld hl, $ffa9
+ ld a, [$cb2d]
+ ld d, a
+ ld a, [$cb2c]
+ ld e, a
+ and a
+ jr z, .asm_e2a0c
+
+ ld a, [hl]
+ and $40
+ jr nz, Functione2a18
+ ld a, [hl]
+ and $80
+ jr nz, Functione2a2c
+
+.asm_e2a0c
+ ld a, [hl]
+ and $20
+ jr nz, Functione2a48
+ ld a, [hl]
+ and $10
+ jr nz, Functione2a56
+ jr Functione2a65
+
+Functione2a18: ; e2a18 (38:6a18)
ld hl, $cb2b
ld a, [hl]
and a
jr z, .asm_e2a22
dec [hl]
- jr asm_e2a68
+ jr Functione2a68
+
.asm_e2a22
ld hl, $cb2a
ld a, [hl]
@@ -84396,8 +85462,9 @@
and a
jr z, Functione2a65
dec [hl]
- jr asm_e2a68
-asm_e2a2c: ; e2a2c (38:6a2c)
+ jr Functione2a68
+
+Functione2a2c: ; e2a2c (38:6a2c)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
@@ -84404,6 +85471,7 @@
inc a
cp e
jr nc, Functione2a65
+
ld hl, $cb2b
ld a, [hl]
inc a
@@ -84410,15 +85478,38 @@
cp d
jr nc, .asm_e2a42
inc [hl]
- jr asm_e2a68
+ jr Functione2a68
+
.asm_e2a42
ld hl, $cb2a
inc [hl]
- jr asm_e2a68
+ jr Functione2a68
; e2a48 (38:6a48)
-INCBIN "baserom.gbc",$e2a48,$e2a65 - $e2a48
+Functione2a48: ; e2a48
+ ld hl, $cb2e
+ ld a, [hl]
+ and a
+ jr z, .asm_e2a52
+ dec [hl]
+ jr Functione2a6c
+.asm_e2a52
+ ld [hl], $e
+ jr Functione2a6c
+
+Functione2a56: ; e2a56
+ ld hl, $cb2e
+ ld a, [hl]
+ cp $e
+ jr z, .asm_e2a61
+ inc [hl]
+ jr Functione2a6c
+
+.asm_e2a61
+ ld [hl], $0
+ jr Functione2a6c
+
; known jump sources: e29b2 (38:69b2), e29cd (38:69cd), e2a27 (38:6a27), e2a35 (38:6a35)
Functione2a65: ; e2a65 (38:6a65)
xor a
@@ -84426,13 +85517,16 @@
ret
; known jump sources: e2a20 (38:6a20), e2a2a (38:6a2a), e2a40 (38:6a40), e2a46 (38:6a46)
-asm_e2a68: ; e2a68 (38:6a68)
+Functione2a68: ; e2a68 (38:6a68)
ld a, $1
and a
ret
; e2a6c (38:6a6c)
-INCBIN "baserom.gbc",$e2a6c,$e2a6e - $e2a6c
+Functione2a6c: ; e2a6c
+ scf
+ ret
+; e2a6e
; known jump sources: e23f8 (38:63f8), e2471 (38:6471), e24c4 (38:64c4), e24f1 (38:64f1), e252f (38:652f), e25f0 (38:65f0), e2669 (38:6669), e26bc (38:66bc), e26e4 (38:66e4), e2723 (38:6723), e2f4c (38:6f4c), e2f6b (38:6f6b), e30e7 (38:70e7), e316d (38:716d)
Functione2a6e: ; e2a6e (38:6a6e)
@@ -84446,7 +85540,14 @@
ret
; e2a80 (38:6a80)
-INCBIN "baserom.gbc",$e2a80,$e2a8e - $e2a80
+Functione2a80: ; e2a80
+ call Functione2a8e
+ ld hl, $c4bc
+ ld [hl], $5f
+ ld hl, $c4c7
+ ld [hl], $5e
+ ret
+; e2a8e
; known jump sources: e23f2 (38:63f2), e25ea (38:65ea)
Functione2a8e: ; e2a8e (38:6a8e)
@@ -84458,7 +85559,7 @@
jr z, .asm_e2ab3
cp $f
jr nz, .asm_e2aa5
- ld a, [$db72]
+ ld a, [wCurBox]
inc a
.asm_e2aa5
dec a
@@ -84947,7 +86048,7 @@
call ClearSprites
ret
.asm_e2e0b
- ld hl, $6e2b
+ ld hl, Unknown_e2e2b
ld de, Sprites ; $c400
.asm_e2e11
ld a, [hl]
@@ -84972,8 +86073,72 @@
jr .asm_e2e11
; e2e2b (38:6e2b)
-INCBIN "baserom.gbc",$e2e2b,$e2f18 - $e2e2b
+Unknown_e2e2b: ; e2e2b
+INCBIN "baserom.gbc", $e2e2b, $e2e8c - $e2e2b
+Functione2e8c: ; e2e8c
+ ld hl, $6eac
+ ld de, Sprites
+.asm_e2e92
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld a, [$cb2b]
+ and $7
+ swap a
+ add [hl]
+ inc hl
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ jr .asm_e2e92
+; e2eac
+
+INCBIN "baserom.gbc", $e2eac, $e2ee5 - $e2eac
+
+Functione2ee5: ; e2ee5
+ ld hl, $cb2e
+ ld a, [$cb31]
+ cp [hl]
+ jr z, .asm_e2f00
+ ld a, [$cb2e]
+ and a
+ jr z, .asm_e2ef8
+ ld e, $15
+ jr .asm_e2efa
+
+.asm_e2ef8
+ ld e, $7
+
+.asm_e2efa
+ ld a, [$cb2c]
+ cp e
+ jr nc, .asm_e2f02
+
+.asm_e2f00
+ and a
+ ret
+
+.asm_e2f02
+ ld de, $7521
+ call Functione2a6e
+ ld de, $0019
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, $32
+ call DelayFrames
+ scf
+ ret
+; e2f18
+
; known jump sources: e24a9 (38:64a9), e24e0 (38:64e0), e26a1 (38:66a1)
Functione2f18: ; e2f18 (38:6f18)
ld a, [$cb2e]
@@ -85004,7 +86169,7 @@
ld de, $750f
.asm_e2f4c
call Functione2a6e
- ld de, $19
+ ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, $32
@@ -85302,8 +86467,51 @@
ret
; e31e7 (38:71e7)
-INCBIN "baserom.gbc",$e31e7,$e3357 - $e31e7
+Functione31e7: ; e31e7
+ push hl
+ push de
+ push bc
+ push af
+ ld hl, $c5cc
+ ld bc, $0112
+ call TextBox
+ ld hl, $c5e1
+ ld de, $7233
+ call PlaceString
+ ld c, $14
+ call DelayFrames
+ pop af
+ pop bc
+ pop de
+ pop hl
+ ld a, [wCurBox]
+ push af
+ ld bc, NULL
+ ld a, [$cb31]
+ and a
+ jr nz, .asm_e3215
+ set 0, c
+.asm_e3215
+ ld a, [$cb2e]
+ and a
+ jr nz, .asm_e321d
+ set 1, c
+
+.asm_e321d
+ ld hl, $7245
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, $722a
+ push de
+ jp [hl]
+; e322a
+
+INCBIN "baserom.gbc", $e322a, $e3357 - $e322a
+
; known jump sources: e2ff2 (38:6ff2), e3023 (38:7023), e3052 (38:7052)
Functione3357: ; e3357 (38:7357)
ld a, [CurPartyMon] ; $d109
@@ -85415,7 +86623,7 @@
ld [hBGMapMode], a ; $ff00+$d4
call Functione36cf
call Functione379c
- ld hl, $75f1
+ ld hl, MenuDataHeader_0xe35f1
call Function1d3c
xor a
ld [$d0e4], a
@@ -85444,8 +86652,40 @@
ret
; e35f1 (38:75f1)
-INCBIN "baserom.gbc",$e35f1,$e3626 - $e35f1
+MenuDataHeader_0xe35f1: ; 0xe35f1
+ db $40 ; flags
+ db 05, 01 ; start coords
+ db 12, 09 ; end coords
+ dw MenuData2_0xe35f9
+ db 1 ; default option
+; 0xe35f9
+MenuData2_0xe35f9: ; 0xe35f9
+ db $22 ; flags
+ db 4, 0
+ db 1
+ dbw BANK(Unknown_e3609), Unknown_e3609
+ dbw BANK(Functione3619), Functione3619
+ dbw BANK(NULL), NULL
+ dbw BANK(Functione3632), Functione3632
+; e3609
+
+Unknown_e3609: ; e3609
+ db 14
+ db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ db -1
+; e3619
+
+Functione3619: ; e3619
+ push de
+ ld a, [MenuSelection]
+ dec a
+ call Functione3626
+ pop hl
+ call PlaceString
+ ret
+; e3626
+
; known jump sources: e36e7 (38:76e7), e375d (38:775d), e376e (38:776e)
Functione3626: ; e3626 (38:7626)
ld bc, $9
@@ -85456,11 +86696,20 @@
ret
; e3632 (38:7632)
-INCBIN "baserom.gbc",$e3632,$e366c - $e3632
+Functione3632: ; e3632
+INCBIN "baserom.gbc",$e3632,$e3663 - $e3632
+String_e3663: ; e3663
+ db "#MON@"
+; e3668
+
+String_e3668: ; e3668
+ db "/20@"
+; e366c
+
; known jump sources: e3717 (38:7717)
Functione366c: ; e366c (38:766c)
- ld a, [$db72]
+ ld a, [wCurBox]
ld c, a
ld a, [MenuSelection] ; $cf74
dec a
@@ -85510,7 +86759,7 @@
ld hl, $c4c9
ld de, $76f1
call PlaceString
- ld a, [$db72]
+ ld a, [wCurBox]
and $f
call Functione3626
ld hl, $c4d3
@@ -85557,7 +86806,7 @@
ld a, [MenuSelection] ; $cf74
dec a
ld e, a
- ld a, [$db72]
+ ld a, [wCurBox]
cp e
ret z
callba Function14a83
@@ -107293,22 +108542,26 @@
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
- cp $5f ; on S.S. Aqua
+ cp FAST_SHIP ; S.S. Aqua
jr z, .johto
- cp $0 ; special
+ cp SPECIAL_MAP
jr nz, .checkagain
-; If in map $00, load map group / map id from backup locations
+; In a special map, get the backup map group / map id
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
+
.checkagain
- cp $2f ; Pallet Town
+ cp KANTO_LANDMARK
jr c, .johto
- cp $58 ; Victory Road
+
+; Victory Road area is considered to be Johto.
+ cp VICTORY_ROAD
jr c, .kanto
+
.johto
ld e, 0
ret
--- a/wram.asm
+++ b/wram.asm
@@ -1880,7 +1880,13 @@
ds 250
; db6c
-SECTION "BoxNames",WRAMX[$db75],BANK[1]
+SECTION "Boxes",WRAMX[$db72],BANK[1]
+
+wCurBox:: ; db72
+ ds 1
+
+ ds 2
+
; 8 chars + $50
Box1Name:: ; db75
ds 9