2018-06-24 07:09:41 -07:00
|
|
|
SelectMenu::
|
2015-11-11 13:11:08 -08:00
|
|
|
call CheckRegisteredItem
|
|
|
|
jr c, .NotRegistered
|
|
|
|
jp UseRegisteredItem
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NotRegistered:
|
2023-08-11 03:28:14 -07:00
|
|
|
call OpenText2bpp
|
2019-10-20 15:24:17 -07:00
|
|
|
ld b, BANK(MayRegisterItemText)
|
|
|
|
ld hl, MayRegisterItemText
|
2015-11-11 13:11:08 -08:00
|
|
|
call MapTextbox
|
2015-11-25 07:16:29 -08:00
|
|
|
call WaitButton
|
|
|
|
jp CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MayRegisterItemText:
|
|
|
|
text_far _MayRegisterItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckRegisteredItem:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wWhichRegisteredItem]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
jr z, .NoRegisteredItem
|
|
|
|
and REGISTERED_POCKET
|
|
|
|
rlca
|
|
|
|
rlca
|
|
|
|
ld hl, .Pockets
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Pockets:
|
2018-01-25 19:19:24 -08:00
|
|
|
; entries correspond to *_POCKET constants
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .CheckItem
|
|
|
|
dw .CheckBall
|
|
|
|
dw .CheckKeyItem
|
|
|
|
dw .CheckTMHM
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckItem:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2015-11-11 13:11:08 -08:00
|
|
|
call .CheckRegisteredNo
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
inc hl
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
call .IsSameItem
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckKeyItem:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wRegisteredItem]
|
|
|
|
ld hl, wKeyItems
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, 1
|
|
|
|
call IsInArray
|
|
|
|
jr nc, .NoRegisteredItem
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wRegisteredItem]
|
|
|
|
ld [wCurItem], a
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckBall:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumBalls
|
2015-11-11 13:11:08 -08:00
|
|
|
call .CheckRegisteredNo
|
|
|
|
jr nc, .NoRegisteredItem
|
|
|
|
inc hl
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
call .IsSameItem
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CheckTMHM:
|
2015-11-11 13:11:08 -08:00
|
|
|
jr .NoRegisteredItem
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NoRegisteredItem:
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wWhichRegisteredItem], a
|
|
|
|
ld [wRegisteredItem], a
|
2015-11-11 13:11:08 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckRegisteredNo:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wWhichRegisteredItem]
|
2015-11-11 13:11:08 -08:00
|
|
|
and REGISTERED_NUMBER
|
|
|
|
dec a
|
|
|
|
cp [hl]
|
|
|
|
jr nc, .NotEnoughItems
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurItemQuantity], a
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NotEnoughItems:
|
2015-11-11 13:11:08 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.IsSameItem:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wRegisteredItem]
|
2015-11-11 13:11:08 -08:00
|
|
|
cp [hl]
|
|
|
|
jr nz, .NotSameItem
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurItem], a
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NotSameItem:
|
2015-11-11 13:11:08 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseRegisteredItem:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CheckItemMenu
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wItemAttributeValue]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld hl, .SwitchTo
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SwitchTo:
|
2018-01-25 19:19:24 -08:00
|
|
|
; entries correspond to ITEMMENU_* constants
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .CantUse
|
|
|
|
dw .NoFunction
|
|
|
|
dw .NoFunction
|
|
|
|
dw .NoFunction
|
|
|
|
dw .Current
|
|
|
|
dw .Party
|
|
|
|
dw .Overworld
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.NoFunction:
|
2023-08-11 03:28:14 -07:00
|
|
|
call OpenText2bpp
|
2015-11-11 13:11:08 -08:00
|
|
|
call CantUseItem
|
2015-11-25 07:16:29 -08:00
|
|
|
call CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Current:
|
2023-08-11 03:28:14 -07:00
|
|
|
call OpenText2bpp
|
2015-11-11 13:11:08 -08:00
|
|
|
call DoItemEffect
|
2015-11-25 07:16:29 -08:00
|
|
|
call CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Party:
|
2015-12-24 19:58:42 -08:00
|
|
|
call RefreshScreen
|
2015-11-11 13:11:08 -08:00
|
|
|
call FadeToMenu
|
|
|
|
call DoItemEffect
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-25 07:16:29 -08:00
|
|
|
call CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Overworld:
|
2015-12-24 19:58:42 -08:00
|
|
|
call RefreshScreen
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, 1
|
2015-12-17 14:51:32 -08:00
|
|
|
ld [wUsingItemWithSelect], a
|
2015-11-11 13:11:08 -08:00
|
|
|
call DoItemEffect
|
|
|
|
xor a
|
2015-12-17 14:51:32 -08:00
|
|
|
ld [wUsingItemWithSelect], a
|
|
|
|
ld a, [wItemEffectSucceeded]
|
2015-11-11 13:11:08 -08:00
|
|
|
cp 1
|
|
|
|
jr nz, ._cantuse
|
|
|
|
scf
|
2023-09-30 10:12:57 -07:00
|
|
|
ld a, MENURETURN_SCRIPT
|
|
|
|
ld [wMenuReturn], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CantUse:
|
2015-12-24 19:58:42 -08:00
|
|
|
call RefreshScreen
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
._cantuse
|
|
|
|
call CantUseItem
|
2015-11-25 07:16:29 -08:00
|
|
|
call CloseText
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|