mirror of
https://github.com/thornAvery/jep-hack.git
synced 2026-04-09 12:01:05 +12:00
First Commit
Upload literally everything from the pokecrystal16 expand-move-ID branch
This commit is contained in:
commit
2f8a41f833
4618 changed files with 480386 additions and 0 deletions
172
engine/overworld/select_menu.asm
Normal file
172
engine/overworld/select_menu.asm
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
SelectMenu::
|
||||
call CheckRegisteredItem
|
||||
jr c, .NotRegistered
|
||||
jp UseRegisteredItem
|
||||
|
||||
.NotRegistered:
|
||||
call OpenText
|
||||
ld b, BANK(MayRegisterItemText)
|
||||
ld hl, MayRegisterItemText
|
||||
call MapTextbox
|
||||
call WaitButton
|
||||
jp CloseText
|
||||
|
||||
MayRegisterItemText:
|
||||
text_far _MayRegisterItemText
|
||||
text_end
|
||||
|
||||
CheckRegisteredItem:
|
||||
ld a, [wWhichRegisteredItem]
|
||||
and a
|
||||
jr z, .NoRegisteredItem
|
||||
and REGISTERED_POCKET
|
||||
rlca
|
||||
rlca
|
||||
ld hl, .Pockets
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.Pockets:
|
||||
; entries correspond to *_POCKET constants
|
||||
dw .CheckItem
|
||||
dw .CheckBall
|
||||
dw .CheckKeyItem
|
||||
dw .CheckTMHM
|
||||
|
||||
.CheckItem:
|
||||
ld hl, wNumItems
|
||||
call .CheckRegisteredNo
|
||||
jr c, .NoRegisteredItem
|
||||
inc hl
|
||||
ld e, a
|
||||
ld d, 0
|
||||
add hl, de
|
||||
add hl, de
|
||||
call .IsSameItem
|
||||
jr c, .NoRegisteredItem
|
||||
and a
|
||||
ret
|
||||
|
||||
.CheckKeyItem:
|
||||
ld a, [wRegisteredItem]
|
||||
ld hl, wKeyItems
|
||||
ld de, 1
|
||||
call IsInArray
|
||||
jr nc, .NoRegisteredItem
|
||||
ld a, [wRegisteredItem]
|
||||
ld [wCurItem], a
|
||||
and a
|
||||
ret
|
||||
|
||||
.CheckBall:
|
||||
ld hl, wNumBalls
|
||||
call .CheckRegisteredNo
|
||||
jr nc, .NoRegisteredItem
|
||||
inc hl
|
||||
ld e, a
|
||||
ld d, 0
|
||||
add hl, de
|
||||
add hl, de
|
||||
call .IsSameItem
|
||||
jr c, .NoRegisteredItem
|
||||
ret
|
||||
|
||||
.CheckTMHM:
|
||||
jr .NoRegisteredItem
|
||||
|
||||
.NoRegisteredItem:
|
||||
xor a
|
||||
ld [wWhichRegisteredItem], a
|
||||
ld [wRegisteredItem], a
|
||||
scf
|
||||
ret
|
||||
|
||||
.CheckRegisteredNo:
|
||||
ld a, [wWhichRegisteredItem]
|
||||
and REGISTERED_NUMBER
|
||||
dec a
|
||||
cp [hl]
|
||||
jr nc, .NotEnoughItems
|
||||
ld [wCurItemQuantity], a
|
||||
and a
|
||||
ret
|
||||
|
||||
.NotEnoughItems:
|
||||
scf
|
||||
ret
|
||||
|
||||
.IsSameItem:
|
||||
ld a, [wRegisteredItem]
|
||||
cp [hl]
|
||||
jr nz, .NotSameItem
|
||||
ld [wCurItem], a
|
||||
and a
|
||||
ret
|
||||
|
||||
.NotSameItem:
|
||||
scf
|
||||
ret
|
||||
|
||||
UseRegisteredItem:
|
||||
farcall CheckItemMenu
|
||||
ld a, [wItemAttributeValue]
|
||||
ld hl, .SwitchTo
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.SwitchTo:
|
||||
; entries correspond to ITEMMENU_* constants
|
||||
dw .CantUse
|
||||
dw .NoFunction
|
||||
dw .NoFunction
|
||||
dw .NoFunction
|
||||
dw .Current
|
||||
dw .Party
|
||||
dw .Overworld
|
||||
|
||||
.NoFunction:
|
||||
call OpenText
|
||||
call CantUseItem
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
|
||||
.Current:
|
||||
call OpenText
|
||||
call DoItemEffect
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
|
||||
.Party:
|
||||
call RefreshScreen
|
||||
call FadeToMenu
|
||||
call DoItemEffect
|
||||
call CloseSubmenu
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
|
||||
.Overworld:
|
||||
call RefreshScreen
|
||||
ld a, 1
|
||||
ld [wUsingItemWithSelect], a
|
||||
call DoItemEffect
|
||||
xor a
|
||||
ld [wUsingItemWithSelect], a
|
||||
ld a, [wItemEffectSucceeded]
|
||||
cp 1
|
||||
jr nz, ._cantuse
|
||||
scf
|
||||
ld a, HMENURETURN_SCRIPT
|
||||
ldh [hMenuReturn], a
|
||||
ret
|
||||
|
||||
.CantUse:
|
||||
call RefreshScreen
|
||||
|
||||
._cantuse
|
||||
call CantUseItem
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue