summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengine/battle/core.asm2
-rwxr-xr-xengine/cable_club.asm8
-rwxr-xr-xengine/menu/pokedex.asm6
-rwxr-xr-xengine/save.asm2
-rwxr-xr-xengine/slot_machine.asm2
-rw-r--r--home.asm22
-rwxr-xr-xmain.asm10
-rwxr-xr-xwram.asm11
8 files changed, 35 insertions, 28 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 95242f5d..f37da950 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2305,7 +2305,7 @@ DisplayBagMenu:
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
diff --git a/engine/cable_club.asm b/engine/cable_club.asm
index c115ed4a..13a95ed5 100755
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -317,7 +317,7 @@ TradeCenter_SelectMon:
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 @@ TradeCenter_SelectMon:
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 @@ TradeCenter_SelectMon:
.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 @@ TradeCenter_Trade:
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
diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm
index e2e53d45..b8686a07 100755
--- a/engine/menu/pokedex.asm
+++ b/engine/menu/pokedex.asm
@@ -22,7 +22,7 @@ ShowPokedexMenu: ; 40000 (10:4000)
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 @@ ShowPokedexMenu: ; 40000 (10:4000)
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 @@ HandlePokedexSideMenu: ; 4006d (10:406d)
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?
diff --git a/engine/save.asm b/engine/save.asm
index cc5e6c4a..2ef59263 100755
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -421,7 +421,7 @@ Func_7393f: ; 7393f (1c:793f)
ld a, $c
ld [wTopMenuItemX], a
xor a
- ld [wcc37], a
+ ld [wMenuWatchMovingOutOfBounds], a
ld a, [wd5a0]
and $7f
ld [wCurrentMenuItem], a
diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm
index 0b9f8bc9..6dae7293 100755
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -78,7 +78,7 @@ MainSlotMachineLoop: ; 37395 (d:7395)
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld [wcc37], a
+ ld [wMenuWatchMovingOutOfBounds], a
ld hl, wTileMap + $ea
ld b, $5
ld c, $4
diff --git a/home.asm b/home.asm
index 51e10118..f6a1c914 100644
--- a/home.asm
+++ b/home.asm
@@ -378,7 +378,7 @@ PartyMenuInit:: ; 1420 (0:1420)
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 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
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 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
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 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
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 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
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 @@ ExitListMenu:: ; 2e3b (0:2e3b)
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 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2)
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
diff --git a/main.asm b/main.asm
index 54440e60..3a1e0621 100755
--- a/main.asm
+++ b/main.asm
@@ -922,7 +922,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
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 @@ DrawStartMenu: ; 710b (1:710b)
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 @@ DoBuySellQuitMenu: ; 74ea (1:74ea)
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 @@ DisplayTwoOptionMenu: ; 7559 (1:7559)
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 @@ RemoveItemFromInventory_: ; ce74 (3:4e74)
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
diff --git a/wram.asm b/wram.asm
index c5f06e53..a1b9f1d3 100755
--- a/wram.asm
+++ b/wram.asm
@@ -266,7 +266,12 @@ wListScrollOffset:: ; cc36
; 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 @@ wItemListPointer:: ; d128
; 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