diff --git a/items/item_effects.asm b/items/item_effects.asm index 20dbbed7a..51e5ff0ef 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -563,30 +563,48 @@ Function_0xec2f: ; ec2f ; ec38 -INCBIN "baserom.gbc", $ec38, $ec50 - $ec38 +GetPokedexEntryBank: ; ec38 + push hl + push de + ld a, [EnemyMonSpecies] + rlca + rlca + and 3 + ld hl, .PokedexEntryBanks + ld d, 0 + ld e, a + add hl, de + ld a, [hl] + pop de + pop hl + ret +.PokedexEntryBanks + db BANK(PokedexEntries1) + db BANK(PokedexEntries2) + db BANK(PokedexEntries3) + db BANK(PokedexEntries4) +; ec50 Function_0xec50: ; ec50 ld a, [EnemyMonSpecies] - ld hl, $4378 + ld hl, PokedexDataPointerTable dec a ld e, a - ld d, $0 + ld d, 0 add hl, de add hl, de - ld a, $11 + ld a, BANK(PokedexDataPointerTable) call GetFarHalfword -.asm_ec61 - call $6c38 - +.SkipText + call GetPokedexEntryBank call GetFarByte - inc hl - cp $50 - jr nz, .asm_ec61 - call $6c38 + cp "@" + jr nz, .SkipText + call GetPokedexEntryBank push bc inc hl inc hl @@ -604,16 +622,17 @@ Function_0xec50: ; ec50 rr c srl b rr c - call $6c99 + call .asm_ec99 srl b rr c - call $6c99 + call .asm_ec99 ld a, h pop bc jr .asm_eca4 +.asm_ec99 push bc ld a, b cpl @@ -631,13 +650,11 @@ Function_0xec50: ; ec50 cp $4 jr c, .asm_ecbc - ld hl, $6cc4 - + ld hl, .table_ecc4 .asm_ecac ld a, c cp [hl] jr c, .asm_ecb4 - inc hl inc hl jr .asm_ecac @@ -653,15 +670,18 @@ Function_0xec50: ; ec50 .asm_ecbc ld a, b - sub $14 + sub 20 ld b, a ret nc ld b, $1 ret -; ecc4 - -INCBIN "baserom.gbc", $ecc4, $eccc - $ecc4 +.table_ecc4 + db 8, 0 + db 12, 20 + db 16, 30 + db 255, 40 +; eccc Function_0xeccc: ; eccc diff --git a/main.asm b/main.asm index dee06a39a..2b52ca111 100644 --- a/main.asm +++ b/main.asm @@ -20645,7 +20645,7 @@ INCLUDE "maps/HallOfFame.asm" ; Pokedex entries I ; 001-064 - +PokedexEntries1: INCLUDE "stats/pokedex/entries_1.asm" @@ -20925,7 +20925,7 @@ SECTION "bank6E",DATA,BANK[$6E] ; Pokedex entries II ; 065-128 - +PokedexEntries2: INCLUDE "stats/pokedex/entries_2.asm" @@ -21031,7 +21031,7 @@ SECTION "bank73",DATA,BANK[$73] ; Pokedex entries III ; 129-192 - +PokedexEntries3: INCLUDE "stats/pokedex/entries_3.asm" @@ -21039,7 +21039,7 @@ SECTION "bank74",DATA,BANK[$74] ; Pokedex entries IV ; 193-251 - +PokedexEntries4: INCLUDE "stats/pokedex/entries_4.asm"