summaryrefslogtreecommitdiff
path: root/engine/menus/draw_start_menu.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/menus/draw_start_menu.asm
parent53fcd05aa24693093d8af1dc8ec4fedd3957decc (diff)
Sync with pokered
Diffstat (limited to 'engine/menus/draw_start_menu.asm')
-rw-r--r--engine/menus/draw_start_menu.asm87
1 files changed, 87 insertions, 0 deletions
diff --git a/engine/menus/draw_start_menu.asm b/engine/menus/draw_start_menu.asm
new file mode 100644
index 00000000..7ca75ecb
--- /dev/null
+++ b/engine/menus/draw_start_menu.asm
@@ -0,0 +1,87 @@
+; function that displays the start menu
+DrawStartMenu::
+ CheckEvent EVENT_GOT_POKEDEX
+; menu with pokedex
+ hlcoord 10, 0
+ lb bc, 14, 8
+ jr nz, .drawTextBoxBorder
+; shorter menu if the player doesn't have the pokedex
+ hlcoord 10, 0
+ lb bc, 12, 8
+.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
+ xor a
+ ld [wMenuWatchMovingOutOfBounds], a
+ ld hl, wd730
+ set 6, [hl] ; no pauses between printing each letter
+ hlcoord 12, 2
+ CheckEvent EVENT_GOT_POKEDEX
+; case for not having pokedex
+ ld a, $06
+ jr z, .storeMenuItemCount
+; case for having pokedex
+ ld de, StartMenuPokedexText
+ call PrintStartMenuItem
+ ld a, $07
+.storeMenuItemCount
+ ld [wMaxMenuItem], a ; number of menu items
+ ld de, StartMenuPokemonText
+ call PrintStartMenuItem
+ ld de, StartMenuItemText
+ call PrintStartMenuItem
+ ld de, wPlayerName ; player's name
+ call PrintStartMenuItem
+ ld a, [wd72e]
+ bit 6, a ; is the player using the link feature?
+; case for not using link feature
+ ld de, StartMenuSaveText
+ jr z, .printSaveOrResetText
+; case for using link feature
+ ld de, StartMenuResetText
+.printSaveOrResetText
+ call PrintStartMenuItem
+ ld de, StartMenuOptionText
+ call PrintStartMenuItem
+ ld de, StartMenuExitText
+ call PlaceString
+ ld hl, wd730
+ res 6, [hl] ; turn pauses between printing letters back on
+ ret
+
+StartMenuPokedexText:
+ db "POKéDEX@"
+
+StartMenuPokemonText:
+ db "#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
+ ret