summaryrefslogtreecommitdiff
path: root/home/menu.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/menu.asm')
-rw-r--r--home/menu.asm195
1 files changed, 74 insertions, 121 deletions
diff --git a/home/menu.asm b/home/menu.asm
index ae3252e96..d10b6e936 100644
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -1,73 +1,61 @@
; Functions used in displaying and handling menus.
-
-LoadMenuDataHeader::
- call CopyMenuDataHeader
+LoadMenuHeader::
+ call CopyMenuHeader
call PushWindow
ret
-CopyMenuDataHeader::
- ld de, wMenuDataHeader
- ld bc, wMenuDataHeaderEnd - wMenuDataHeader
+CopyMenuHeader::
+ ld de, wMenuHeader
+ ld bc, wMenuHeaderEnd - wMenuHeader
call CopyBytes
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
- ld hl, .MenuDataHeader
- call LoadMenuDataHeader
+LoadMenuTextBox::
+ ld hl, .MenuHeader
+ call LoadMenuHeader
ret
-; 1d5f
-.MenuDataHeader: ; 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
-LoadStandardMenuDataHeader:: ; 1d6e
- ld hl, .MenuDataHeader
- call LoadMenuDataHeader
+LoadStandardMenuHeader::
+ ld hl, .MenuHeader
+ call LoadMenuHeader
ret
-; 1d75
-.MenuDataHeader: ; 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
@@ -76,8 +64,8 @@ VerticalMenu::
call UpdateSprites
call PlaceVerticalMenuItems
call ApplyTilemap
- call CopyMenuData2
- ld a, [wMenuData2Flags]
+ call CopyMenuData
+ ld a, [wMenuDataFlags]
bit 7, a
jr z, .cancel
call InitVerticalMenuCursor
@@ -92,21 +80,19 @@ VerticalMenu::
.okay
and a
ret
-; 0x1dab
-GetMenu2:: ; 1dab
- call LoadMenuDataHeader
+GetMenu2::
+ call LoadMenuHeader
call VerticalMenu
call CloseWindow
ld a, [wMenuCursorY]
ret
-; 1db8
CopyNameFromMenu::
push hl
push bc
push af
- ld hl, wMenuData2Pointer
+ ld hl, wMenuDataPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -120,24 +106,22 @@ CopyNameFromMenu::
pop bc
pop hl
ret
-; 0x1dcf
-
-YesNoBox:: ; 1dcf
+YesNoBox::
lb bc, SCREEN_WIDTH - 6, 7
-PlaceYesNoBox:: ; 1dd2
+PlaceYesNoBox::
jr _YesNoBox
-PlaceGenericTwoOptionBox:: ; 1dd4
- call LoadMenuDataHeader
+PlaceGenericTwoOptionBox::
+ call LoadMenuHeader
jr InterpretTwoOptionMenu
-_YesNoBox:: ; 1dd9
+_YesNoBox::
; Return nc (yes) or c (no).
push bc
- ld hl, YesNoMenuDataHeader
- call CopyMenuDataHeader
+ ld hl, YesNoMenuHeader
+ call CopyMenuHeader
pop bc
; This seems to be an overflow prevention, but
; it was coded wrong.
@@ -158,7 +142,7 @@ _YesNoBox:: ; 1dd9
ld [wMenuBorderBottomCoord], a
call PushWindow
-InterpretTwoOptionMenu:: ; 1dfe
+InterpretTwoOptionMenu::
call VerticalMenu
push af
ld c, $f
@@ -177,31 +161,27 @@ InterpretTwoOptionMenu:: ; 1dfe
ld [wMenuCursorY], a
scf
ret
-; 1e1d
-YesNoMenuDataHeader:: ; 1e1d
+YesNoMenuHeader::
db MENU_BACKUP_TILES ; flags
menu_coords 10, 5, 15, 9
- dw .MenuData2
+ dw .MenuData
db 1 ; default option
-; 1e25
-.MenuData2: ; 1e25
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 2
db "YES@"
db "NO@"
-; 1e2e
-OffsetMenuDataHeader:: ; 1e2e
- call _OffsetMenuDataHeader
+OffsetMenuHeader::
+ call _OffsetMenuHeader
call PushWindow
ret
-; 1e35
-_OffsetMenuDataHeader:: ; 1e35
+_OffsetMenuHeader::
push de
- call CopyMenuDataHeader
+ call CopyMenuHeader
pop de
ld a, [wMenuBorderLeftCoord]
ld h, a
@@ -222,9 +202,8 @@ _OffsetMenuDataHeader:: ; 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
@@ -243,7 +221,7 @@ SetUpMenu:: ; 1e70
ret
DrawVariableLengthMenuBox::
- call CopyMenuData2
+ call CopyMenuData
call GetMenuIndexSet
call AutomaticGetMenuBottomCoord
call MenuBox
@@ -263,15 +241,14 @@ MenuWriteText::
pop af
ld [hOAMUpdate], a
ret
-; 0x1ea6
-AutomaticGetMenuBottomCoord:: ; 1ea6
+AutomaticGetMenuBottomCoord::
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
sub c
ld c, a
- ld a, [wMenuData2Items]
+ ld a, [wMenuDataItems]
add a
inc a
ld b, a
@@ -279,10 +256,9 @@ AutomaticGetMenuBottomCoord:: ; 1ea6
add b
ld [wMenuBorderBottomCoord], a
ret
-; 1ebd
-GetMenuIndexSet:: ; 1ebd
- ld hl, wMenuData2IndicesPointer
+GetMenuIndexSet::
+ ld hl, wMenuDataIndicesPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -302,11 +278,10 @@ GetMenuIndexSet:: ; 1ebd
ld d, h
ld e, l
ld a, [hl]
- ld [wMenuData2Items], a
+ ld [wMenuDataItems], a
ret
-; 1eda
-RunMenuItemPrintingFunction:: ; 1eda
+RunMenuItemPrintingFunction::
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
@@ -320,32 +295,30 @@ RunMenuItemPrintingFunction:: ; 1eda
push hl
ld d, h
ld e, l
- ld hl, wMenuData2DisplayFunctionPointer
+ ld hl, wMenuDataDisplayFunctionPointer
call ._hl_
pop hl
ld de, 2 * SCREEN_WIDTH
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, [wMenuData2Flags]
+ ld a, [wMenuDataFlags]
bit 3, a
jr z, .disallow_select
set START_F, [hl]
.disallow_select
- ld a, [wMenuData2Flags]
+ ld a, [wMenuDataFlags]
bit 2, a
jr z, .disallow_left_right
set D_LEFT_F, [hl]
@@ -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,11 +387,10 @@ ContinueGettingMenuJoypad:
ld [wMenuSelection], a
scf
ret
-; 1f79
-PlaceMenuStrings:: ; 1f79
+PlaceMenuStrings::
push de
- ld hl, wMenuData2PointerTableAddr
+ ld hl, wMenuDataPointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -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,21 +423,19 @@ 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, wMenuData2PointerTableAddr
+ ld hl, wMenuDataPointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -480,14 +444,13 @@ GetMenuDataPointerTableEntry:: ; 1fb1
add hl, de
add hl, de
ret
-; 1fbf
-ClearWindowData:: ; 1fbf
+ClearWindowData::
ld hl, wWindowStackPointer
call .bytefill
- ld hl, wMenuDataHeader
+ ld hl, wMenuHeader
call .bytefill
- ld hl, wMenuData2Flags
+ ld hl, wMenuDataFlags
call .bytefill
ld hl, w2DMenuCursorInitY
call .bytefill
@@ -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 [wMenuData2_2DMenuItemStringsBank], a
+ ld [wMenuData_2DMenuItemStringsBank], a
farcall _2DMenu_
ld a, [wMenuCursorBuffer]
ret
-; 2039
-InterpretBattleMenu:: ; 2039
+InterpretBattleMenu::
ld a, [hROMBank]
- ld [wMenuData2_2DMenuItemStringsBank], a
+ ld [wMenuData_2DMenuItemStringsBank], a
farcall _InterpretBattleMenu
ld a, [wMenuCursorBuffer]
ret
-; 2048
-InterpretMobileMenu:: ; 2048
+InterpretMobileMenu::
ld a, [hROMBank]
- ld [wMenuData2_2DMenuItemStringsBank], a
+ ld [wMenuData_2DMenuItemStringsBank], a
farcall _InterpretMobileMenu
ld a, [wMenuCursorBuffer]
ret
-; 2057