shithub: pokered

Download patch

ref: 95b1660e59283b6f76dca638985c76a7d81d026f
parent: bcfca2e267a6ee023271d90e27e4a7fde06f66fc
author: YamaArashi <shadow962@live.com>
date: Sun Jul 12 20:32:03 EDT 2015

menu wram variable names

--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2305,7 +2305,7 @@
 	ld a, [wCurrentMenuItem]
 	ld [wcc2c], a
 	ld a, $0
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld [wMenuItemToSwap], a
 	jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected
 
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -317,7 +317,7 @@
 	ld [hli], a
 	ld [hli], a
 	ld [hl], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld [wCurrentMenuItem], a
 	ld [wLastMenuItem], a
 	ld [wMenuJoypadPollCount], a
@@ -326,7 +326,7 @@
 	jp .playerMonMenu
 .enemyMonMenu
 	xor a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	inc a
 	ld [wWhichTradeMonSelectionMenu], a
 	ld a, D_DOWN | D_LEFT | A_BUTTON
@@ -390,7 +390,7 @@
 .playerMonMenu
 	xor a ; player mon menu
 	ld [wWhichTradeMonSelectionMenu], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld a, D_DOWN | D_RIGHT | A_BUTTON
 	ld [wMenuWatchedKeys], a
 	ld a, [wPartyCount]
@@ -682,7 +682,7 @@
 	xor a
 	ld [wSerialExchangeNybbleSendData + 1], a ; unnecessary
 	ld [wSerialExchangeNybbleReceiveData], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld [wMenuJoypadPollCount], a
 	hlCoord 0, 12
 	ld b, 4
--- a/engine/menu/pokedex.asm
+++ b/engine/menu/pokedex.asm
@@ -22,7 +22,7 @@
 	xor a
 	ld [hli],a ; top menu item X
 	inc a
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 	inc hl
 	inc hl
 	ld a,6
@@ -32,7 +32,7 @@
 	jr c,.goToSideMenu ; if the player chose a pokemon from the list
 .exitPokedex
 	xor a
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 	ld [wCurrentMenuItem],a
 	ld [wLastMenuItem],a
 	ld [hJoy7],a
@@ -91,7 +91,7 @@
 	ld [hli],a ; menu watched keys (A button and B button)
 	xor a
 	ld [hli],a ; old menu item ID
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 .handleMenuInput
 	call HandleMenuInput
 	bit 1,a ; was the B button pressed?
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -421,7 +421,7 @@
 	ld a, $c
 	ld [wTopMenuItemX], a
 	xor a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld a, [wd5a0]
 	and $7f
 	ld [wCurrentMenuItem], a
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -78,7 +78,7 @@
 	xor a
 	ld [wCurrentMenuItem], a
 	ld [wLastMenuItem], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld hl, wTileMap + $ea
 	ld b, $5
 	ld c, $4
--- a/home.asm
+++ b/home.asm
@@ -378,7 +378,7 @@
 	set 6, [hl] ; turn off letter printing delay
 	xor a
 	ld [wcc49], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld hl, wTopMenuItemY
 	inc a
 	ld [hli], a ; top menu item Y
@@ -1391,13 +1391,13 @@
 	set 6,[hl] ; turn off letter printing delay
 	xor a
 	ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
-	ld [wd12a],a
+	ld [wListCount],a
 	ld a,[wList]
 	ld l,a
 	ld a,[wList + 1]
 	ld h,a ; hl = address of the list
-	ld a,[hl]
-	ld [wd12a],a ; [wd12a] = number of list entries
+	ld a,[hl] ; the first byte is the number of entries in the list
+	ld [wListCount],a
 	ld a,LIST_MENU_BOX
 	ld [wTextBoxID],a
 	call DisplayTextBoxID ; draw the menu text box
@@ -1411,8 +1411,8 @@
 	call UpdateSprites
 .skipMovingSprites
 	ld a,1 ; max menu item ID is 1 if the list has less than 2 entries
-	ld [wcc37],a
-	ld a,[wd12a]
+	ld [wMenuWatchMovingOutOfBounds],a
+	ld a,[wListCount]
 	cp a,2 ; does the list have less than 2 entries?
 	jr c,.setMenuVariables
 	ld a,2 ; max menu item ID is 2 if the list has at least 2 entries
@@ -1468,13 +1468,13 @@
 	ld [wChosenMenuItem],a 
 
 	xor a
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 	ld a,[wCurrentMenuItem]
 	ld c,a
 	ld a,[wListScrollOffset]
 	add c
 	ld c,a
-	ld a,[wd12a] ; number of list entries
+	ld a,[wListCount]
 	and a ; is the list empty?
 	jp z,ExitListMenu ; if so, exit the menu
 	dec a
@@ -1552,7 +1552,7 @@
 	ld a,[hl]
 	add a,3
 	ld b,a
-	ld a,[wd12a] ; number of list entries
+	ld a,[wListCount]
 	cp b ; will going down scroll past the Cancel button?
 	jp c,DisplayListMenuIDLoop
 	inc [hl] ; if not, go down
@@ -1694,7 +1694,7 @@
 	ld [wChosenMenuItem],a
 	ld a,CANCELLED_MENU
 	ld [wMenuExitMethod],a
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 	xor a
 	ld [hJoy7],a
 	ld hl,wd730
@@ -4026,7 +4026,7 @@
 	ld a,[hJoy5]
 	ret
 .noWrappingAround
-	ld a,[wcc37]
+	ld a,[wMenuWatchMovingOutOfBounds]
 	and a ; should we return if the user tried to go past the top or bottom?
 	jr z,.checkOtherKeys
 	jr .checkIfAButtonOrBButtonPressed
--- a/main.asm
+++ b/main.asm
@@ -922,7 +922,7 @@
 	ld l,a
 	dec [hl] ; decrease the number of items
 	ld a,[hl]
-	ld [wd12a],a ; update number of items variable
+	ld [wListCount],a ; update number of items variable
 	cp a,1
 	jr nz,.skipSettingMaxMenuItemID
 	ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID
@@ -1094,7 +1094,7 @@
 	ld [wCurrentMenuItem],a
 	ld [wLastMenuItem],a
 	xor a
-	ld [wcc37],a
+	ld [wMenuWatchMovingOutOfBounds],a
 	ld hl,wd730
 	set 6,[hl] ; no pauses between printing each letter
 	hlCoord 12, 2
@@ -1472,7 +1472,7 @@
 	xor a
 	ld [wCurrentMenuItem], a
 	ld [wLastMenuItem], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	ld a, [wd730]
 	res 6, a ; turn on the printing delay
 	ld [wd730], a
@@ -1528,7 +1528,7 @@
 	ld [wTopMenuItemX], a
 	xor a
 	ld [wLastMenuItem], a
-	ld [wcc37], a
+	ld [wMenuWatchMovingOutOfBounds], a
 	push hl
 	ld hl, wTwoOptionMenuID
 	bit 7, [hl] ; select second menu item by default?
@@ -2917,7 +2917,7 @@
 	ld a,[hl] ; a = number of items in inventory
 	dec a ; decrement the number of items
 	ld [hl],a ; store new number of items
-	ld [wd12a],a
+	ld [wListCount],a
 	cp a,2
 	jr c,.done
 	ld [wMaxMenuItem],a
--- a/wram.asm
+++ b/wram.asm
@@ -266,7 +266,12 @@
 ; keeps track of what section of the list is on screen
 	ds 1
 
-wcc37:: ds 1 ; menu related thing, used in pokedex and dialog boxes
+wMenuWatchMovingOutOfBounds:: ; cc37
+; If non-zero, then when wrapping is disabled and the player tries to go past
+; the top or bottom of the menu, return from HandleMenuInput. This is useful for
+; menus that have too many items to display at once on the screen because it
+; allows the caller to scroll the entire menu up or down when this happens.
+	ds 1
 
 wTradeCenterPointerTableIndex:: ; cc38
 	ds 1
@@ -1409,7 +1414,9 @@
 ; pointer to list of items terminated by $FF
 	ds 2
 
-wd12a:: ds 1 ; Number of list entries for displaying a list
+wListCount::
+; number of entries in a list
+	ds 1
 
 wLinkState:: ; d12b
 	ds 1