2016-06-12 00:24:04 +00:00
|
|
|
DisplayStartMenu::
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, BANK(StartMenu_Pokedex)
|
|
|
|
ld [H_LOADEDROMBANK], a
|
|
|
|
ld [MBC1RomBank], a
|
|
|
|
ld a, [wWalkBikeSurfState] ; walking/biking/surfing
|
|
|
|
ld [wWalkBikeSurfStateCopy], a
|
2015-07-19 08:46:12 +00:00
|
|
|
ld a, SFX_START_MENU
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
RedisplayStartMenu::
|
2014-05-22 22:13:20 +00:00
|
|
|
callba DrawStartMenu
|
|
|
|
callba PrintSafariZoneSteps ; print Safari Zone info, if in Safari Zone
|
2015-07-03 19:37:53 +00:00
|
|
|
call UpdateSprites
|
2014-05-22 22:13:20 +00:00
|
|
|
.loop
|
|
|
|
call HandleMenuInput
|
2017-12-30 00:54:27 +00:00
|
|
|
ld b, a
|
2014-05-22 22:13:20 +00:00
|
|
|
.checkIfUpPressed
|
2017-12-30 00:54:27 +00:00
|
|
|
bit 6, a ; was Up pressed?
|
|
|
|
jr z, .checkIfDownPressed
|
|
|
|
ld a, [wCurrentMenuItem] ; menu selection
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
2017-12-30 00:54:27 +00:00
|
|
|
jr nz, .loop
|
|
|
|
ld a, [wLastMenuItem]
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
2017-12-30 00:54:27 +00:00
|
|
|
jr nz, .loop
|
2014-05-22 22:13:20 +00:00
|
|
|
; if the player pressed tried to go past the top item, wrap around to the bottom
|
2015-07-21 01:32:02 +00:00
|
|
|
CheckEvent EVENT_GOT_POKEDEX
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6
|
|
|
|
jr nz, .wrapMenuItemId
|
2014-05-22 22:13:20 +00:00
|
|
|
dec a ; there are only 6 menu items without the pokedex
|
|
|
|
.wrapMenuItemId
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call EraseMenuCursor
|
|
|
|
jr .loop
|
|
|
|
.checkIfDownPressed
|
2017-12-30 00:54:27 +00:00
|
|
|
bit 7, a
|
|
|
|
jr z, .buttonPressed
|
2014-05-22 22:13:20 +00:00
|
|
|
; if the player pressed tried to go past the bottom item, wrap around to the top
|
2015-07-21 01:32:02 +00:00
|
|
|
CheckEvent EVENT_GOT_POKEDEX
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
ld c, 7 ; there are 7 menu items with the pokedex
|
|
|
|
jr nz, .checkIfPastBottom
|
2014-05-22 22:13:20 +00:00
|
|
|
dec c ; there are only 6 menu items without the pokedex
|
|
|
|
.checkIfPastBottom
|
|
|
|
cp c
|
2017-12-30 00:54:27 +00:00
|
|
|
jr nz, .loop
|
2014-05-22 22:13:20 +00:00
|
|
|
; the player went past the bottom, so wrap to the top
|
|
|
|
xor a
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call EraseMenuCursor
|
|
|
|
jr .loop
|
|
|
|
.buttonPressed ; A, B, or Start button pressed
|
|
|
|
call PlaceUnfilledArrowMenuCursor
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
|
|
|
|
ld a, b
|
|
|
|
and %00001010 ; was the Start button or B button pressed?
|
|
|
|
jp nz, CloseStartMenu
|
2014-05-22 22:13:20 +00:00
|
|
|
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
|
2015-07-21 01:32:02 +00:00
|
|
|
CheckEvent EVENT_GOT_POKEDEX
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [wCurrentMenuItem]
|
|
|
|
jr nz, .displayMenuItem
|
2014-05-22 22:13:20 +00:00
|
|
|
inc a ; adjust position to account for missing pokedex menu item
|
|
|
|
.displayMenuItem
|
2017-12-30 00:54:27 +00:00
|
|
|
cp 0
|
|
|
|
jp z, StartMenu_Pokedex
|
|
|
|
cp 1
|
|
|
|
jp z, StartMenu_Pokemon
|
|
|
|
cp 2
|
|
|
|
jp z, StartMenu_Item
|
|
|
|
cp 3
|
|
|
|
jp z, StartMenu_TrainerInfo
|
|
|
|
cp 4
|
|
|
|
jp z, StartMenu_SaveReset
|
|
|
|
cp 5
|
|
|
|
jp z, StartMenu_Option
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
; EXIT falls through to here
|
2016-06-12 00:24:04 +00:00
|
|
|
CloseStartMenu::
|
2014-05-25 18:21:48 +00:00
|
|
|
call Joypad
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [hJoyPressed]
|
|
|
|
bit 0, a ; was A button newly pressed?
|
|
|
|
jr nz, CloseStartMenu
|
2014-05-22 22:13:20 +00:00
|
|
|
call LoadTextBoxTilePatterns
|
|
|
|
jp CloseTextDisplay
|