pokered/engine/menus/draw_start_menu.asm

90 lines
1.9 KiB
NASM
Raw Normal View History

2016-09-18 01:17:57 +00:00
; function that displays the start menu
DrawStartMenu::
2016-09-18 01:17:57 +00:00
CheckEvent EVENT_GOT_POKEDEX
; menu with pokedex
hlcoord 10, 0
ld b, $0e
ld c, $08
jr nz, .drawTextBoxBorder
2016-09-18 01:17:57 +00:00
; shorter menu if the player doesn't have the pokedex
hlcoord 10, 0
ld b, $0c
ld c, $08
2016-09-18 01:17:57 +00:00
.drawTextBoxBorder
call TextBoxBorder
ld a, D_DOWN | D_UP | START | B_BUTTON | A_BUTTON
ld [wMenuWatchedKeys], a
ld a, $02
ld [wTopMenuItemY], a ; Y position of first menu choice
ld a, $0b
ld [wTopMenuItemX], a ; X position of first menu choice
ld a, [wBattleAndStartSavedMenuItem] ; remembered menu selection from last time
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
2016-09-18 01:17:57 +00:00
xor a
ld [wMenuWatchMovingOutOfBounds], a
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 12, 2
2016-09-18 01:17:57 +00:00
CheckEvent EVENT_GOT_POKEDEX
2017-06-24 20:01:43 +00:00
; case for not having pokedex
ld a, $06
jr z, .storeMenuItemCount
2016-09-18 01:17:57 +00:00
; case for having pokedex
ld de, StartMenuPokedexText
2016-09-18 01:17:57 +00:00
call PrintStartMenuItem
ld a, $07
2016-09-18 01:17:57 +00:00
.storeMenuItemCount
ld [wMaxMenuItem], a ; number of menu items
ld de, StartMenuPokemonText
2016-09-18 01:17:57 +00:00
call PrintStartMenuItem
ld de, StartMenuItemText
2016-09-18 01:17:57 +00:00
call PrintStartMenuItem
ld de, wPlayerName ; player's name
2016-09-18 01:17:57 +00:00
call PrintStartMenuItem
ld a, [wStatusFlags4]
bit BIT_LINK_CONNECTED, a
2016-09-18 01:17:57 +00:00
; case for not using link feature
ld de, StartMenuSaveText
jr z, .printSaveOrResetText
2016-09-18 01:17:57 +00:00
; case for using link feature
ld de, StartMenuResetText
2016-09-18 01:17:57 +00:00
.printSaveOrResetText
call PrintStartMenuItem
ld de, StartMenuOptionText
2016-09-18 01:17:57 +00:00
call PrintStartMenuItem
ld de, StartMenuExitText
2016-09-18 01:17:57 +00:00
call PlaceString
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
2016-09-18 01:17:57 +00:00
ret
StartMenuPokedexText:
db "POKéDEX@"
StartMenuPokemonText:
db "POKéMON@"
StartMenuItemText:
db "ITEM@"
StartMenuSaveText:
db "SAVE@"
StartMenuResetText:
db "RESET@"
StartMenuExitText:
db "EXIT@"
StartMenuOptionText:
db "OPTION@"
PrintStartMenuItem:
push hl
call PlaceString
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
2016-09-18 01:17:57 +00:00
ret