pokered/engine/menu/pokedex.asm

666 lines
13 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
ShowPokedexMenu:
2014-05-22 22:13:20 +00:00
call GBPalWhiteOut
call ClearScreen
call UpdateSprites
ld a, [wListScrollOffset]
2014-05-22 22:13:20 +00:00
push af
xor a
ld [wCurrentMenuItem], a
ld [wListScrollOffset], a
ld [wLastMenuItem], a
2014-05-22 22:13:20 +00:00
inc a
ld [wd11e], a
ld [hJoy7], a
2014-05-22 22:13:20 +00:00
.setUpGraphics
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_GENERIC
call RunPaletteCommand
2014-05-22 22:13:20 +00:00
callab LoadPokedexTilePatterns
.doPokemonListMenu
ld hl, wTopMenuItemY
ld a, 3
ld [hli], a ; top menu item Y
2014-05-22 22:13:20 +00:00
xor a
ld [hli], a ; top menu item X
2014-05-22 22:13:20 +00:00
inc a
ld [wMenuWatchMovingOutOfBounds], a
2014-05-22 22:13:20 +00:00
inc hl
inc hl
ld a, 6
ld [hli], a ; max menu item ID
ld [hl], D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
2014-05-22 22:13:20 +00:00
call HandlePokedexListMenu
jr c, .goToSideMenu ; if the player chose a pokemon from the list
2014-05-22 22:13:20 +00:00
.exitPokedex
xor a
ld [wMenuWatchMovingOutOfBounds], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld [hJoy7], a
ld [wWastedByteCD3A], a
ld [wOverrideSimulatedJoypadStatesMask], a
2014-05-22 22:13:20 +00:00
pop af
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
call GBPalWhiteOutWithDelay3
2015-08-12 09:16:56 +00:00
call RunDefaultPaletteCommand
2014-05-22 22:13:20 +00:00
jp ReloadMapData
.goToSideMenu
call HandlePokedexSideMenu
dec b
jr z, .exitPokedex ; if the player chose Quit
2014-05-22 22:13:20 +00:00
dec b
jr z, .doPokemonListMenu ; if pokemon not seen or player pressed B button
2014-05-22 22:13:20 +00:00
jp .setUpGraphics ; if pokemon data or area was shown
; handles the menu on the lower right in the pokedex screen
; OUTPUT:
; b = reason for exiting menu
; 00: showed pokemon data or area
; 01: the player chose Quit
; 02: the pokemon has not been seen yet or the player pressed the B button
2016-06-12 00:24:04 +00:00
HandlePokedexSideMenu:
2014-05-22 22:13:20 +00:00
call PlaceUnfilledArrowMenuCursor
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
push af
ld b, a
ld a, [wLastMenuItem]
2014-05-22 22:13:20 +00:00
push af
ld a, [wListScrollOffset]
2014-05-22 22:13:20 +00:00
push af
add b
inc a
ld [wd11e], a
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
push af
ld a, [wDexMaxSeenMon]
2015-07-19 03:49:52 +00:00
push af ; this doesn't need to be preserved
ld hl, wPokedexSeen
2014-05-22 22:13:20 +00:00
call IsPokemonBitSet
ld b, 2
jr z, .exitSideMenu
2014-05-22 22:13:20 +00:00
call PokedexToIndex
ld hl, wTopMenuItemY
ld a, 10
ld [hli], a ; top menu item Y
ld a, 15
ld [hli], a ; top menu item X
2014-05-22 22:13:20 +00:00
xor a
ld [hli], a ; current menu item ID
2014-05-22 22:13:20 +00:00
inc hl
ld a, 3
ld [hli], a ; max menu item ID
2015-08-11 05:34:32 +00:00
;ld a, A_BUTTON | B_BUTTON
ld [hli], a ; menu watched keys (A button and B button)
2014-05-22 22:13:20 +00:00
xor a
ld [hli], a ; old menu item ID
ld [wMenuWatchMovingOutOfBounds], a
2014-05-22 22:13:20 +00:00
.handleMenuInput
call HandleMenuInput
bit 1, a ; was the B button pressed?
ld b, 2
jr nz, .buttonBPressed
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
and a
jr z, .choseData
2014-05-22 22:13:20 +00:00
dec a
jr z, .choseCry
2014-05-22 22:13:20 +00:00
dec a
jr z, .choseArea
2014-05-22 22:13:20 +00:00
.choseQuit
ld b, 1
2014-05-22 22:13:20 +00:00
.exitSideMenu
pop af
ld [wDexMaxSeenMon], a
2014-05-22 22:13:20 +00:00
pop af
ld [wd11e], a
2014-05-22 22:13:20 +00:00
pop af
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
pop af
ld [wLastMenuItem], a
2014-05-22 22:13:20 +00:00
pop af
ld [wCurrentMenuItem], a
2014-05-22 22:13:20 +00:00
push bc
2015-07-18 20:52:03 +00:00
coord hl, 0, 3
ld de, 20
2015-08-05 21:20:29 +00:00
lb bc, " ", 13
2014-05-22 22:13:20 +00:00
call DrawTileLine ; cover up the menu cursor in the pokemon list
pop bc
ret
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
.buttonBPressed
push bc
2015-07-18 20:52:03 +00:00
coord hl, 15, 10
ld de, 20
2015-08-05 21:20:29 +00:00
lb bc, " ", 7
2014-05-22 22:13:20 +00:00
call DrawTileLine ; cover up the menu cursor in the side menu
pop bc
jr .exitSideMenu
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
.choseData
call ShowPokedexDataInternal
ld b, 0
2014-05-22 22:13:20 +00:00
jr .exitSideMenu
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
; play pokemon cry
.choseCry
ld a, [wd11e]
2015-07-22 14:57:31 +00:00
call GetCryData
call PlaySound
2014-05-22 22:13:20 +00:00
jr .handleMenuInput
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
.choseArea
predef LoadTownMap_Nest ; display pokemon areas
ld b, 0
2014-05-22 22:13:20 +00:00
jr .exitSideMenu
; handles the list of pokemon on the left of the pokedex screen
; sets carry flag if player presses A, unsets carry flag if player presses B
2016-06-12 00:24:04 +00:00
HandlePokedexListMenu:
2014-05-22 22:13:20 +00:00
xor a
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
; draw the horizontal line separating the seen and owned amounts from the menu
2015-07-18 20:52:03 +00:00
coord hl, 15, 8
ld a, "─"
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
2015-07-18 20:52:03 +00:00
coord hl, 14, 0
ld [hl], $71 ; vertical line tile
2015-07-18 20:52:03 +00:00
coord hl, 14, 1
2014-05-22 22:13:20 +00:00
call DrawPokedexVerticalLine
2015-07-18 20:52:03 +00:00
coord hl, 14, 9
2014-05-22 22:13:20 +00:00
call DrawPokedexVerticalLine
ld hl, wPokedexSeen
ld b, wPokedexSeenEnd - wPokedexSeen
2014-05-22 22:13:20 +00:00
call CountSetBits
2015-08-07 11:24:06 +00:00
ld de, wNumSetBits
2015-07-18 20:52:03 +00:00
coord hl, 16, 3
2015-07-28 01:48:44 +00:00
lb bc, 1, 3
2014-05-22 22:13:20 +00:00
call PrintNumber ; print number of seen pokemon
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
2014-05-22 22:13:20 +00:00
call CountSetBits
2015-08-07 11:24:06 +00:00
ld de, wNumSetBits
2015-07-18 20:52:03 +00:00
coord hl, 16, 6
2015-07-28 01:48:44 +00:00
lb bc, 1, 3
2014-05-22 22:13:20 +00:00
call PrintNumber ; print number of owned pokemon
2015-07-18 20:52:03 +00:00
coord hl, 16, 2
ld de, PokedexSeenText
2014-05-22 22:13:20 +00:00
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 16, 5
ld de, PokedexOwnText
2014-05-22 22:13:20 +00:00
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 1, 1
ld de, PokedexContentsText
2014-05-22 22:13:20 +00:00
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 16, 10
ld de, PokedexMenuItemsText
2014-05-22 22:13:20 +00:00
call PlaceString
; find the highest pokedex number among the pokemon the player has seen
ld hl, wPokedexSeenEnd - 1
ld b, (wPokedexSeenEnd - wPokedexSeen) * 8 + 1
2014-05-22 22:13:20 +00:00
.maxSeenPokemonLoop
ld a, [hld]
ld c, 8
2014-05-22 22:13:20 +00:00
.maxSeenPokemonInnerLoop
dec b
sla a
jr c, .storeMaxSeenPokemon
2014-05-22 22:13:20 +00:00
dec c
jr nz, .maxSeenPokemonInnerLoop
2014-05-22 22:13:20 +00:00
jr .maxSeenPokemonLoop
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
.storeMaxSeenPokemon
ld a, b
ld [wDexMaxSeenMon], a
2014-05-22 22:13:20 +00:00
.loop
xor a
ld [H_AUTOBGTRANSFERENABLED], a
2015-07-18 20:52:03 +00:00
coord hl, 4, 2
2015-08-05 21:20:29 +00:00
lb bc, 14, 10
2014-05-22 22:13:20 +00:00
call ClearScreenArea
2015-07-18 20:52:03 +00:00
coord hl, 1, 3
ld a, [wListScrollOffset]
ld [wd11e], a
ld d, 7
ld a, [wDexMaxSeenMon]
cp 7
jr nc, .printPokemonLoop
ld d, a
2014-05-22 22:13:20 +00:00
dec a
ld [wMaxMenuItem], a
2014-05-22 22:13:20 +00:00
; loop to print pokemon pokedex numbers and names
; if the player has owned the pokemon, it puts a pokeball beside the name
.printPokemonLoop
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
inc a
ld [wd11e], a
2014-05-22 22:13:20 +00:00
push af
push de
push hl
ld de, -SCREEN_WIDTH
add hl, de
ld de, wd11e
2015-07-28 01:48:44 +00:00
lb bc, LEADING_ZEROES | 1, 3
2014-05-22 22:13:20 +00:00
call PrintNumber ; print the pokedex number
ld de, SCREEN_WIDTH
add hl, de
2014-05-22 22:13:20 +00:00
dec hl
push hl
ld hl, wPokedexOwned
2014-05-22 22:13:20 +00:00
call IsPokemonBitSet
pop hl
ld a, " "
jr z, .writeTile
ld a, $72 ; pokeball tile
2014-05-22 22:13:20 +00:00
.writeTile
ld [hl], a ; put a pokeball next to pokemon that the player has owned
2014-05-22 22:13:20 +00:00
push hl
ld hl, wPokedexSeen
2014-05-22 22:13:20 +00:00
call IsPokemonBitSet
jr nz, .getPokemonName ; if the player has seen the pokemon
ld de, .dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon
2014-05-22 22:13:20 +00:00
jr .skipGettingName
.dashedLine ; for unseen pokemon in the list
db "----------@"
.getPokemonName
call PokedexToIndex
call GetMonName
.skipGettingName
pop hl
inc hl
call PlaceString
pop hl
ld bc, 2 * SCREEN_WIDTH
add hl, bc
2014-05-22 22:13:20 +00:00
pop de
pop af
ld [wd11e], a
2014-05-22 22:13:20 +00:00
dec d
jr nz, .printPokemonLoop
ld a, 01
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
call Delay3
call GBPalNormal
call HandleMenuInput
bit 1, a ; was the B button pressed?
jp nz, .buttonBPressed
2014-05-22 22:13:20 +00:00
.checkIfUpPressed
bit 6, a ; was Up pressed?
jr z, .checkIfDownPressed
2014-05-22 22:13:20 +00:00
.upPressed ; scroll up one row
ld a, [wListScrollOffset]
2014-05-22 22:13:20 +00:00
and a
jp z, .loop
2014-05-22 22:13:20 +00:00
dec a
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
jp .loop
.checkIfDownPressed
bit 7, a ; was Down pressed?
jr z, .checkIfRightPressed
2014-05-22 22:13:20 +00:00
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
cp 7
jp c, .loop ; can't if the list is shorter than 7
sub 7
ld b, a
ld a, [wListScrollOffset]
2014-05-22 22:13:20 +00:00
cp b
jp z, .loop
2014-05-22 22:13:20 +00:00
inc a
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
jp .loop
.checkIfRightPressed
bit 4, a ; was Right pressed?
jr z, .checkIfLeftPressed
2014-05-22 22:13:20 +00:00
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
cp 7
jp c, .loop ; can't if the list is shorter than 7
sub 6
ld b, a
ld a, [wListScrollOffset]
add 7
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
cp b
jp c, .loop
2014-05-22 22:13:20 +00:00
dec b
ld a, b
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
jp .loop
.checkIfLeftPressed ; scroll up 7 rows
bit 5, a ; was Left pressed?
jr z, .buttonAPressed
2014-05-22 22:13:20 +00:00
.leftPressed
ld a, [wListScrollOffset]
sub 7
ld [wListScrollOffset], a
jp nc, .loop
2014-05-22 22:13:20 +00:00
xor a
ld [wListScrollOffset], a
2014-05-22 22:13:20 +00:00
jp .loop
.buttonAPressed
scf
ret
.buttonBPressed
and a
ret
2016-06-12 00:24:04 +00:00
DrawPokedexVerticalLine:
ld c, 9 ; height of line
ld de, SCREEN_WIDTH
ld a, $71 ; vertical line tile
2014-05-22 22:13:20 +00:00
.loop
ld [hl], a
add hl, de
xor 1 ; toggle between vertical line tile and box tile
2014-05-22 22:13:20 +00:00
dec c
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
PokedexSeenText:
2014-05-22 22:13:20 +00:00
db "SEEN@"
2016-06-12 00:24:04 +00:00
PokedexOwnText:
2014-05-22 22:13:20 +00:00
db "OWN@"
2016-06-12 00:24:04 +00:00
PokedexContentsText:
2014-05-22 22:13:20 +00:00
db "CONTENTS@"
2016-06-12 00:24:04 +00:00
PokedexMenuItemsText:
2014-05-22 22:13:20 +00:00
db "DATA"
next "CRY"
next "AREA"
next "QUIT@"
; tests if a pokemon's bit is set in the seen or owned pokemon bit fields
; INPUT:
; [wd11e] = pokedex number
2014-05-22 22:13:20 +00:00
; hl = address of bit field
2016-06-12 00:24:04 +00:00
IsPokemonBitSet:
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
dec a
ld c, a
ld b, FLAG_TEST
predef FlagActionPredef
ld a, c
2014-05-22 22:13:20 +00:00
and a
ret
; function to display pokedex data from outside the pokedex
2016-06-12 00:24:04 +00:00
ShowPokedexData:
2014-05-22 22:13:20 +00:00
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
callab LoadPokedexTilePatterns ; load pokedex tiles
; function to display pokedex data from inside the pokedex
2016-06-12 00:24:04 +00:00
ShowPokedexDataInternal:
ld hl, wd72c
set 1, [hl]
ld a, $33 ; 3/7 volume
ld [rNR50], a
2014-05-22 22:13:20 +00:00
call GBPalWhiteOut ; zero all palettes
call ClearScreen
ld a, [wd11e] ; pokemon ID
ld [wcf91], a
2014-05-22 22:13:20 +00:00
push af
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_POKEDEX
call RunPaletteCommand
2014-05-22 22:13:20 +00:00
pop af
ld [wd11e], a
ld a, [hTilesetType]
2014-05-22 22:13:20 +00:00
push af
xor a
ld [hTilesetType], a
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
ld de, 1
2015-08-05 21:20:29 +00:00
lb bc, $64, SCREEN_WIDTH
2014-05-22 22:13:20 +00:00
call DrawTileLine ; draw top border
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 0, 17
2015-08-05 21:20:29 +00:00
ld b, $6f
2014-05-22 22:13:20 +00:00
call DrawTileLine ; draw bottom border
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 0, 1
ld de, 20
2015-08-05 21:20:29 +00:00
lb bc, $66, $10
2014-05-22 22:13:20 +00:00
call DrawTileLine ; draw left border
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 19, 1
ld b, $67
2014-05-22 22:13:20 +00:00
call DrawTileLine ; draw right border
2016-06-12 04:30:05 +00:00
ld a, $63 ; upper left corner tile
Coorda 0, 0
ld a, $65 ; upper right corner tile
Coorda 19, 0
ld a, $6c ; lower left corner tile
Coorda 0, 17
ld a, $6e ; lower right corner tile
Coorda 19, 17
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 0, 9
ld de, PokedexDataDividerLine
2014-05-22 22:13:20 +00:00
call PlaceString ; draw horizontal divider line
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 9, 6
ld de, HeightWeightText
2014-05-22 22:13:20 +00:00
call PlaceString
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
call GetMonName
2015-07-18 20:52:03 +00:00
coord hl, 9, 2
2014-05-22 22:13:20 +00:00
call PlaceString
2016-06-12 04:30:05 +00:00
ld hl, PokedexEntryPointers
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
dec a
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl] ; de = address of pokedex entry
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 9, 4
2014-05-22 22:13:20 +00:00
call PlaceString ; print species name
2016-06-12 04:30:05 +00:00
ld h, b
ld l, c
2014-05-22 22:13:20 +00:00
push de
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
push af
call IndexToPokedex
2016-06-12 04:30:05 +00:00
2015-07-18 20:52:03 +00:00
coord hl, 2, 8
2014-05-22 22:13:20 +00:00
ld a, "№"
ld [hli], a
ld a, "⠄"
ld [hli], a
ld de, wd11e
2015-07-28 01:48:44 +00:00
lb bc, LEADING_ZEROES | 1, 3
2014-05-22 22:13:20 +00:00
call PrintNumber ; print pokedex number
2016-06-12 04:30:05 +00:00
ld hl, wPokedexOwned
2014-05-22 22:13:20 +00:00
call IsPokemonBitSet
pop af
ld [wd11e], a
ld a, [wcf91]
ld [wd0b5], a
2014-05-22 22:13:20 +00:00
pop de
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
push af
push bc
push de
push hl
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
call Delay3
call GBPalNormal
call GetMonHeader ; load pokemon picture location
2015-07-18 20:52:03 +00:00
coord hl, 1, 1
2014-05-22 22:13:20 +00:00
call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture
ld a, [wcf91]
2014-05-22 22:13:20 +00:00
call PlayCry ; play pokemon cry
2016-06-12 04:30:05 +00:00
2014-05-22 22:13:20 +00:00
pop hl
pop de
pop bc
pop af
2016-06-12 04:30:05 +00:00
ld a, c
2014-05-22 22:13:20 +00:00
and a
jp z, .waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description
2014-05-22 22:13:20 +00:00
inc de ; de = address of feet (height)
ld a, [de] ; reads feet, but a is overwritten without being used
2015-07-18 20:52:03 +00:00
coord hl, 12, 6
2015-07-28 01:48:44 +00:00
lb bc, 1, 2
2014-05-22 22:13:20 +00:00
call PrintNumber ; print feet (height)
ld a, $60 ; feet symbol tile (one tick)
ld [hl], a
2014-05-22 22:13:20 +00:00
inc de
inc de ; de = address of inches (height)
2015-07-18 20:52:03 +00:00
coord hl, 15, 6
2015-07-28 01:48:44 +00:00
lb bc, LEADING_ZEROES | 1, 2
2014-05-22 22:13:20 +00:00
call PrintNumber ; print inches (height)
ld a, $61 ; inches symbol tile (two ticks)
ld [hl], a
2014-05-22 22:13:20 +00:00
; now print the weight (note that weight is stored in tenths of pounds internally)
inc de
inc de
inc de ; de = address of upper byte of weight
push de
2015-07-18 15:17:29 +00:00
; put weight in big-endian order at hDexWeight
ld hl, hDexWeight
ld a, [hl] ; save existing value of [hDexWeight]
2014-05-22 22:13:20 +00:00
push af
ld a, [de] ; a = upper byte of weight
ld [hli], a ; store upper byte of weight in [hDexWeight]
ld a, [hl] ; save existing value of [hDexWeight + 1]
2014-05-22 22:13:20 +00:00
push af
dec de
ld a, [de] ; a = lower byte of weight
ld [hl], a ; store lower byte of weight in [hDexWeight + 1]
ld de, hDexWeight
2015-07-18 20:52:03 +00:00
coord hl, 11, 8
2015-07-28 01:48:44 +00:00
lb bc, 2, 5 ; 2 bytes, 5 digits
2014-05-22 22:13:20 +00:00
call PrintNumber ; print weight
2015-07-18 20:52:03 +00:00
coord hl, 14, 8
ld a, [hDexWeight + 1]
sub 10
ld a, [hDexWeight]
sbc 0
jr nc, .next
ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point
2014-05-22 22:13:20 +00:00
.next
inc hl
ld a, [hli]
ld [hld], a ; make space for the decimal point by moving the last digit forward one tile
ld [hl], "⠄" ; decimal point tile
2014-05-22 22:13:20 +00:00
pop af
ld [hDexWeight + 1], a ; restore original value of [hDexWeight + 1]
2014-05-22 22:13:20 +00:00
pop af
ld [hDexWeight], a ; restore original value of [hDexWeight]
2014-05-22 22:13:20 +00:00
pop hl
inc hl ; hl = address of pokedex description text
2015-07-18 20:52:03 +00:00
coord bc, 1, 11
ld a, 2
ld [$fff4], a
2014-05-22 22:13:20 +00:00
call TextCommandProcessor ; print pokedex description text
xor a
ld [$fff4], a
2014-05-22 22:13:20 +00:00
.waitForButtonPress
2014-05-25 18:21:48 +00:00
call JoypadLowSensitivity
ld a, [hJoy5]
and A_BUTTON | B_BUTTON
jr z, .waitForButtonPress
2014-05-22 22:13:20 +00:00
pop af
ld [hTilesetType], a
2014-05-22 22:13:20 +00:00
call GBPalWhiteOut
call ClearScreen
2015-08-12 09:16:56 +00:00
call RunDefaultPaletteCommand
2014-05-22 22:13:20 +00:00
call LoadTextBoxTilePatterns
call GBPalNormal
ld hl, wd72c
res 1, [hl]
ld a, $77 ; max volume
ld [rNR50], a
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
HeightWeightText:
2016-07-18 06:17:03 +00:00
db "HT ?",$60,"??",$61
next "WT ???lb@"
2014-05-22 22:13:20 +00:00
; XXX does anything point to this?
2016-06-12 00:24:04 +00:00
PokeText:
2015-06-12 16:00:48 +00:00
db "#@"
2014-05-22 22:13:20 +00:00
; horizontal line that divides the pokedex text description from the rest of the data
2016-06-12 00:24:04 +00:00
PokedexDataDividerLine:
2014-05-22 22:13:20 +00:00
db $68,$69,$6B,$69,$6B
db $69,$6B,$69,$6B,$6B
db $6B,$6B,$69,$6B,$69
db $6B,$69,$6B,$69,$6A
2016-07-18 06:17:03 +00:00
db "@"
2014-05-22 22:13:20 +00:00
; draws a line of tiles
; INPUT:
; b = tile ID
; c = number of tile ID's to write
; de = amount to destination address after each tile (1 for horizontal, 20 for vertical)
; hl = destination address
2016-06-12 00:24:04 +00:00
DrawTileLine:
2014-05-22 22:13:20 +00:00
push bc
push de
.loop
ld [hl], b
add hl, de
2014-05-22 22:13:20 +00:00
dec c
jr nz, .loop
2014-05-22 22:13:20 +00:00
pop de
pop bc
ret
INCLUDE "data/pokedex_entries.asm"
2016-06-12 00:24:04 +00:00
PokedexToIndex:
; converts the Pokédex number at wd11e to an index
2014-05-22 22:13:20 +00:00
push bc
push hl
ld a, [wd11e]
ld b, a
ld c, 0
ld hl, PokedexOrder
2014-05-22 22:13:20 +00:00
.loop ; go through the list until we find an entry with a matching dex number
inc c
ld a, [hli]
2014-05-22 22:13:20 +00:00
cp b
jr nz, .loop
2014-05-22 22:13:20 +00:00
ld a, c
ld [wd11e], a
2014-05-22 22:13:20 +00:00
pop hl
pop bc
ret
2016-06-12 00:24:04 +00:00
IndexToPokedex:
2017-06-24 20:01:43 +00:00
; converts the index number at wd11e to a Pokédex number
2014-05-22 22:13:20 +00:00
push bc
push hl
ld a, [wd11e]
2014-05-22 22:13:20 +00:00
dec a
ld hl, PokedexOrder
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd11e], a
2014-05-22 22:13:20 +00:00
pop hl
pop bc
ret
INCLUDE "data/pokedex_order.asm"