Identify scrolling menu lists in WRAM

Fixes #809
This commit is contained in:
Rangi 2021-03-08 09:41:55 -05:00
parent 9c17fb14c8
commit c1c609ec4a
6 changed files with 20 additions and 18 deletions

View File

@ -27,7 +27,7 @@ Elevator::
ret ret
.LoadFloors: .LoadFloors:
ld de, wCurElevator ld de, wCurElevatorCount
ld bc, wElevatorDataEnd - wElevatorData ld bc, wElevatorDataEnd - wElevatorData
ld hl, wElevatorPointer ld hl, wElevatorPointer
ld a, [hli] ld a, [hli]
@ -38,6 +38,7 @@ Elevator::
inc hl inc hl
ld [de], a ld [de], a
inc de inc de
assert wCurElevatorCount + 1 == wCurElevatorFloors
.loop .loop
ld a, [wElevatorPointerBank] ld a, [wElevatorPointerBank]
call GetFarByte call GetFarByte
@ -184,7 +185,7 @@ Elevator_MenuData:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 0 ; rows, columns db 4, 0 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wCurElevator dbw 0, wCurElevatorCount
dba GetElevatorFloorStrings dba GetElevatorFloorStrings
dba NULL dba NULL
dba NULL dba NULL

View File

@ -101,9 +101,10 @@ LoadMartPointer:
ld [wMartPointer], a ld [wMartPointer], a
ld a, d ld a, d
ld [wMartPointer + 1], a ld [wMartPointer + 1], a
ld hl, wCurMart ld hl, wCurMartCount
assert wCurMartCount + 1 == wCurMartItems
xor a xor a
ld bc, wCurMartEnd - wCurMart ld bc, 16
call ByteFill call ByteFill
xor a ; STANDARDMART_HOWMAYIHELPYOU xor a ; STANDARDMART_HOWMAYIHELPYOU
ld [wMartJumptableIndex], a ld [wMartJumptableIndex], a
@ -219,7 +220,7 @@ FarReadMart:
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld de, wCurMart ld de, wCurMartCount
.CopyMart: .CopyMart:
ld a, [wMartPointerBank] ld a, [wMartPointerBank]
call GetFarByte call GetFarByte
@ -229,7 +230,7 @@ FarReadMart:
cp -1 cp -1
jr nz, .CopyMart jr nz, .CopyMart
ld hl, wMartItem1BCD ld hl, wMartItem1BCD
ld de, wCurMart + 1 ld de, wCurMartItems
.ReadMartItem: .ReadMartItem:
ld a, [de] ld a, [de]
inc de inc de
@ -297,9 +298,9 @@ ReadMart:
; set hl to the first item ; set hl to the first item
inc hl inc hl
ld bc, wMartItem1BCD ld bc, wMartItem1BCD
ld de, wCurMart + 1 ld de, wCurMartItems
.loop .loop
; copy the item to wCurMart + (ItemIndex) ; copy the items to wCurMartItems
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
@ -328,7 +329,7 @@ ReadMart:
.done .done
pop hl pop hl
ld a, [hl] ld a, [hl]
ld [wCurMart], a ld [wCurMartCount], a
ret ret
INCLUDE "data/items/bargain_shop.asm" INCLUDE "data/items/bargain_shop.asm"
@ -599,7 +600,7 @@ MenuHeader_Buy:
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 SCROLLINGMENU_ITEMS_NORMAL ; item format db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wCurMart dbw 0, wCurMartCount
dba PlaceMenuItemName dba PlaceMenuItemName
dba .PrintBCDPrices dba .PrintBCDPrices
dba UpdateItemDescription dba UpdateItemDescription

View File

@ -20,7 +20,7 @@ InitList:
.check_mon_name .check_mon_name
cp INIT_MON_LIST cp INIT_MON_LIST
jr nz, .check_item_name jr nz, .check_item_name
ld hl, wCurMart ld hl, wCurMartCount
ld de, PokemonNames ld de, PokemonNames
ld a, MON_NAME ld a, MON_NAME
jr .done jr .done
@ -34,7 +34,7 @@ InitList:
jr .done jr .done
.check_ob_item_name .check_ob_item_name
ld hl, wCurMart ld hl, wCurMartCount
ld de, ItemNames ld de, ItemNames
ld a, ITEM_NAME ld a, ITEM_NAME
.done .done

View File

@ -412,7 +412,7 @@ PopulateDecoCategoryMenu:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 8, 0 ; rows, columns db 8, 0 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wDecoNameBuffer ; text pointer dbw 0, wNumOwnedDecoCategories
dba DecorationMenuFunction dba DecorationMenuFunction
dbw 0, NULL dbw 0, NULL
dbw 0, NULL dbw 0, NULL

View File

@ -547,7 +547,7 @@ MailboxPC:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 0 ; rows, columns db 4, 0 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format db SCROLLINGMENU_ITEMS_NORMAL ; item format
dbw 0, wMailboxCount ; text pointer dbw 0, wMailboxCount
dba MailboxPC_PrintMailAuthor dba MailboxPC_PrintMailAuthor
dba NULL dba NULL
dba NULL dba NULL

View File

@ -2117,13 +2117,13 @@ wUsingItemWithSelect:: db
UNION UNION
; mart data ; mart data
wCurMart:: ds 16 wCurMartCount:: db
wCurMartEnd:: wCurMartItems:: ds 15
NEXTU NEXTU
; elevator data ; elevator data
wCurElevator:: db wCurElevatorCount:: db
wCurElevatorFloors:: db wCurElevatorFloors:: ds 15
NEXTU NEXTU
; mailbox data ; mailbox data