draw_start_menu.asm 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ; function that displays the start menu
  2. DrawStartMenu:
  3. CheckEvent EVENT_GOT_POKEDEX
  4. ; menu with pokedex
  5. coord hl, 10, 0
  6. ld b, $0e
  7. ld c, $08
  8. jr nz, .drawTextBoxBorder
  9. ; shorter menu if the player doesn't have the pokedex
  10. coord hl, 10, 0
  11. ld b, $0c
  12. ld c, $08
  13. .drawTextBoxBorder
  14. call TextBoxBorder
  15. ld a, D_DOWN | D_UP | START | B_BUTTON | A_BUTTON
  16. ld [wMenuWatchedKeys], a
  17. ld a, $02
  18. ld [wTopMenuItemY], a ; Y position of first menu choice
  19. ld a, $0b
  20. ld [wTopMenuItemX], a ; X position of first menu choice
  21. ld a, [wBattleAndStartSavedMenuItem] ; remembered menu selection from last time
  22. ld [wCurrentMenuItem], a
  23. ld [wLastMenuItem], a
  24. xor a
  25. ld [wMenuWatchMovingOutOfBounds], a
  26. ld hl, wd730
  27. set 6, [hl] ; no pauses between printing each letter
  28. coord hl, 12, 2
  29. CheckEvent EVENT_GOT_POKEDEX
  30. ; case for not having pokedex
  31. ld a, $06
  32. jr z, .storeMenuItemCount
  33. ; case for having pokedex
  34. ld de, StartMenuPokedexText
  35. call PrintStartMenuItem
  36. ld a, $07
  37. .storeMenuItemCount
  38. ld [wMaxMenuItem], a ; number of menu items
  39. ld de, StartMenuPokemonText
  40. call PrintStartMenuItem
  41. ld de, StartMenuItemText
  42. call PrintStartMenuItem
  43. ld de, wPlayerName ; player's name
  44. call PrintStartMenuItem
  45. ld a, [wd72e]
  46. bit 6, a ; is the player using the link feature?
  47. ; case for not using link feature
  48. ld de, StartMenuSaveText
  49. jr z, .printSaveOrResetText
  50. ; case for using link feature
  51. ld de, StartMenuResetText
  52. .printSaveOrResetText
  53. call PrintStartMenuItem
  54. ld de, StartMenuOptionText
  55. call PrintStartMenuItem
  56. ld de, StartMenuExitText
  57. call PlaceString
  58. ld hl, wd730
  59. res 6, [hl] ; turn pauses between printing letters back on
  60. ret
  61. StartMenuPokedexText:
  62. db "POKéDEX@"
  63. StartMenuPokemonText:
  64. db "POKéMON@"
  65. StartMenuItemText:
  66. db "ITEM@"
  67. StartMenuSaveText:
  68. db "SAVE@"
  69. StartMenuResetText:
  70. db "RESET@"
  71. StartMenuExitText:
  72. db "EXIT@"
  73. StartMenuOptionText:
  74. db "OPTION@"
  75. PrintStartMenuItem:
  76. push hl
  77. call PlaceString
  78. pop hl
  79. ld de, SCREEN_WIDTH * 2
  80. add hl, de
  81. ret