Create constants for ScrollingMenu item formats

...I should've done this quite a while ago.
This commit is contained in:
mid-kid 2019-06-09 02:31:24 +02:00
parent 6b37353406
commit c048b24d25
16 changed files with 50 additions and 43 deletions

View File

@ -32,6 +32,11 @@
shift_const SCROLLINGMENU_ENABLE_START shift_const SCROLLINGMENU_ENABLE_START
shift_const SCROLLINGMENU_ENABLE_SELECT shift_const SCROLLINGMENU_ENABLE_SELECT
; ScrollingMenu items structure format
const_def 1
const SCROLLINGMENU_ITEMS_NORMAL
const SCROLLINGMENU_ITEMS_QUANTITY
; MonMenuOptions indexes (see data/mon_menu.asm) ; MonMenuOptions indexes (see data/mon_menu.asm)
; used by PokemonActionSubmenu (see engine/pokemon/mon_menu.asm) ; used by PokemonActionSubmenu (see engine/pokemon/mon_menu.asm)
const_def 1 const_def 1

View File

@ -26,7 +26,7 @@ Structure:
.MenuData: .MenuData:
db 0 ; flags db 0 ; flags
db 5, 0 ; rows, columns db 5, 0 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dba Items dba Items
dba Function1 dba Function1
dba Function2 dba Function2
@ -66,9 +66,9 @@ Function3: Called to display anything else, whenever the cursor is moved.
There is no register of importance that should be preserved in any of these functions. There is no register of importance that should be preserved in any of these functions.
The `; horizontal spacing` item in each `MenuData` is a misnomer. It changes how the `Items` struct looks. The `; item format` entry in each `MenuData` changes how the `Items` struct looks.
If it's 1: If it's `SCROLLINGMENU_ITEMS_NORMAL` (1):
``` ```
db entries not including cancel db entries not including cancel
@ -78,7 +78,7 @@ db -1 ; cancel
... ...
``` ```
If it's 2: If it's `SCROLLINGMENU_ITEMS_QUANTITY` (2):
``` ```
db entries not including cancel db entries not including cancel

View File

@ -263,7 +263,7 @@ Buena_PrizeMenu:
.MenuData: .MenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 13 ; rows, columns db 4, 13 ; rows, columns
db 1 ; spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dba .indices dba .indices
dba .prizeitem dba .prizeitem
dba .prizepoints dba .prizepoints

View File

@ -184,7 +184,7 @@ Elevator_MenuHeader:
Elevator_MenuData: Elevator_MenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 0 ; rows, columns db 4, 0 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wCurElevator dbw 0, wCurElevator
dba GetElevatorFloorStrings dba GetElevatorFloorStrings
dba NULL dba NULL

View File

@ -87,8 +87,8 @@ Kurt_SelectApricorn:
.MenuData: .MenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 7 db 4, 7 ; rows, columns
db 1 db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wBuffer1 dbw 0, wBuffer1
dba .Name dba .Name
dba .Quantity dba .Quantity

View File

@ -625,8 +625,8 @@ PCItemsJoypad:
.MenuData: .MenuData:
db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 8 ; rows/cols? db 4, 8 ; rows, columns
db 2 ; horizontal spacing? db SCROLLINGMENU_ITEMS_QUANTITY ; item format
dbw 0, wNumPCItems dbw 0, wNumPCItems
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity

View File

@ -600,7 +600,7 @@ MenuHeader_Buy:
.MenuData .MenuData
db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 8 ; rows, columns db 4, 8 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wCurMart dbw 0, wCurMart
dba PlaceMenuItemName dba PlaceMenuItemName
dba .PrintBCDPrices dba .PrintBCDPrices

View File

@ -1465,7 +1465,7 @@ ItemsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 2 ; horizontal spacing db SCROLLINGMENU_ITEMS_QUANTITY ; item format
dbw 0, wNumItems dbw 0, wNumItems
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity
@ -1480,7 +1480,7 @@ PC_Mart_ItemsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 2 ; horizontal spacing db SCROLLINGMENU_ITEMS_QUANTITY ; item format
dbw 0, wNumItems dbw 0, wNumItems
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity
@ -1495,7 +1495,7 @@ KeyItemsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wNumKeyItems dbw 0, wNumKeyItems
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity
@ -1510,7 +1510,7 @@ PC_Mart_KeyItemsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wNumKeyItems dbw 0, wNumKeyItems
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity
@ -1525,7 +1525,7 @@ BallsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 2 ; horizontal spacing db SCROLLINGMENU_ITEMS_QUANTITY ; item format
dbw 0, wNumBalls dbw 0, wNumBalls
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity
@ -1540,7 +1540,7 @@ PC_Mart_BallsPocketMenuHeader:
.MenuData: .MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns db 5, 8 ; rows, columns
db 2 ; horizontal spacing db SCROLLINGMENU_ITEMS_QUANTITY ; item format
dbw 0, wNumBalls dbw 0, wNumBalls
dba PlaceMenuItemName dba PlaceMenuItemName
dba PlaceMenuItemQuantity dba PlaceMenuItemQuantity

View File

@ -48,7 +48,7 @@ SwitchItemsInBag:
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
dec hl dec hl
push hl push hl
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
@ -74,7 +74,7 @@ SwitchItemsInBag:
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
ld d, h ld d, h
ld e, l ld e, l
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
add hl, bc add hl, bc
pop bc pop bc
call CopyBytes call CopyBytes
@ -162,7 +162,7 @@ Function249d1:
.asm_24a25 .asm_24a25
dec [hl] dec [hl]
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
push bc push bc
ld a, [wSwitchItem] ld a, [wSwitchItem]
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
@ -183,7 +183,7 @@ Function249d1:
Function24a40: Function24a40:
call ItemSwitch_GetNthItem call ItemSwitch_GetNthItem
ld de, wd002 ld de, wd002
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
call CopyBytes call CopyBytes
ret ret
@ -192,13 +192,13 @@ Function24a4d:
ld d, h ld d, h
ld e, l ld e, l
ld hl, wd002 ld hl, wd002
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
call CopyBytes call CopyBytes
ret ret
ItemSwitch_GetNthItem: ItemSwitch_GetNthItem:
push af push af
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
ld hl, wMenuData_ItemsPointerAddr ld hl, wMenuData_ItemsPointerAddr
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
@ -210,7 +210,7 @@ ItemSwitch_GetNthItem:
Function24a6c: Function24a6c:
push hl push hl
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
ld a, d ld a, d
sub e sub e
jr nc, .dont_negate jr nc, .dont_negate
@ -224,13 +224,13 @@ Function24a6c:
pop hl pop hl
ret ret
ItemSwitch_ConvertSpacingToDW: ItemSwitch_ConvertItemFormatToDW:
; This function is absolutely idiotic. ; This function is absolutely idiotic.
push hl push hl
ld a, [wMenuData_ScrollingMenuSpacing] ld a, [wMenuData_ScrollingMenuItemFormat]
ld c, a ld c, a
ld b, 0 ld b, 0
ld hl, .spacing_dws ld hl, .format_dws
add hl, bc add hl, bc
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
@ -239,12 +239,14 @@ ItemSwitch_ConvertSpacingToDW:
pop hl pop hl
ret ret
.spacing_dws .format_dws
dw 0, 1, 2 dw 0
dw 1
dw 2
Function24a97: Function24a97:
push af push af
call ItemSwitch_ConvertSpacingToDW call ItemSwitch_ConvertItemFormatToDW
ld a, c ld a, c
cp 2 cp 2
jr nz, .not_2 jr nz, .not_2

View File

@ -497,10 +497,10 @@ ScrollingMenu_GetListItemCoordAndFunctionArgs:
ld h, [hl] ld h, [hl]
ld l, a ld l, a
inc hl ; items inc hl ; items
ld a, [wMenuData_ScrollingMenuSpacing] ld a, [wMenuData_ScrollingMenuItemFormat]
cp 1 cp SCROLLINGMENU_ITEMS_NORMAL
jr z, .got_spacing jr z, .got_spacing
cp 2 cp SCROLLINGMENU_ITEMS_QUANTITY
jr z, .pointless_jump jr z, .pointless_jump
.pointless_jump .pointless_jump
add hl, de add hl, de

View File

@ -409,7 +409,7 @@ PopulateDecoCategoryMenu:
.ScrollingMenuData: .ScrollingMenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 8, 0 ; rows, columns db 8, 0 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wd002 ; text pointer dbw 0, wd002 ; text pointer
dba DecorationMenuFunction dba DecorationMenuFunction
dbw 0, 0 dbw 0, 0

View File

@ -2269,9 +2269,9 @@ _ChangeBox_MenuHeader:
db 1 ; default option db 1 ; default option
.MenuData .MenuData
db MENU_UNUSED_1 | MENU_UNUSED_3 ; flags db SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 0 db 4, 0 ; rows, columns
db 1 db SCROLLINGMENU_ITEMS_NORMAL ; item format
dba .boxes dba .boxes
dba .boxnames dba .boxnames
dba NULL dba NULL

View File

@ -543,8 +543,8 @@ MailboxPC:
.TopMenuData: .TopMenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 0 ; rows/columns? db 4, 0 ; rows, columns
db 1 ; horizontal spacing? db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wMailboxCount ; text pointer dbw 0, wMailboxCount ; text pointer
dba MailboxPC_PrintMailAuthor dba MailboxPC_PrintMailAuthor
dba NULL dba NULL

View File

@ -585,7 +585,7 @@ MenuHeader_0x48513:
MenuData_0x4851b: MenuData_0x4851b:
db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_CALL_FUNCTION1_CANCEL ; flags db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_CALL_FUNCTION1_CANCEL ; flags
db 6, 0 ; rows, columns db 6, 0 ; rows, columns
db 1 ; horizontal spacing db SCROLLINGMENU_ITEMS_NORMAL ; item format
dba .Items dba .Items
dba Function483e8 dba Function483e8
dba NULL dba NULL

View File

@ -883,8 +883,8 @@ MenuHeader_0x8b867:
MenuData_0x8b870: MenuData_0x8b870:
db SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT ; flags db SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT ; flags
db 5 ; items db 5, 3 ; rows, columns
db 3, 1 db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wd002 dbw 0, wd002
dba Function8b880 dba Function8b880
dba Function8b88c dba Function8b88c

View File

@ -1481,7 +1481,7 @@ NEXTU ; cf92
; Scrolling Menu ; Scrolling Menu
wMenuData_ScrollingMenuHeight:: db ; cf92 wMenuData_ScrollingMenuHeight:: db ; cf92
wMenuData_ScrollingMenuWidth:: db ; cf93 wMenuData_ScrollingMenuWidth:: db ; cf93
wMenuData_ScrollingMenuSpacing:: db ; cf94 wMenuData_ScrollingMenuItemFormat:: db ; cf94
wMenuData_ItemsPointerBank:: db ; cf95 wMenuData_ItemsPointerBank:: db ; cf95
wMenuData_ItemsPointerAddr:: dw ; cf97 wMenuData_ItemsPointerAddr:: dw ; cf97
wMenuData_ScrollingMenuFunction1:: ds 3 ; cf98 wMenuData_ScrollingMenuFunction1:: ds 3 ; cf98