2015-11-11 21:11:08 +00:00
|
|
|
SelectMenu:: ; 13327
|
|
|
|
|
|
|
|
call CheckRegisteredItem
|
|
|
|
jr c, .NotRegistered
|
|
|
|
jp UseRegisteredItem
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotRegistered:
|
2015-12-09 23:25:44 +00:00
|
|
|
call OpenText
|
2015-11-11 21:11:08 +00:00
|
|
|
ld b, BANK(ItemMayBeRegisteredText)
|
|
|
|
ld hl, ItemMayBeRegisteredText
|
|
|
|
call MapTextbox
|
2015-11-25 15:16:29 +00:00
|
|
|
call WaitButton
|
|
|
|
jp CloseText
|
2015-11-11 21:11:08 +00:00
|
|
|
; 13340
|
|
|
|
|
|
|
|
|
|
|
|
ItemMayBeRegisteredText: ; 13340
|
|
|
|
text_jump UnknownText_0x1c1cf3
|
|
|
|
db "@"
|
|
|
|
; 13345
|
|
|
|
|
|
|
|
|
|
|
|
CheckRegisteredItem: ; 13345
|
|
|
|
|
|
|
|
ld a, [WhichRegisteredItem]
|
|
|
|
and a
|
|
|
|
jr z, .NoRegisteredItem
|
|
|
|
and REGISTERED_POCKET
|
|
|
|
rlca
|
|
|
|
rlca
|
|
|
|
ld hl, .Pockets
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Pockets:
|
2015-11-11 21:11:08 +00:00
|
|
|
dw .CheckItem
|
|
|
|
dw .CheckBall
|
|
|
|
dw .CheckKeyItem
|
|
|
|
dw .CheckTMHM
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckItem:
|
2015-11-11 21:11:08 +00:00
|
|
|
ld hl, NumItems
|
|
|
|
call .CheckRegisteredNo
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
inc hl
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-11 21:11:08 +00:00
|
|
|
call .IsSameItem
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckKeyItem:
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [RegisteredItem]
|
|
|
|
ld hl, KeyItems
|
|
|
|
ld de, 1
|
|
|
|
call IsInArray
|
|
|
|
jr nc, .NoRegisteredItem
|
|
|
|
ld a, [RegisteredItem]
|
|
|
|
ld [CurItem], a
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckBall:
|
2015-11-11 21:11:08 +00:00
|
|
|
ld hl, NumBalls
|
|
|
|
call .CheckRegisteredNo
|
|
|
|
jr nc, .NoRegisteredItem
|
|
|
|
inc hl
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-11 21:11:08 +00:00
|
|
|
call .IsSameItem
|
|
|
|
jr c, .NoRegisteredItem
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckTMHM:
|
2015-11-11 21:11:08 +00:00
|
|
|
jr .NoRegisteredItem
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoRegisteredItem:
|
2015-11-11 21:11:08 +00:00
|
|
|
xor a
|
|
|
|
ld [WhichRegisteredItem], a
|
|
|
|
ld [RegisteredItem], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 133a6
|
|
|
|
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CheckRegisteredNo: ; 133a6
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [WhichRegisteredItem]
|
|
|
|
and REGISTERED_NUMBER
|
|
|
|
dec a
|
|
|
|
cp [hl]
|
|
|
|
jr nc, .NotEnoughItems
|
2017-12-09 20:14:51 +00:00
|
|
|
ld [CurItemQuantity], a
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotEnoughItems:
|
2015-11-11 21:11:08 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 133b6
|
|
|
|
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.IsSameItem: ; 133b6
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [RegisteredItem]
|
|
|
|
cp [hl]
|
|
|
|
jr nz, .NotSameItem
|
|
|
|
ld [CurItem], a
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotSameItem:
|
2015-11-11 21:11:08 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 133c3
|
|
|
|
|
|
|
|
|
|
|
|
UseRegisteredItem: ; 133c3
|
|
|
|
|
|
|
|
callba CheckItemMenu
|
|
|
|
ld a, [wItemAttributeParamBuffer]
|
|
|
|
ld hl, .SwitchTo
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.SwitchTo:
|
2015-11-11 21:11:08 +00:00
|
|
|
dw .CantUse
|
|
|
|
dw .NoFunction
|
|
|
|
dw .NoFunction
|
|
|
|
dw .NoFunction
|
|
|
|
dw .Current
|
|
|
|
dw .Party
|
|
|
|
dw .Overworld
|
|
|
|
; 133df
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoFunction: ; 133df
|
2015-12-09 23:25:44 +00:00
|
|
|
call OpenText
|
2015-11-11 21:11:08 +00:00
|
|
|
call CantUseItem
|
2015-11-25 15:16:29 +00:00
|
|
|
call CloseText
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 133ea
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Current: ; 133ea
|
2015-12-09 23:25:44 +00:00
|
|
|
call OpenText
|
2015-11-11 21:11:08 +00:00
|
|
|
call DoItemEffect
|
2015-11-25 15:16:29 +00:00
|
|
|
call CloseText
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 133f5
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Party: ; 133f5
|
2015-12-25 03:58:42 +00:00
|
|
|
call RefreshScreen
|
2015-11-11 21:11:08 +00:00
|
|
|
call FadeToMenu
|
|
|
|
call DoItemEffect
|
2015-12-02 02:54:11 +00:00
|
|
|
call CloseSubmenu
|
2015-11-25 15:16:29 +00:00
|
|
|
call CloseText
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 13406
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Overworld: ; 13406
|
2015-12-25 03:58:42 +00:00
|
|
|
call RefreshScreen
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, 1
|
2015-12-17 22:51:32 +00:00
|
|
|
ld [wUsingItemWithSelect], a
|
2015-11-11 21:11:08 +00:00
|
|
|
call DoItemEffect
|
|
|
|
xor a
|
2015-12-17 22:51:32 +00:00
|
|
|
ld [wUsingItemWithSelect], a
|
|
|
|
ld a, [wItemEffectSucceeded]
|
2015-11-11 21:11:08 +00:00
|
|
|
cp 1
|
|
|
|
jr nz, ._cantuse
|
|
|
|
scf
|
|
|
|
ld a, HMENURETURN_SCRIPT
|
|
|
|
ld [hMenuReturn], a
|
|
|
|
ret
|
|
|
|
; 13422
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.CantUse: ; 13422
|
2015-12-25 03:58:42 +00:00
|
|
|
call RefreshScreen
|
2015-11-11 21:11:08 +00:00
|
|
|
|
|
|
|
._cantuse
|
|
|
|
call CantUseItem
|
2015-11-25 15:16:29 +00:00
|
|
|
call CloseText
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 1342d
|