diff options
Diffstat (limited to 'home/menu.asm')
-rw-r--r-- | home/menu.asm | 129 |
1 files changed, 41 insertions, 88 deletions
diff --git a/home/menu.asm b/home/menu.asm index 05ec1212a..d10b6e936 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -1,6 +1,5 @@ ; Functions used in displaying and handling menus. - LoadMenuHeader:: call CopyMenuHeader call PushWindow @@ -13,61 +12,50 @@ CopyMenuHeader:: ld a, [hROMBank] ld [wMenuDataBank], a ret -; 0x1d4b -StoreTo_wMenuCursorBuffer:: ; 1d4b +StoreTo_wMenuCursorBuffer:: ld [wMenuCursorBuffer], a ret -; 1d4f - -MenuTextBox:: ; 1d4f +MenuTextBox:: push hl call LoadMenuTextBox pop hl jp PrintText -; 1d57 ; unused ret -; 1d58 -LoadMenuTextBox:: ; 1d58 +LoadMenuTextBox:: ld hl, .MenuHeader call LoadMenuHeader ret -; 1d5f -.MenuHeader: ; 1d5f +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw vTiles0 db 0 ; default option -; 1d67 -MenuTextBoxBackup:: ; 1d67 +MenuTextBoxBackup:: call MenuTextBox call CloseWindow ret -; 1d6e -LoadStandardMenuHeader:: ; 1d6e +LoadStandardMenuHeader:: ld hl, .MenuHeader call LoadMenuHeader ret -; 1d75 -.MenuHeader: ; 1d75 +.MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw 0 db 1 ; default option -; 1d7d -Call_ExitMenu:: ; 1d7d +Call_ExitMenu:: call ExitMenu ret -; 1d81 VerticalMenu:: xor a @@ -92,15 +80,13 @@ VerticalMenu:: .okay and a ret -; 0x1dab -GetMenu2:: ; 1dab +GetMenu2:: call LoadMenuHeader call VerticalMenu call CloseWindow ld a, [wMenuCursorY] ret -; 1db8 CopyNameFromMenu:: push hl @@ -120,20 +106,18 @@ CopyNameFromMenu:: pop bc pop hl ret -; 0x1dcf - -YesNoBox:: ; 1dcf +YesNoBox:: lb bc, SCREEN_WIDTH - 6, 7 -PlaceYesNoBox:: ; 1dd2 +PlaceYesNoBox:: jr _YesNoBox -PlaceGenericTwoOptionBox:: ; 1dd4 +PlaceGenericTwoOptionBox:: call LoadMenuHeader jr InterpretTwoOptionMenu -_YesNoBox:: ; 1dd9 +_YesNoBox:: ; Return nc (yes) or c (no). push bc ld hl, YesNoMenuHeader @@ -158,7 +142,7 @@ _YesNoBox:: ; 1dd9 ld [wMenuBorderBottomCoord], a call PushWindow -InterpretTwoOptionMenu:: ; 1dfe +InterpretTwoOptionMenu:: call VerticalMenu push af ld c, $f @@ -177,29 +161,25 @@ InterpretTwoOptionMenu:: ; 1dfe ld [wMenuCursorY], a scf ret -; 1e1d -YesNoMenuHeader:: ; 1e1d +YesNoMenuHeader:: db MENU_BACKUP_TILES ; flags menu_coords 10, 5, 15, 9 dw .MenuData db 1 ; default option -; 1e25 -.MenuData: ; 1e25 +.MenuData: db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags db 2 db "YES@" db "NO@" -; 1e2e -OffsetMenuHeader:: ; 1e2e +OffsetMenuHeader:: call _OffsetMenuHeader call PushWindow ret -; 1e35 -_OffsetMenuHeader:: ; 1e35 +_OffsetMenuHeader:: push de call CopyMenuHeader pop de @@ -222,9 +202,8 @@ _OffsetMenuHeader:: ; 1e35 add l ld [wMenuBorderBottomCoord], a ret -; 1e5d -DoNthMenu:: ; 1e5d +DoNthMenu:: call DrawVariableLengthMenuBox call MenuWriteText call InitMenuCursorAndButtonPermissions @@ -232,9 +211,8 @@ DoNthMenu:: ; 1e5d call GetMenuJoypad call MenuClickSound ret -; 1e70 -SetUpMenu:: ; 1e70 +SetUpMenu:: call DrawVariableLengthMenuBox ; ??? call MenuWriteText call InitMenuCursorAndButtonPermissions ; set up selection pointer @@ -263,9 +241,8 @@ MenuWriteText:: pop af ld [hOAMUpdate], a ret -; 0x1ea6 -AutomaticGetMenuBottomCoord:: ; 1ea6 +AutomaticGetMenuBottomCoord:: ld a, [wMenuBorderLeftCoord] ld c, a ld a, [wMenuBorderRightCoord] @@ -279,9 +256,8 @@ AutomaticGetMenuBottomCoord:: ; 1ea6 add b ld [wMenuBorderBottomCoord], a ret -; 1ebd -GetMenuIndexSet:: ; 1ebd +GetMenuIndexSet:: ld hl, wMenuDataIndicesPointer ld a, [hli] ld h, [hl] @@ -304,9 +280,8 @@ GetMenuIndexSet:: ; 1ebd ld a, [hl] ld [wMenuDataItems], a ret -; 1eda -RunMenuItemPrintingFunction:: ; 1eda +RunMenuItemPrintingFunction:: call MenuBoxCoord2Tile ld bc, 2 * SCREEN_WIDTH + 2 add hl, bc @@ -327,16 +302,14 @@ RunMenuItemPrintingFunction:: ; 1eda add hl, de pop de jr .loop -; 1efb -._hl_ ; 1efb +._hl_ ld a, [hli] ld h, [hl] ld l, a jp hl -; 1eff -InitMenuCursorAndButtonPermissions:: ; 1eff +InitMenuCursorAndButtonPermissions:: call InitVerticalMenuCursor ld hl, wMenuJoypadFilter ld a, [wMenuDataFlags] @@ -353,21 +326,17 @@ InitMenuCursorAndButtonPermissions:: ; 1eff .disallow_left_right ret -; 1f1a - -GetScrollingMenuJoypad:: ; 1f1a +GetScrollingMenuJoypad:: call ScrollingMenuJoypad ld hl, wMenuJoypadFilter and [hl] jr ContinueGettingMenuJoypad -; 1f23 -GetStaticMenuJoypad:: ; 1f23 +GetStaticMenuJoypad:: xor a ld [wMenuJoypad], a call StaticMenuJoypad -; 1f2a ContinueGettingMenuJoypad: bit A_BUTTON_F, a @@ -418,9 +387,8 @@ ContinueGettingMenuJoypad: ld [wMenuSelection], a scf ret -; 1f79 -PlaceMenuStrings:: ; 1f79 +PlaceMenuStrings:: push de ld hl, wMenuDataPointerTableAddr ld a, [hli] @@ -433,9 +401,8 @@ PlaceMenuStrings:: ; 1f79 pop hl call PlaceString ret -; 1f8d -PlaceNthMenuStrings:: ; 1f8d +PlaceNthMenuStrings:: push de ld a, [wMenuSelection] call GetMenuDataPointerTableEntry @@ -447,9 +414,8 @@ PlaceNthMenuStrings:: ; 1f8d pop hl call PlaceString ret -; 1f9e -Unreferenced_Function1f9e:: ; 1f9e +Unreferenced_Function1f9e:: call GetMenuDataPointerTableEntry inc hl inc hl @@ -457,18 +423,16 @@ Unreferenced_Function1f9e:: ; 1f9e ld d, [hl] ld e, a ret -; 1fa7 -MenuJumptable:: ; 1fa7 +MenuJumptable:: ld a, [wMenuSelection] call GetMenuDataPointerTableEntry ld a, [hli] ld h, [hl] ld l, a jp hl -; 1fb1 -GetMenuDataPointerTableEntry:: ; 1fb1 +GetMenuDataPointerTableEntry:: ld e, a ld d, $0 ld hl, wMenuDataPointerTableAddr @@ -480,9 +444,8 @@ GetMenuDataPointerTableEntry:: ; 1fb1 add hl, de add hl, de ret -; 1fbf -ClearWindowData:: ; 1fbf +ClearWindowData:: ld hl, wWindowStackPointer call .bytefill ld hl, wMenuHeader @@ -509,16 +472,14 @@ ClearWindowData:: ; 1fbf pop af ld [rSVBK], a ret -; 1ff0 -.bytefill ; 1ff0 +.bytefill ld bc, $10 xor a call ByteFill ret -; 1ff8 -MenuClickSound:: ; 1ff8 +MenuClickSound:: push af and A_BUTTON | B_BUTTON jr z, .nosound @@ -529,25 +490,21 @@ MenuClickSound:: ; 1ff8 .nosound pop af ret -; 2009 - -PlayClickSFX:: ; 2009 +PlayClickSFX:: push de ld de, SFX_READ_TEXT_2 call PlaySFX pop de ret -; 0x2012 -MenuTextBoxWaitButton:: ; 2012 +MenuTextBoxWaitButton:: call MenuTextBox call WaitButton call ExitMenu ret -; 201c -Place2DMenuItemName:: ; 201c +Place2DMenuItemName:: ld [hBuffer], a ld a, [hROMBank] push af @@ -559,28 +516,24 @@ Place2DMenuItemName:: ; 201c rst Bankswitch ret -; 202a -_2DMenu:: ; 202a +_2DMenu:: ld a, [hROMBank] ld [wMenuData_2DMenuItemStringsBank], a farcall _2DMenu_ ld a, [wMenuCursorBuffer] ret -; 2039 -InterpretBattleMenu:: ; 2039 +InterpretBattleMenu:: ld a, [hROMBank] ld [wMenuData_2DMenuItemStringsBank], a farcall _InterpretBattleMenu ld a, [wMenuCursorBuffer] ret -; 2048 -InterpretMobileMenu:: ; 2048 +InterpretMobileMenu:: ld a, [hROMBank] ld [wMenuData_2DMenuItemStringsBank], a farcall _InterpretMobileMenu ld a, [wMenuCursorBuffer] ret -; 2057 |