shithub: pokecrystal

Download patch

ref: c1c609ec4a4bab7fef0e744cd631567b57c794fa
parent: 9c17fb14c8068d6662b9ca1cb048ed206b6770ee
author: Rangi <[email protected]>
date: Mon Mar 8 04:41:55 EST 2021

Identify scrolling menu lists in WRAM

Fixes #809

--- a/engine/events/elevator.asm
+++ b/engine/events/elevator.asm
@@ -27,7 +27,7 @@
 	ret
 
 .LoadFloors:
-	ld de, wCurElevator
+	ld de, wCurElevatorCount
 	ld bc, wElevatorDataEnd - wElevatorData
 	ld hl, wElevatorPointer
 	ld a, [hli]
@@ -38,6 +38,7 @@
 	inc hl
 	ld [de], a
 	inc de
+	assert wCurElevatorCount + 1 == wCurElevatorFloors
 .loop
 	ld a, [wElevatorPointerBank]
 	call GetFarByte
@@ -184,7 +185,7 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS ; flags
 	db 4, 0 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dbw 0, wCurElevator
+	dbw 0, wCurElevatorCount
 	dba GetElevatorFloorStrings
 	dba NULL
 	dba NULL
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -101,9 +101,10 @@
 	ld [wMartPointer], a
 	ld a, d
 	ld [wMartPointer + 1], a
-	ld hl, wCurMart
+	ld hl, wCurMartCount
+	assert wCurMartCount + 1 == wCurMartItems
 	xor a
-	ld bc, wCurMartEnd - wCurMart
+	ld bc, 16
 	call ByteFill
 	xor a ; STANDARDMART_HOWMAYIHELPYOU
 	ld [wMartJumptableIndex], a
@@ -219,7 +220,7 @@
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
-	ld de, wCurMart
+	ld de, wCurMartCount
 .CopyMart:
 	ld a, [wMartPointerBank]
 	call GetFarByte
@@ -229,7 +230,7 @@
 	cp -1
 	jr nz, .CopyMart
 	ld hl, wMartItem1BCD
-	ld de, wCurMart + 1
+	ld de, wCurMartItems
 .ReadMartItem:
 	ld a, [de]
 	inc de
@@ -297,9 +298,9 @@
 ; set hl to the first item
 	inc hl
 	ld bc, wMartItem1BCD
-	ld de, wCurMart + 1
+	ld de, wCurMartItems
 .loop
-; copy the item to wCurMart + (ItemIndex)
+; copy the items to wCurMartItems
 	ld a, [hli]
 	ld [de], a
 	inc de
@@ -328,7 +329,7 @@
 .done
 	pop hl
 	ld a, [hl]
-	ld [wCurMart], a
+	ld [wCurMartCount], a
 	ret
 
 INCLUDE "data/items/bargain_shop.asm"
@@ -599,7 +600,7 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
 	db 4, 8 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dbw 0, wCurMart
+	dbw 0, wCurMartCount
 	dba PlaceMenuItemName
 	dba .PrintBCDPrices
 	dba UpdateItemDescription
--- a/engine/link/init_list.asm
+++ b/engine/link/init_list.asm
@@ -20,7 +20,7 @@
 .check_mon_name
 	cp INIT_MON_LIST
 	jr nz, .check_item_name
-	ld hl, wCurMart
+	ld hl, wCurMartCount
 	ld de, PokemonNames
 	ld a, MON_NAME
 	jr .done
@@ -34,7 +34,7 @@
 	jr .done
 
 .check_ob_item_name
-	ld hl, wCurMart
+	ld hl, wCurMartCount
 	ld de, ItemNames
 	ld a, ITEM_NAME
 .done
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -412,7 +412,7 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS ; flags
 	db 8, 0 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dbw 0, wDecoNameBuffer ; text pointer
+	dbw 0, wNumOwnedDecoCategories
 	dba DecorationMenuFunction
 	dbw 0, NULL
 	dbw 0, NULL
--- a/engine/pokemon/mail.asm
+++ b/engine/pokemon/mail.asm
@@ -547,7 +547,7 @@
 	db SCROLLINGMENU_DISPLAY_ARROWS ; flags
 	db 4, 0 ; rows, columns
 	db SCROLLINGMENU_ITEMS_NORMAL ; item format
-	dbw 0, wMailboxCount ; text pointer
+	dbw 0, wMailboxCount
 	dba MailboxPC_PrintMailAuthor
 	dba NULL
 	dba NULL
--- a/wram.asm
+++ b/wram.asm
@@ -2117,13 +2117,13 @@
 
 UNION
 ; mart data
-wCurMart:: ds 16
-wCurMartEnd::
+wCurMartCount:: db
+wCurMartItems:: ds 15
 
 NEXTU
 ; elevator data
-wCurElevator:: db
-wCurElevatorFloors:: db
+wCurElevatorCount:: db
+wCurElevatorFloors:: ds 15
 
 NEXTU
 ; mailbox data