2016-06-12 00:24:04 +00:00
|
|
|
ShowPokedexMenu:
|
2014-05-22 22:13:20 +00:00
|
|
|
call GBPalWhiteOut
|
|
|
|
call ClearScreen
|
2015-07-03 19:37:53 +00:00
|
|
|
call UpdateSprites
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [wCurrentMenuItem],a
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
ld [wLastMenuItem],a
|
|
|
|
inc a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-08-31 02:48:49 +00:00
|
|
|
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
|
|
|
|
xor a
|
|
|
|
ld [hli],a ; top menu item X
|
|
|
|
inc a
|
2015-07-13 07:32:03 +00:00
|
|
|
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
|
2015-08-11 05:34:32 +00:00
|
|
|
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
|
|
|
|
.exitPokedex
|
|
|
|
xor a
|
2015-07-13 07:32:03 +00:00
|
|
|
ld [wMenuWatchMovingOutOfBounds],a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld [wCurrentMenuItem],a
|
|
|
|
ld [wLastMenuItem],a
|
2014-08-31 02:48:49 +00:00
|
|
|
ld [hJoy7],a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wWastedByteCD3A],a
|
|
|
|
ld [wOverrideSimulatedJoypadStatesMask],a
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
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
|
|
|
|
dec b
|
|
|
|
jr z,.doPokemonListMenu ; if pokemon not seen or player pressed B button
|
|
|
|
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]
|
|
|
|
push af
|
|
|
|
ld b,a
|
|
|
|
ld a,[wLastMenuItem]
|
|
|
|
push af
|
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
push af
|
|
|
|
add b
|
|
|
|
inc a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
|
|
|
ld a,[wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a,[wDexMaxSeenMon]
|
|
|
|
push af ; this doesn't need to be preserved
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl,wPokedexSeen
|
|
|
|
call IsPokemonBitSet
|
|
|
|
ld b,2
|
|
|
|
jr z,.exitSideMenu
|
|
|
|
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
|
|
|
|
xor a
|
|
|
|
ld [hli],a ; current menu item ID
|
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld [hli],a ; menu watched keys (A button and B button)
|
|
|
|
xor a
|
|
|
|
ld [hli],a ; old menu item ID
|
2015-07-13 07:32:03 +00:00
|
|
|
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]
|
|
|
|
and a
|
|
|
|
jr z,.choseData
|
|
|
|
dec a
|
|
|
|
jr z,.choseCry
|
|
|
|
dec a
|
|
|
|
jr z,.choseArea
|
|
|
|
.choseQuit
|
|
|
|
ld b,1
|
|
|
|
.exitSideMenu
|
|
|
|
pop af
|
2015-07-19 03:49:52 +00:00
|
|
|
ld [wDexMaxSeenMon],a
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
pop af
|
|
|
|
ld [wLastMenuItem],a
|
|
|
|
pop af
|
|
|
|
ld [wCurrentMenuItem],a
|
|
|
|
push bc
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 0, 3
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
|
|
|
jr .exitSideMenu
|
2016-06-12 04:30:05 +00:00
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
; play pokemon cry
|
|
|
|
.choseCry
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd11e]
|
2015-07-22 14:57:31 +00:00
|
|
|
call GetCryData
|
2015-07-03 19:37:53 +00:00
|
|
|
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
|
2014-06-16 20:57:26 +00:00
|
|
|
predef LoadTownMap_Nest ; display pokemon areas
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b,0
|
|
|
|
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
|
|
|
|
; 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
|
2016-07-18 06:17:03 +00:00
|
|
|
ld a,"─"
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,PokedexSeenText
|
|
|
|
call PlaceString
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 16, 5
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,PokedexOwnText
|
|
|
|
call PlaceString
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 1, 1
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,PokedexContentsText
|
|
|
|
call PlaceString
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 16, 10
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,PokedexMenuItemsText
|
|
|
|
call PlaceString
|
|
|
|
; find the highest pokedex number among the pokemon the player has seen
|
|
|
|
ld hl,wPokedexSeenEnd - 1
|
2015-02-20 05:56:30 +00:00
|
|
|
ld b,(wPokedexSeenEnd - wPokedexSeen) * 8 + 1
|
2014-05-22 22:13:20 +00:00
|
|
|
.maxSeenPokemonLoop
|
|
|
|
ld a,[hld]
|
|
|
|
ld c,8
|
|
|
|
.maxSeenPokemonInnerLoop
|
|
|
|
dec b
|
|
|
|
sla a
|
|
|
|
jr c,.storeMaxSeenPokemon
|
|
|
|
dec c
|
|
|
|
jr nz,.maxSeenPokemonInnerLoop
|
|
|
|
jr .maxSeenPokemonLoop
|
2016-06-12 04:30:05 +00:00
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
.storeMaxSeenPokemon
|
|
|
|
ld a,b
|
2015-07-19 03:49:52 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,[wListScrollOffset]
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld d,7
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a,[wDexMaxSeenMon]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp a,7
|
|
|
|
jr nc,.printPokemonLoop
|
|
|
|
ld d,a
|
|
|
|
dec a
|
|
|
|
ld [wMaxMenuItem],a
|
|
|
|
; loop to print pokemon pokedex numbers and names
|
|
|
|
; if the player has owned the pokemon, it puts a pokeball beside the name
|
|
|
|
.printPokemonLoop
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
inc a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
|
|
|
push de
|
|
|
|
push hl
|
2015-07-28 01:48:44 +00:00
|
|
|
ld de,-SCREEN_WIDTH
|
2014-05-22 22:13:20 +00:00
|
|
|
add hl,de
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2015-07-28 01:48:44 +00:00
|
|
|
ld de,SCREEN_WIDTH
|
2014-05-22 22:13:20 +00:00
|
|
|
add hl,de
|
|
|
|
dec hl
|
|
|
|
push hl
|
|
|
|
ld hl,wPokedexOwned
|
|
|
|
call IsPokemonBitSet
|
|
|
|
pop hl
|
|
|
|
ld a," "
|
|
|
|
jr z,.writeTile
|
|
|
|
ld a,$72 ; pokeball tile
|
|
|
|
.writeTile
|
|
|
|
ld [hl],a ; put a pokeball next to pokemon that the player has owned
|
|
|
|
push hl
|
|
|
|
ld hl,wPokedexSeen
|
|
|
|
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
|
|
|
|
jr .skipGettingName
|
|
|
|
.dashedLine ; for unseen pokemon in the list
|
|
|
|
db "----------@"
|
|
|
|
.getPokemonName
|
|
|
|
call PokedexToIndex
|
|
|
|
call GetMonName
|
|
|
|
.skipGettingName
|
|
|
|
pop hl
|
|
|
|
inc hl
|
|
|
|
call PlaceString
|
|
|
|
pop hl
|
2016-07-18 06:17:03 +00:00
|
|
|
ld bc,2 * SCREEN_WIDTH
|
2014-05-22 22:13:20 +00:00
|
|
|
add hl,bc
|
|
|
|
pop de
|
|
|
|
pop af
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-05-22 22:13:20 +00:00
|
|
|
dec d
|
|
|
|
jr nz,.printPokemonLoop
|
|
|
|
ld a,01
|
|
|
|
ld [H_AUTOBGTRANSFERENABLED],a
|
|
|
|
call Delay3
|
|
|
|
call GBPalNormal
|
|
|
|
call HandleMenuInput
|
|
|
|
bit 1,a ; was the B button pressed?
|
|
|
|
jp nz,.buttonBPressed
|
|
|
|
.checkIfUpPressed
|
|
|
|
bit 6,a ; was Up pressed?
|
|
|
|
jr z,.checkIfDownPressed
|
|
|
|
.upPressed ; scroll up one row
|
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
and a
|
|
|
|
jp z,.loop
|
|
|
|
dec a
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
jp .loop
|
|
|
|
.checkIfDownPressed
|
|
|
|
bit 7,a ; was Down pressed?
|
|
|
|
jr z,.checkIfRightPressed
|
|
|
|
.downPressed ; scroll down one row
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a,[wDexMaxSeenMon]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp a,7
|
2015-07-19 03:49:52 +00:00
|
|
|
jp c,.loop ; can't if the list is shorter than 7
|
2014-05-22 22:13:20 +00:00
|
|
|
sub a,7
|
|
|
|
ld b,a
|
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
cp b
|
|
|
|
jp z,.loop
|
|
|
|
inc a
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
jp .loop
|
|
|
|
.checkIfRightPressed
|
|
|
|
bit 4,a ; was Right pressed?
|
|
|
|
jr z,.checkIfLeftPressed
|
|
|
|
.rightPressed ; scroll down 7 rows
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a,[wDexMaxSeenMon]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp a,7
|
2015-07-19 03:49:52 +00:00
|
|
|
jp c,.loop ; can't if the list is shorter than 7
|
2014-05-22 22:13:20 +00:00
|
|
|
sub a,6
|
|
|
|
ld b,a
|
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
add a,7
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
cp b
|
|
|
|
jp c,.loop
|
|
|
|
dec b
|
|
|
|
ld a,b
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
jp .loop
|
|
|
|
.checkIfLeftPressed ; scroll up 7 rows
|
|
|
|
bit 5,a ; was Left pressed?
|
|
|
|
jr z,.buttonAPressed
|
|
|
|
.leftPressed
|
|
|
|
ld a,[wListScrollOffset]
|
|
|
|
sub a,7
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
jp nc,.loop
|
|
|
|
xor a
|
|
|
|
ld [wListScrollOffset],a
|
|
|
|
jp .loop
|
|
|
|
.buttonAPressed
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
.buttonBPressed
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
DrawPokedexVerticalLine:
|
2014-05-22 22:13:20 +00:00
|
|
|
ld c,9 ; height of line
|
2016-07-18 06:17:03 +00:00
|
|
|
ld de,SCREEN_WIDTH
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$71 ; vertical line tile
|
|
|
|
.loop
|
|
|
|
ld [hl],a
|
|
|
|
add hl,de
|
|
|
|
xor a,1 ; toggle between vertical line tile and box tile
|
|
|
|
dec c
|
|
|
|
jr nz,.loop
|
|
|
|
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:
|
2014-05-26 21:04:56 +00:00
|
|
|
; [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:
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
dec a
|
|
|
|
ld c,a
|
2015-07-20 03:45:34 +00:00
|
|
|
ld b,FLAG_TEST
|
2014-06-16 20:57:26 +00:00
|
|
|
predef FlagActionPredef
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,c
|
|
|
|
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:
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl,wd72c
|
2014-05-22 22:13:20 +00:00
|
|
|
set 1,[hl]
|
|
|
|
ld a,$33 ; 3/7 volume
|
2015-08-09 05:32:44 +00:00
|
|
|
ld [rNR50],a
|
2014-05-22 22:13:20 +00:00
|
|
|
call GBPalWhiteOut ; zero all palettes
|
|
|
|
call ClearScreen
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-09-14 18:29:18 +00:00
|
|
|
ld a,[hTilesetType]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
|
|
|
xor a
|
2014-09-14 18:29:18 +00:00
|
|
|
ld [hTilesetType],a
|
2016-06-12 04:30:05 +00:00
|
|
|
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 0, 0
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b,$67
|
|
|
|
call DrawTileLine ; draw right border
|
2016-06-12 04:30:05 +00:00
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$63 ; upper left corner tile
|
2014-06-25 20:58:27 +00:00
|
|
|
Coorda 0, 0
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$65 ; upper right corner tile
|
2014-06-25 20:58:27 +00:00
|
|
|
Coorda 19, 0
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$6c ; lower left corner tile
|
2014-06-25 20:58:27 +00:00
|
|
|
Coorda 0, 17
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$6e ; lower right corner tile
|
2014-06-25 20:58:27 +00:00
|
|
|
Coorda 19, 17
|
2016-06-12 04:30:05 +00:00
|
|
|
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 0, 9
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,PokedexDataDividerLine
|
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de,HeightWeightText
|
|
|
|
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
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl,PokedexEntryPointers
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
ld h,b
|
|
|
|
ld l,c
|
|
|
|
push de
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2016-07-18 06:48:34 +00:00
|
|
|
ld a,"⠄"
|
2014-05-22 22:13:20 +00:00
|
|
|
ld [hli],a
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl,wPokedexOwned
|
|
|
|
call IsPokemonBitSet
|
|
|
|
pop af
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
|
|
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,c
|
|
|
|
and a
|
|
|
|
jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description
|
|
|
|
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
|
|
|
|
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
|
|
|
|
; 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
|
2015-07-18 15:17:29 +00:00
|
|
|
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
|
2015-07-18 15:17:29 +00:00
|
|
|
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
|
2015-07-18 15:17:29 +00:00
|
|
|
ld a,[hDexWeight + 1]
|
2014-05-22 22:13:20 +00:00
|
|
|
sub a,10
|
2015-07-18 15:17:29 +00:00
|
|
|
ld a,[hDexWeight]
|
2014-05-22 22:13:20 +00:00
|
|
|
sbc a,0
|
|
|
|
jr nc,.next
|
|
|
|
ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point
|
|
|
|
.next
|
|
|
|
inc hl
|
|
|
|
ld a,[hli]
|
|
|
|
ld [hld],a ; make space for the decimal point by moving the last digit forward one tile
|
2016-07-18 06:48:34 +00:00
|
|
|
ld [hl],"⠄" ; decimal point tile
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
2015-07-18 15:17:29 +00:00
|
|
|
ld [hDexWeight + 1],a ; restore original value of [hDexWeight + 1]
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
2015-07-18 15:17:29 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,2
|
|
|
|
ld [$fff4],a
|
|
|
|
call TextCommandProcessor ; print pokedex description text
|
|
|
|
xor a
|
|
|
|
ld [$fff4],a
|
|
|
|
.waitForButtonPress
|
2014-05-25 18:21:48 +00:00
|
|
|
call JoypadLowSensitivity
|
2014-08-31 02:48:49 +00:00
|
|
|
ld a,[hJoy5]
|
2015-07-14 08:46:23 +00:00
|
|
|
and a,A_BUTTON | B_BUTTON
|
2014-05-22 22:13:20 +00:00
|
|
|
jr z,.waitForButtonPress
|
|
|
|
pop af
|
2014-09-14 18:29:18 +00:00
|
|
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl,wd72c
|
2014-05-22 22:13:20 +00:00
|
|
|
res 1,[hl]
|
|
|
|
ld a,$77 ; max volume
|
2015-08-09 05:32:44 +00:00
|
|
|
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
|
|
|
|
dec c
|
|
|
|
jr nz,.loop
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
|
|
|
INCLUDE "data/pokedex_entries.asm"
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
PokedexToIndex:
|
2014-05-26 21:04:56 +00:00
|
|
|
; converts the Pokédex number at wd11e to an index
|
2014-05-22 22:13:20 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b,a
|
|
|
|
ld c,0
|
|
|
|
ld hl,PokedexOrder
|
|
|
|
|
|
|
|
.loop ; go through the list until we find an entry with a matching dex number
|
|
|
|
inc c
|
|
|
|
ld a,[hli]
|
|
|
|
cp b
|
|
|
|
jr nz,.loop
|
|
|
|
|
|
|
|
ld a,c
|
2014-05-26 21:04:56 +00:00
|
|
|
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:
|
2014-05-26 21:04:56 +00:00
|
|
|
; converts the indexédex number at wd11e to a Pokédex number
|
2014-05-22 22:13:20 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
2014-05-26 21:04:56 +00:00
|
|
|
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]
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e],a
|
2014-05-22 22:13:20 +00:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
|
|
|
INCLUDE "data/pokedex_order.asm"
|