pokecrystal/engine/pack.asm

1714 lines
31 KiB
NASM
Raw Normal View History

2018-01-11 17:00:01 +00:00
; Pack.Jumptable and BattlePack.Jumptable indexes
const_def
const PACKSTATE_INITGFX ; 0
const PACKSTATE_INITITEMSPOCKET ; 1
const PACKSTATE_ITEMSPOCKETMENU ; 2
const PACKSTATE_INITBALLSPOCKET ; 3
const PACKSTATE_BALLSPOCKETMENU ; 4
const PACKSTATE_INITKEYITEMSPOCKET ; 5
const PACKSTATE_KEYITEMSPOCKETMENU ; 6
const PACKSTATE_INITTMHMPOCKET ; 7
const PACKSTATE_TMHMPOCKETMENU ; 8
const PACKSTATE_QUITNOSCRIPT ; 9
const PACKSTATE_QUITRUNSCRIPT ; 10
2015-02-11 21:27:15 +00:00
Pack: ; 10000
ld hl, Options
2015-11-23 21:04:53 +00:00
set NO_TEXT_SCROLL, [hl]
2015-12-13 19:15:16 +00:00
call InitPackBuffers
2015-02-11 21:27:15 +00:00
.loop
call JoyTextDelay
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-02-11 21:27:15 +00:00
bit 7, a
jr nz, .done
2015-12-13 19:15:16 +00:00
call .RunJumptable
2015-02-11 21:27:15 +00:00
call DelayFrame
jr .loop
.done
2015-12-13 19:15:16 +00:00
ld a, [wCurrPocket]
2015-11-23 21:04:53 +00:00
ld [wLastPocket], a
2015-02-11 21:27:15 +00:00
ld hl, Options
2015-11-23 21:04:53 +00:00
res NO_TEXT_SCROLL, [hl]
2015-02-11 21:27:15 +00:00
ret
; 10026
2015-12-13 19:15:16 +00:00
.RunJumptable: ; 10026
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-12-13 19:15:16 +00:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 10030
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
.Jumptable: ; 10030 (4:4030)
2018-01-11 17:00:01 +00:00
; entries correspond to PACKSTATE_* constants
2015-12-27 02:59:03 +00:00
dw .InitGFX ; 0
dw .InitItemsPocket ; 1
dw .ItemsPocketMenu ; 2
dw .InitBallsPocket ; 3
dw .BallsPocketMenu ; 4
dw .InitKeyItemsPocket ; 5
dw .KeyItemsPocketMenu ; 6
dw .InitTMHMPocket ; 7
dw .TMHMPocketMenu ; 8
dw Pack_QuitNoScript ; 9
dw Pack_QuitRunScript ; 10
2015-12-13 19:15:16 +00:00
.InitGFX: ; 10046 (4:4046)
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2018-01-11 20:36:11 +00:00
ld a, [wPackJumptableIndex]
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitItemsPocket: ; 10056 (4:4056)
2018-01-11 17:00:01 +00:00
xor a ; ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.ItemsPocketMenu: ; 10067 (4:4067)
ld hl, ItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wItemsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITTMHMPOCKET ; left
ld c, PACKSTATE_INITBALLSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitKeyItemsPocket: ; 10094 (4:4094)
2018-01-11 17:00:01 +00:00
ld a, KEY_ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.KeyItemsPocketMenu: ; 100a6 (4:40a6)
ld hl, KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wKeyItemsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITBALLSPOCKET ; left
ld c, PACKSTATE_INITTMHMPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitTMHMPocket: ; 100d3 (4:40d3)
2018-01-11 17:00:01 +00:00
ld a, TM_HM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.TMHMPocketMenu: ; 100e8 (4:40e8)
2017-12-24 17:47:30 +00:00
farcall TMHMPocket
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2017-12-24 17:47:30 +00:00
farcall _CheckTossableItem
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-12-13 19:15:16 +00:00
jr nz, .use_quit
ld hl, .MenuDataHeader2
ld de, .Jumptable2
jr .load_jump
.use_quit
ld hl, .MenuDataHeader1
ld de, .Jumptable1
.load_jump
2015-02-11 21:27:15 +00:00
push de
call LoadMenuDataHeader
2015-12-15 23:59:49 +00:00
call VerticalMenu
call ExitMenu
2015-02-11 21:27:15 +00:00
pop hl
ret c
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-02-11 21:27:15 +00:00
dec a
2015-12-13 19:15:16 +00:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 10124 (4:4124)
.MenuDataHeader1: ; 0x10124
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2_1
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x1012c
2015-12-13 19:15:16 +00:00
.MenuData2_1: ; 0x1012c
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x10137
2015-12-13 19:15:16 +00:00
.Jumptable1: ; 10137
2015-12-27 02:59:03 +00:00
dw .UseItem
dw QuitItemSubmenu
2015-12-13 19:15:16 +00:00
2015-02-11 21:27:15 +00:00
; 1013b
2015-12-13 19:15:16 +00:00
.MenuDataHeader2: ; 0x1013b
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2_2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10143
2015-12-13 19:15:16 +00:00
.MenuData2_2: ; 0x10143
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 3 ; items
db "USE@"
db "GIVE@"
db "QUIT@"
; 0x10153
2015-12-13 19:15:16 +00:00
.Jumptable2: ; 10153
dw .UseItem
2015-11-23 21:04:53 +00:00
dw GiveItem
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 10159
2015-12-13 19:15:16 +00:00
.UseItem: ; 10159
2017-12-24 17:47:30 +00:00
farcall AskTeachTMHM
2015-02-11 21:27:15 +00:00
ret c
2017-12-24 17:47:30 +00:00
farcall ChooseMonToLearnTMHM
2015-12-13 19:15:16 +00:00
jr c, .declined
2015-02-11 21:27:15 +00:00
ld hl, Options
ld a, [hl]
push af
2015-12-13 19:15:16 +00:00
res NO_TEXT_SCROLL, [hl]
2017-12-24 17:47:30 +00:00
farcall TeachTMHM
2015-02-11 21:27:15 +00:00
pop af
ld [Options], a
2015-12-13 19:15:16 +00:00
.declined
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitBallsPocket: ; 10186 (4:4186)
2018-01-11 17:00:01 +00:00
ld a, BALL_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.BallsPocketMenu: ; 10198 (4:4198)
ld hl, BallsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wBallsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wBallsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITITEMSPOCKET ; left
ld c, PACKSTATE_INITKEYITEMSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.ItemBallsKey_LoadSubmenu: ; 101c5 (4:41c5)
2017-12-24 17:47:30 +00:00
farcall _CheckTossableItem
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr nz, .tossable
2017-12-24 17:47:30 +00:00
farcall CheckSelectableItem
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr nz, .selectable
2017-12-24 17:47:30 +00:00
farcall CheckItemMenu
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr nz, .usable
jr .unusable
.selectable
2017-12-24 17:47:30 +00:00
farcall CheckItemMenu
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr nz, .selectable_usable
jr .selectable_unusable
.tossable
2017-12-24 17:47:30 +00:00
farcall CheckSelectableItem
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr nz, .tossable_selectable
jr .tossable_unselectable
.usable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_UsableKeyItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_UseGiveTossRegisterQuit
2015-10-24 14:34:19 +00:00
jr .build_menu
.selectable_usable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_UsableItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_UseGiveTossQuit
2015-10-24 14:34:19 +00:00
jr .build_menu
.tossable_selectable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_UnusableItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_UseQuit
2015-10-24 14:34:19 +00:00
jr .build_menu
.tossable_unselectable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_UnusableKeyItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_UseRegisterQuit
2015-10-24 14:34:19 +00:00
jr .build_menu
.unusable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_HoldableKeyItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_GiveTossRegisterQuit
2015-10-24 14:34:19 +00:00
jr .build_menu
.selectable_unusable
2015-11-23 21:04:53 +00:00
ld hl, MenuDataHeader_HoldableItem
2015-12-13 19:15:16 +00:00
ld de, Jumptable_GiveTossQuit
2015-10-24 14:34:19 +00:00
.build_menu
2015-02-11 21:27:15 +00:00
push de
call LoadMenuDataHeader
2015-12-15 23:59:49 +00:00
call VerticalMenu
call ExitMenu
2015-02-11 21:27:15 +00:00
pop hl
ret c
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-02-11 21:27:15 +00:00
dec a
2015-12-13 19:15:16 +00:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 10249 (4:4249)
2015-11-23 21:04:53 +00:00
MenuDataHeader_UsableKeyItem: ; 0x10249
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10251
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x10251
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 5 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
; 0x1026a
2015-12-13 19:15:16 +00:00
Jumptable_UseGiveTossRegisterQuit: ; 1026a
2015-12-27 02:59:03 +00:00
dw UseItem
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 10274
2015-11-23 21:04:53 +00:00
MenuDataHeader_UsableItem: ; 0x10274
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x1027c
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x1027c
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 4 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "QUIT@"
; 0x10291
2015-12-13 19:15:16 +00:00
Jumptable_UseGiveTossQuit: ; 10291
2015-12-27 02:59:03 +00:00
dw UseItem
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 10299
2015-11-23 21:04:53 +00:00
MenuDataHeader_UnusableItem: ; 0x10299
2015-10-24 14:34:19 +00:00
db %01000000 ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x102a1
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x102a1
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x102ac
2015-12-13 19:15:16 +00:00
Jumptable_UseQuit: ; 102ac
2015-12-27 02:59:03 +00:00
dw UseItem
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 102b0
2015-11-23 21:04:53 +00:00
MenuDataHeader_UnusableKeyItem: ; 0x102b0
2015-10-24 14:34:19 +00:00
db %01000000 ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x102b8
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x102b8
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 3 ; items
db "USE@"
db "SEL@"
db "QUIT@"
; 0x102c7
2015-12-13 19:15:16 +00:00
Jumptable_UseRegisterQuit: ; 102c7
2015-12-27 02:59:03 +00:00
dw UseItem
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 102cd
2015-11-23 21:04:53 +00:00
MenuDataHeader_HoldableKeyItem: ; 0x102cd
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x102d5
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x102d5
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 4 ; items
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
; 0x102ea
2015-12-13 19:15:16 +00:00
Jumptable_GiveTossRegisterQuit: ; 102ea
2015-12-27 02:59:03 +00:00
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 21:27:15 +00:00
; 102f2
2015-11-23 21:04:53 +00:00
MenuDataHeader_HoldableItem: ; 0x102f2
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-23 21:04:53 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x102fa
2015-11-23 21:04:53 +00:00
.MenuData2: ; 0x102fa
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 3 ; items
db "GIVE@"
db "TOSS@"
db "QUIT@"
; 0x1030b
2015-12-13 19:15:16 +00:00
Jumptable_GiveTossQuit: ; 1030b
2015-12-27 02:59:03 +00:00
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
2015-12-13 19:15:16 +00:00
2015-02-11 21:27:15 +00:00
; 10311
2015-11-23 21:04:53 +00:00
UseItem: ; 10311
2017-12-24 17:47:30 +00:00
farcall CheckItemMenu
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-12-27 02:59:03 +00:00
ld hl, .dw
2015-02-11 21:27:15 +00:00
rst JumpTable
ret
; 1031f
.dw ; 1031f (4:431f)
2018-01-11 17:00:01 +00:00
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
2015-12-27 02:59:03 +00:00
dw .Oak
dw .Oak
dw .Oak
2018-01-11 17:00:01 +00:00
dw .Current ; ITEMMENU_CURRENT
dw .Party ; ITEMMENU_PARTY
dw .Field ; ITEMMENU_CLOSE
2015-02-11 21:27:15 +00:00
; 1035c
2015-10-24 14:34:19 +00:00
.Oak: ; 1032d (4:432d)
2015-11-23 21:04:53 +00:00
ld hl, Text_ThisIsntTheTime
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.Current: ; 10334 (4:4334)
2015-02-11 21:27:15 +00:00
call DoItemEffect
ret
2015-10-24 14:34:19 +00:00
.Party: ; 10338 (4:4338)
2015-02-11 21:27:15 +00:00
ld a, [PartyCount]
and a
2015-10-24 14:34:19 +00:00
jr z, .NoPokemon
2015-02-11 21:27:15 +00:00
call DoItemEffect
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.NoPokemon:
ld hl, TextJump_YouDontHaveAPkmn
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.Field: ; 10355 (4:4355)
2015-02-11 21:27:15 +00:00
call DoItemEffect
2015-12-13 19:15:16 +00:00
ld a, [wItemEffectSucceeded]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr z, .Oak
2018-01-11 17:00:01 +00:00
ld a, PACKSTATE_QUITRUNSCRIPT
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-02-11 21:27:15 +00:00
ret
; 10364 (4:4364)
2015-11-23 21:04:53 +00:00
TossMenu: ; 10364
ld hl, Text_ThrowAwayHowMany
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2017-12-24 17:47:30 +00:00
farcall SelectQuantityToToss
2015-02-11 21:27:15 +00:00
push af
call ExitMenu
2015-02-11 21:27:15 +00:00
pop af
2015-11-23 21:04:53 +00:00
jr c, .finish
call Pack_GetItemName
ld hl, Text_ConfirmThrowAway
call MenuTextBox
2015-02-11 21:27:15 +00:00
call YesNoBox
push af
call ExitMenu
2015-02-11 21:27:15 +00:00
pop af
2015-11-23 21:04:53 +00:00
jr c, .finish
2015-02-11 21:27:15 +00:00
ld hl, NumItems
2015-12-18 03:31:16 +00:00
ld a, [CurItemQuantity]
2015-02-11 21:27:15 +00:00
call TossItem
2015-11-23 21:04:53 +00:00
call Pack_GetItemName
ld hl, Text_ThrewAway
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-11-23 21:04:53 +00:00
.finish
2015-02-11 21:27:15 +00:00
ret
; 1039d
ResetPocketCursorPositions: ; 1039d
2015-12-13 19:15:16 +00:00
; unreferenced
ld a, [wCurrPocket]
2018-01-11 17:00:01 +00:00
and a ; ITEM_POCKET
2015-12-13 19:15:16 +00:00
jr z, .items
2018-01-11 17:00:01 +00:00
dec a ; BALL_POCKET
2015-12-13 19:15:16 +00:00
jr z, .balls
2018-01-11 17:00:01 +00:00
dec a ; KEY_ITEM_POCKET
2015-12-13 19:15:16 +00:00
jr z, .key
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.balls
2015-02-11 21:27:15 +00:00
xor a
2015-10-24 23:49:19 +00:00
ld [wBallsPocketCursor], a
2015-11-23 21:04:53 +00:00
ld [wBallsPocketScrollPosition], a
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.items
2015-02-11 21:27:15 +00:00
xor a
2015-10-24 23:49:19 +00:00
ld [wItemsPocketCursor], a
2015-11-23 21:04:53 +00:00
ld [wItemsPocketScrollPosition], a
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.key
2015-02-11 21:27:15 +00:00
xor a
2015-10-24 23:49:19 +00:00
ld [wKeyItemsPocketCursor], a
2015-11-23 21:04:53 +00:00
ld [wKeyItemsPocketScrollPosition], a
2015-02-11 21:27:15 +00:00
ret
; 103c2
2015-11-23 21:04:53 +00:00
RegisterItem: ; 103c2
2017-12-24 17:47:30 +00:00
farcall CheckSelectableItem
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 21:27:15 +00:00
and a
2015-12-13 19:15:16 +00:00
jr nz, .cant_register
ld a, [wCurrPocket]
2015-02-11 21:27:15 +00:00
rrca
rrca
and $c0
ld b, a
2015-12-18 03:31:16 +00:00
ld a, [CurItemQuantity]
2015-02-11 21:27:15 +00:00
inc a
and $3f
or b
ld [WhichRegisteredItem], a
ld a, [CurItem]
ld [RegisteredItem], a
2015-11-23 21:04:53 +00:00
call Pack_GetItemName
2015-02-11 21:27:15 +00:00
ld de, SFX_FULL_HEAL
call WaitPlaySFX
2015-11-23 21:04:53 +00:00
ld hl, Text_RegisteredItem
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.cant_register
2015-11-23 21:04:53 +00:00
ld hl, Text_CantRegister
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
; 103fd
2015-11-23 21:04:53 +00:00
GiveItem: ; 103fd
2015-02-11 21:27:15 +00:00
ld a, [PartyCount]
and a
2015-12-13 19:15:16 +00:00
jp z, .NoPokemon
2015-02-11 21:27:15 +00:00
ld a, [Options]
push af
2015-12-13 19:15:16 +00:00
res NO_TEXT_SCROLL, a
2015-02-11 21:27:15 +00:00
ld [Options], a
ld a, PARTYMENUACTION_GIVE_ITEM
2015-02-11 21:27:15 +00:00
ld [PartyMenuActionText], a
2015-11-12 04:38:57 +00:00
call ClearBGPalettes
2017-12-24 17:47:30 +00:00
farcall LoadPartyMenuGFX
farcall InitPartyMenuWithCancel
farcall InitPartyMenuGFX
2015-12-13 19:15:16 +00:00
.loop
2017-12-24 17:47:30 +00:00
farcall WritePartyMenuTilemap
farcall PrintPartyMenuText
2015-02-11 21:27:15 +00:00
call WaitBGMap
2015-09-09 23:27:07 +00:00
call SetPalettes
2015-02-11 21:27:15 +00:00
call DelayFrame
2017-12-24 17:47:30 +00:00
farcall PartyMenuSelect
2015-12-13 19:15:16 +00:00
jr c, .finish
2015-02-11 21:27:15 +00:00
ld a, [CurPartySpecies]
cp EGG
2015-12-13 19:15:16 +00:00
jr nz, .give
ld hl, .Egg
2015-02-11 21:27:15 +00:00
call PrintText
2015-12-13 19:15:16 +00:00
jr .loop
2015-12-13 19:15:16 +00:00
.give
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-02-11 21:27:15 +00:00
push af
2018-01-11 20:36:11 +00:00
ld a, [wPackJumptableIndex]
2015-02-11 21:27:15 +00:00
push af
call GetCurNick
ld hl, StringBuffer1
2015-12-19 01:07:09 +00:00
ld de, wMonOrItemNameBuffer
2015-02-11 21:27:15 +00:00
ld bc, PKMN_NAME_LENGTH
call CopyBytes
2015-12-13 19:15:16 +00:00
call TryGiveItemToPartymon
2015-02-11 21:27:15 +00:00
pop af
2018-01-11 20:36:11 +00:00
ld [wPackJumptableIndex], a
2015-02-11 21:27:15 +00:00
pop af
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-12-13 19:15:16 +00:00
.finish
2015-02-11 21:27:15 +00:00
pop af
ld [Options], a
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.NoPokemon: ; 10486 (4:4486)
ld hl, TextJump_YouDontHaveAPkmn
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
; 1048d (4:448d)
2015-12-13 19:15:16 +00:00
.Egg: ; 0x1048d
2015-02-11 21:27:15 +00:00
; An EGG can't hold an item.
text_jump Text_AnEGGCantHoldAnItem
2015-02-11 21:27:15 +00:00
db "@"
; 0x10492
2015-11-23 21:04:53 +00:00
QuitItemSubmenu: ; 10492
2015-02-11 21:27:15 +00:00
ret
; 10493
BattlePack: ; 10493
ld hl, Options
2015-12-13 19:15:16 +00:00
set NO_TEXT_SCROLL, [hl]
call InitPackBuffers
2015-11-23 21:04:53 +00:00
.loop
call JoyTextDelay
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-02-11 21:27:15 +00:00
bit 7, a
2015-11-23 21:04:53 +00:00
jr nz, .end
2015-12-13 19:15:16 +00:00
call .RunJumptable
2015-02-11 21:27:15 +00:00
call DelayFrame
2015-11-23 21:04:53 +00:00
jr .loop
2015-02-11 21:27:15 +00:00
2015-11-23 21:04:53 +00:00
.end
2015-12-13 19:15:16 +00:00
ld a, [wCurrPocket]
2015-11-23 21:04:53 +00:00
ld [wLastPocket], a
2015-02-11 21:27:15 +00:00
ld hl, Options
2015-12-13 19:15:16 +00:00
res NO_TEXT_SCROLL, [hl]
2015-02-11 21:27:15 +00:00
ret
; 104b9
2015-12-13 19:15:16 +00:00
.RunJumptable: ; 104b9
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-12-13 19:15:16 +00:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 104c3
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
.Jumptable: ; 104c3 (4:44c3)
2018-01-11 17:00:01 +00:00
; entries correspond to PACKSTATE_* constants
2015-12-27 02:59:03 +00:00
dw .InitGFX ; 0
dw .InitItemsPocket ; 1
dw .ItemsPocketMenu ; 2
dw .InitBallsPocket ; 3
dw .BallsPocketMenu ; 4
dw .InitKeyItemsPocket ; 5
dw .KeyItemsPocketMenu ; 6
dw .InitTMHMPocket ; 7
dw .TMHMPocketMenu ; 8
dw Pack_QuitNoScript ; 9
dw Pack_QuitRunScript ; 10
2015-12-13 19:15:16 +00:00
.InitGFX: ; 104d9 (4:44d9)
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2018-01-11 20:36:11 +00:00
ld a, [wPackJumptableIndex]
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitItemsPocket: ; 104e9 (4:44e9)
2018-01-11 17:00:01 +00:00
xor a ; ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.ItemsPocketMenu: ; 104fa (4:44fa)
ld hl, ItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wItemsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITTMHMPOCKET ; left
ld c, PACKSTATE_INITBALLSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call ItemSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitKeyItemsPocket: ; 10527 (4:4527)
2018-01-11 17:00:01 +00:00
ld a, KEY_ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.KeyItemsPocketMenu: ; 10539 (4:4539)
ld hl, KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wKeyItemsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITBALLSPOCKET ; left
ld c, PACKSTATE_INITTMHMPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call ItemSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitTMHMPocket: ; 10566 (4:4566)
2018-01-11 17:00:01 +00:00
ld a, TM_HM_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-11-23 21:04:53 +00:00
ld hl, Text_PackEmptyString
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.TMHMPocketMenu: ; 10581 (4:4581)
2017-12-24 17:47:30 +00:00
farcall TMHMPocket
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
xor a
2015-12-13 19:15:16 +00:00
call TMHMSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.InitBallsPocket: ; 10594 (4:4594)
2018-01-11 17:00:01 +00:00
ld a, BALL_POCKET
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_JumptableNext
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
.BallsPocketMenu: ; 105a6 (4:45a6)
ld hl, BallsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wBallsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wBallsPocketCursor], a
2018-01-11 17:00:01 +00:00
ld b, PACKSTATE_INITITEMSPOCKET ; left
ld c, PACKSTATE_INITKEYITEMSPOCKET ; right
2015-12-13 19:15:16 +00:00
call Pack_InterpretJoypad
2015-02-11 21:27:15 +00:00
ret c
2015-12-13 19:15:16 +00:00
call ItemSubmenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
ItemSubmenu: ; 105d3 (4:45d3)
2017-12-24 17:47:30 +00:00
farcall CheckItemContext
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
2015-12-13 19:15:16 +00:00
TMHMSubmenu: ; 105dc (4:45dc)
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr z, .NoUse
ld hl, .UsableMenuDataHeader
ld de, .UsableJumptable
jr .proceed
2015-12-13 19:15:16 +00:00
.NoUse:
2015-10-24 14:34:19 +00:00
ld hl, .UnusableMenuDataHeader
ld de, .UnusableJumptable
.proceed
2015-02-11 21:27:15 +00:00
push de
call LoadMenuDataHeader
2015-12-15 23:59:49 +00:00
call VerticalMenu
call ExitMenu
2015-02-11 21:27:15 +00:00
pop hl
ret c
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-02-11 21:27:15 +00:00
dec a
2015-12-13 19:15:16 +00:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 10601 (4:4601)
2015-10-24 14:34:19 +00:00
.UsableMenuDataHeader: ; 0x10601
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-10-24 14:34:19 +00:00
dw .UsableMenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10609
2015-10-24 14:34:19 +00:00
.UsableMenuData2: ; 0x10609
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x10614
2015-10-24 14:34:19 +00:00
.UsableJumptable: ; 10614
2015-12-27 02:59:03 +00:00
dw .Use
dw .Quit
2015-02-11 21:27:15 +00:00
; 10618
2015-10-24 14:34:19 +00:00
.UnusableMenuDataHeader: ; 0x10618
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-10-24 14:34:19 +00:00
dw .UnusableMenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10620
2015-10-24 14:34:19 +00:00
.UnusableMenuData2: ; 0x10620
2015-02-11 21:27:15 +00:00
db $c0 ; flags
db 1 ; items
db "QUIT@"
; 0x10627
2015-10-24 14:34:19 +00:00
.UnusableJumptable: ; 10627
2015-12-27 02:59:03 +00:00
dw .Quit
2015-02-11 21:27:15 +00:00
; 10629
2015-10-24 14:34:19 +00:00
.Use: ; 10629
2017-12-24 17:47:30 +00:00
farcall CheckItemContext
2015-10-24 14:34:19 +00:00
ld a, [wItemAttributeParamBuffer]
ld hl, .ItemFunctionJumptable
2015-02-11 21:27:15 +00:00
rst JumpTable
ret
2015-10-24 14:34:19 +00:00
.ItemFunctionJumptable: ; 10637 (4:4637)
2018-01-11 17:00:01 +00:00
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
2015-12-27 02:59:03 +00:00
dw .Oak
dw .Oak
dw .Oak
2018-01-11 17:00:01 +00:00
dw .Unused ; ITEMMENU_CURRENT
dw .BattleField ; ITEMMENU_PARTY
dw .BattleOnly ; ITEMMENU_CLOSE
2015-02-11 21:27:15 +00:00
2015-10-24 14:34:19 +00:00
.Oak: ; 10645 (4:4645)
2015-11-23 21:04:53 +00:00
ld hl, Text_ThisIsntTheTime
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.Unused: ; 1064c (4:464c)
2015-02-11 21:27:15 +00:00
call DoItemEffect
2015-12-13 19:15:16 +00:00
ld a, [wItemEffectSucceeded]
2015-02-11 21:27:15 +00:00
and a
2015-12-13 19:15:16 +00:00
jr nz, .ReturnToBattle
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.BattleField: ; 10656 (4:4656)
2015-02-11 21:27:15 +00:00
call DoItemEffect
2015-12-13 19:15:16 +00:00
ld a, [wItemEffectSucceeded]
2015-02-11 21:27:15 +00:00
and a
2015-12-13 19:15:16 +00:00
jr nz, .quit_run_script
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2015-12-13 19:15:16 +00:00
call Pack_InitGFX
2015-10-24 14:34:19 +00:00
call WaitBGMap_DrawPackGFX
2015-12-13 19:15:16 +00:00
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
2015-12-13 19:15:16 +00:00
.ReturnToBattle: ; 1066c (4:466c)
2015-11-12 04:38:57 +00:00
call ClearBGPalettes
2015-12-13 19:15:16 +00:00
jr .quit_run_script
2015-02-11 21:27:15 +00:00
2015-10-24 14:34:19 +00:00
.BattleOnly: ; 10671 (4:4671)
2015-02-11 21:27:15 +00:00
call DoItemEffect
2015-12-13 19:15:16 +00:00
ld a, [wItemEffectSucceeded]
2015-02-11 21:27:15 +00:00
and a
2015-10-24 14:34:19 +00:00
jr z, .Oak
2015-02-11 21:27:15 +00:00
cp $2
2015-12-13 19:15:16 +00:00
jr z, .didnt_use_item
.quit_run_script ; 1067e (4:467e)
2018-01-11 17:00:01 +00:00
ld a, PACKSTATE_QUITRUNSCRIPT
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.didnt_use_item ; 10684 (4:4684)
2015-02-11 21:27:15 +00:00
xor a
2015-12-13 19:15:16 +00:00
ld [wItemEffectSucceeded], a
2015-02-11 21:27:15 +00:00
ret
; 10689 (4:4689)
2015-10-24 14:34:19 +00:00
.Quit: ; 10689
2015-02-11 21:27:15 +00:00
ret
; 1068a
2015-12-13 19:15:16 +00:00
InitPackBuffers: ; 1068a
2015-02-11 21:27:15 +00:00
xor a
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2018-01-11 20:36:11 +00:00
; pocket id -> jumptable index
2015-11-23 21:04:53 +00:00
ld a, [wLastPocket]
2018-01-11 17:00:01 +00:00
maskbits NUM_POCKETS +- 1
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-02-11 21:27:15 +00:00
inc a
add a
dec a
2018-01-11 20:36:11 +00:00
ld [wPackJumptableIndex], a
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
xor a
2015-12-13 19:15:16 +00:00
ld [wSwitchItem], a
2015-02-11 21:27:15 +00:00
ret
; 106a5
2015-12-13 19:15:16 +00:00
DepositSellInitPackBuffers: ; 106a5
2015-02-11 21:27:15 +00:00
xor a
ld [hBGMapMode], a
2018-01-11 20:36:11 +00:00
ld [wJumptableIndex], a ; PACKSTATE_INITGFX
ld [wPackJumptableIndex], a ; PACKSTATE_INITGFX
ld [wCurrPocket], a ; ITEM_POCKET
ld [wPackUsedItem], a
2015-12-13 19:15:16 +00:00
ld [wSwitchItem], a
call Pack_InitGFX
call Pack_InitColors
2015-02-11 21:27:15 +00:00
ret
; 106be
2015-12-13 19:15:16 +00:00
DepositSellPack: ; 106be
.loop
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
jr c, .loop
2015-02-11 21:27:15 +00:00
ret
; 106c7
2015-12-13 19:15:16 +00:00
.RunJumptable: ; 106c7
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-12-13 19:15:16 +00:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 106d1
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
.Jumptable: ; 106d1 (4:46d1)
2018-01-11 17:00:01 +00:00
; entries correspond to *_POCKET constants
2015-12-27 02:59:03 +00:00
dw .ItemsPocket
dw .BallsPocket
dw .KeyItemsPocket
dw .TMHMPocket
2017-12-29 12:52:42 +00:00
2015-10-24 14:34:19 +00:00
.ItemsPocket: ; 106d9 (4:46d9)
2018-01-11 17:00:01 +00:00
xor a ; ITEM_POCKET
2015-10-24 14:34:19 +00:00
call InitPocket
2015-12-13 19:15:16 +00:00
ld hl, PC_Mart_ItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wItemsPocketCursor], a
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.KeyItemsPocket: ; 106ff (4:46ff)
2018-01-11 17:00:01 +00:00
ld a, KEY_ITEM_POCKET
2015-10-24 14:34:19 +00:00
call InitPocket
2015-12-13 19:15:16 +00:00
ld hl, PC_Mart_KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wKeyItemsPocketCursor], a
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
.TMHMPocket: ; 10726 (4:4726)
2018-01-11 17:00:01 +00:00
ld a, TM_HM_POCKET
2015-10-24 14:34:19 +00:00
call InitPocket
call WaitBGMap_DrawPackGFX
2017-12-24 17:47:30 +00:00
farcall TMHMPocket
2015-02-11 21:27:15 +00:00
ld a, [CurItem]
ld [CurItem], a
ret
2015-10-24 14:34:19 +00:00
.BallsPocket: ; 1073b (4:473b)
2018-01-11 17:00:01 +00:00
ld a, BALL_POCKET
2015-10-24 14:34:19 +00:00
call InitPocket
2015-12-13 19:15:16 +00:00
ld hl, PC_Mart_BallsPocketMenuDataHeader
call CopyMenuDataHeader
2015-10-24 23:49:19 +00:00
ld a, [wBallsPocketCursor]
2015-11-01 17:44:30 +00:00
ld [wMenuCursorBuffer], a
2015-11-23 21:04:53 +00:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2015-10-24 23:49:19 +00:00
ld [wBallsPocketCursor], a
2015-02-11 21:27:15 +00:00
ret
2015-10-24 14:34:19 +00:00
InitPocket: ; 10762 (4:4762)
2015-12-13 19:15:16 +00:00
ld [wCurrPocket], a
2015-10-24 14:34:19 +00:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
DepositSellTutorial_InterpretJoypad: ; 1076f
ld hl, wMenuJoypad
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and A_BUTTON
jr nz, .a_button
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and B_BUTTON
jr nz, .b_button
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and D_LEFT
jr nz, .d_left
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and D_RIGHT
jr nz, .d_right
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
.a_button
ld a, TRUE
2018-01-11 20:36:11 +00:00
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
and a
ret
2015-12-13 19:15:16 +00:00
.b_button
2018-01-11 20:36:11 +00:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
and a
ret
2015-12-13 19:15:16 +00:00
.d_left
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-02-11 21:27:15 +00:00
dec a
2018-01-11 17:00:01 +00:00
maskbits NUM_POCKETS +- 1
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-02-11 21:27:15 +00:00
push de
2015-12-13 19:15:16 +00:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 21:27:15 +00:00
call PlaySFX
pop de
scf
ret
2015-12-13 19:15:16 +00:00
.d_right
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-02-11 21:27:15 +00:00
inc a
2018-01-11 17:00:01 +00:00
maskbits NUM_POCKETS +- 1
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-02-11 21:27:15 +00:00
push de
2015-12-13 19:15:16 +00:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 21:27:15 +00:00
call PlaySFX
pop de
scf
ret
; 107bb
2015-11-23 21:04:53 +00:00
TutorialPack: ; 107bb
2015-12-13 19:15:16 +00:00
call DepositSellInitPackBuffers
2015-02-11 21:27:15 +00:00
ld a, [InputType]
or a
2015-11-23 21:04:53 +00:00
jr z, .loop
2017-12-24 17:47:30 +00:00
farcall _DudeAutoInput_RightA
2015-11-23 21:04:53 +00:00
.loop
2015-12-13 19:15:16 +00:00
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
2015-11-23 21:04:53 +00:00
jr c, .loop
2018-01-11 20:36:11 +00:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
ret
; 107d7
2015-12-13 19:15:16 +00:00
.RunJumptable: ; 107d7
2015-10-24 23:49:19 +00:00
ld a, [wJumptableIndex]
2015-12-27 02:59:03 +00:00
ld hl, .dw
2015-12-13 19:15:16 +00:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 107e1
2015-02-11 21:27:15 +00:00
.dw ; 107e1 (4:47e1)
2018-01-11 17:00:01 +00:00
; entries correspond to *_POCKET constants
2015-12-27 02:59:03 +00:00
dw .Items
dw .Balls
dw .KeyItems
dw .TMHM
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
.Items: ; 107e9 (4:47e9)
2018-01-11 17:00:01 +00:00
xor a ; ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld hl, .ItemsMenuDataHeader
jr .DisplayPocket
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 107ef (4:47ef)
.ItemsMenuDataHeader: ; 0x107ef
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .ItemsMenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x107f7
2015-12-13 19:15:16 +00:00
.ItemsMenuData2: ; 0x107f7
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
2015-12-13 19:15:16 +00:00
dbw 0, wDudeNumItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10807
2015-12-13 19:15:16 +00:00
.KeyItems: ; 10807 (4:4807)
2018-01-11 17:00:01 +00:00
ld a, KEY_ITEM_POCKET
2015-12-13 19:15:16 +00:00
ld hl, .KeyItemsMenuDataHeader
jr .DisplayPocket
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 1080e (4:480e)
.KeyItemsMenuDataHeader: ; 0x1080e
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .KeyItemsMenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10816
2015-12-13 19:15:16 +00:00
.KeyItemsMenuData2: ; 0x10816
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
2015-12-13 19:15:16 +00:00
dbw 0, wDudeNumKeyItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10826
2015-12-13 19:15:16 +00:00
.TMHM: ; 10826 (4:4826)
2018-01-11 17:00:01 +00:00
ld a, TM_HM_POCKET
2015-10-24 14:34:19 +00:00
call InitPocket
call WaitBGMap_DrawPackGFX
2017-12-24 17:47:30 +00:00
farcall TMHMPocket
2015-02-11 21:27:15 +00:00
ld a, [CurItem]
ld [CurItem], a
ret
2015-12-13 19:15:16 +00:00
.Balls: ; 1083b (4:483b)
2018-01-11 17:00:01 +00:00
ld a, BALL_POCKET
2015-12-13 19:15:16 +00:00
ld hl, .BallsMenuDataHeader
jr .DisplayPocket
2015-02-11 21:27:15 +00:00
2015-12-13 19:15:16 +00:00
; 10842 (4:4842)
.BallsMenuDataHeader: ; 0x10842
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .BallsMenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x1084a
2015-12-13 19:15:16 +00:00
.BallsMenuData2: ; 0x1084a
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
2015-12-13 19:15:16 +00:00
dbw 0, wDudeNumBalls
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 1085a
2015-12-13 19:15:16 +00:00
.DisplayPocket: ; 1085a (4:485a)
2015-02-11 21:27:15 +00:00
push hl
2015-10-24 14:34:19 +00:00
call InitPocket
2015-02-11 21:27:15 +00:00
pop hl
call CopyMenuDataHeader
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
Pack_JumptableNext: ; 10866 (4:4866)
2015-10-24 23:49:19 +00:00
ld hl, wJumptableIndex
2015-02-11 21:27:15 +00:00
inc [hl]
ret
2015-12-13 19:15:16 +00:00
Pack_GetJumptablePointer: ; 1086b
2015-02-11 21:27:15 +00:00
ld e, a
ld d, 0
add hl, de
add hl, de
2015-02-11 21:27:15 +00:00
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 10874
2015-12-13 19:15:16 +00:00
Pack_QuitNoScript: ; 10874 (4:4874)
2015-10-24 23:49:19 +00:00
ld hl, wJumptableIndex
2015-02-11 21:27:15 +00:00
set 7, [hl]
2018-01-11 20:36:11 +00:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
Pack_QuitRunScript: ; 1087e (4:487e)
2015-10-24 23:49:19 +00:00
ld hl, wJumptableIndex
2015-02-11 21:27:15 +00:00
set 7, [hl]
2015-12-13 19:15:16 +00:00
ld a, TRUE
2018-01-11 20:36:11 +00:00
ld [wPackUsedItem], a
2015-02-11 21:27:15 +00:00
ret
2015-12-13 19:15:16 +00:00
Pack_PrintTextNoScroll: ; 10889 (4:4889)
2015-02-11 21:27:15 +00:00
ld a, [Options]
push af
2015-12-13 19:15:16 +00:00
set NO_TEXT_SCROLL, a
2015-02-11 21:27:15 +00:00
ld [Options], a
call PrintText
pop af
ld [Options], a
ret
2015-10-24 14:34:19 +00:00
WaitBGMap_DrawPackGFX: ; 1089a (4:489a)
2015-02-11 21:27:15 +00:00
call WaitBGMap
2015-10-24 14:34:19 +00:00
DrawPackGFX: ; 1089d
2015-12-13 19:15:16 +00:00
ld a, [wCurrPocket]
2018-01-11 17:00:01 +00:00
maskbits NUM_POCKETS +- 1
2015-02-11 21:27:15 +00:00
ld e, a
ld d, $0
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
2015-10-24 14:34:19 +00:00
jr z, .male_dude
ld a, [wPlayerGender]
2015-02-11 21:27:15 +00:00
bit 0, a
2015-10-24 14:34:19 +00:00
jr nz, .female
.male_dude
2015-02-11 21:27:15 +00:00
ld hl, PackGFXPointers
add hl, de
add hl, de
2015-02-11 21:27:15 +00:00
ld a, [hli]
ld e, a
ld d, [hl]
2017-12-28 12:32:33 +00:00
ld hl, vTiles2 tile $50
2015-02-11 21:27:15 +00:00
lb bc, BANK(PackGFX), 15
call Request2bpp
ret
2015-10-24 14:34:19 +00:00
.female
2017-12-24 17:47:30 +00:00
farcall DrawKrisPackGFX
2015-02-11 21:27:15 +00:00
ret
; 108cc
PackGFXPointers: ; 108cc
2018-01-11 17:00:01 +00:00
dw PackGFX + (15 tiles) * 1 ; ITEM_POCKET
dw PackGFX + (15 tiles) * 3 ; BALL_POCKET
dw PackGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
dw PackGFX + (15 tiles) * 2 ; TM_HM_POCKET
2015-02-11 21:27:15 +00:00
; 108d4
2015-12-13 19:15:16 +00:00
Pack_InterpretJoypad: ; 108d4 (4:48d4)
ld hl, wMenuJoypad
ld a, [wSwitchItem]
2015-02-11 21:27:15 +00:00
and a
2015-12-13 19:15:16 +00:00
jr nz, .switching_item
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and A_BUTTON
jr nz, .a_button
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and B_BUTTON
jr nz, .b_button
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and D_LEFT
jr nz, .d_left
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and D_RIGHT
jr nz, .d_right
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and SELECT
jr nz, .select
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
.a_button
2015-02-11 21:27:15 +00:00
and a
ret
2015-12-13 19:15:16 +00:00
.b_button
2018-01-11 17:00:01 +00:00
ld a, PACKSTATE_QUITNOSCRIPT
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
.d_left
2015-02-11 21:27:15 +00:00
ld a, b
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2018-01-11 20:36:11 +00:00
ld [wPackJumptableIndex], a
2015-02-11 21:27:15 +00:00
push de
2015-12-13 19:15:16 +00:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 21:27:15 +00:00
call PlaySFX
pop de
scf
ret
2015-12-13 19:15:16 +00:00
.d_right
2015-02-11 21:27:15 +00:00
ld a, c
2015-10-24 23:49:19 +00:00
ld [wJumptableIndex], a
2018-01-11 20:36:11 +00:00
ld [wPackJumptableIndex], a
2015-02-11 21:27:15 +00:00
push de
2015-12-13 19:15:16 +00:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 21:27:15 +00:00
call PlaySFX
pop de
scf
ret
2015-12-13 19:15:16 +00:00
.select
2017-12-24 17:47:30 +00:00
farcall SwitchItemsInBag
2015-11-23 21:04:53 +00:00
ld hl, Text_MoveItemWhere
2015-12-13 19:15:16 +00:00
call Pack_PrintTextNoScroll
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
.switching_item
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and A_BUTTON | SELECT
jr nz, .place_insert
2015-02-11 21:27:15 +00:00
ld a, [hl]
2015-12-13 19:15:16 +00:00
and B_BUTTON
jr nz, .end_switch
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
.place_insert
2017-12-24 17:47:30 +00:00
farcall SwitchItemsInBag
2015-02-11 21:27:15 +00:00
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
2015-12-13 19:15:16 +00:00
.end_switch
2015-02-11 21:27:15 +00:00
xor a
2015-12-13 19:15:16 +00:00
ld [wSwitchItem], a
2015-02-11 21:27:15 +00:00
scf
ret
2015-12-13 19:15:16 +00:00
Pack_InitGFX: ; 10955
2015-11-12 04:38:57 +00:00
call ClearBGPalettes
2015-02-11 21:27:15 +00:00
call ClearTileMap
call ClearSprites
call DisableLCD
ld hl, PackMenuGFX
2017-12-28 12:32:33 +00:00
ld de, vTiles2
2015-11-03 17:36:33 +00:00
ld bc, $60 tiles
2015-02-11 21:27:15 +00:00
ld a, BANK(PackMenuGFX)
call FarCopyBytes
2015-11-23 21:04:53 +00:00
; Background (blue if male, pink if female)
2015-02-11 21:27:15 +00:00
hlcoord 0, 1
2015-11-03 17:36:33 +00:00
ld bc, 11 * SCREEN_WIDTH
2015-02-11 21:27:15 +00:00
ld a, $24
call ByteFill
2015-11-23 21:04:53 +00:00
; This is where the items themselves will be listed.
2015-02-11 21:27:15 +00:00
hlcoord 5, 1
lb bc, 11, 15
call ClearBox
2015-11-23 21:04:53 +00:00
; ◀▶ POCKET ▼▲ ITEMS
hlcoord 0, 0
2015-02-11 21:27:15 +00:00
ld a, $28
2015-11-03 17:36:33 +00:00
ld c, SCREEN_WIDTH
.loop
2015-02-11 21:27:15 +00:00
ld [hli], a
inc a
dec c
2015-11-03 17:36:33 +00:00
jr nz, .loop
2015-10-24 14:34:19 +00:00
call DrawPocketName
2015-11-23 21:04:53 +00:00
call PlacePackGFX
; Place the textbox for displaying the item description
hlcoord 0, SCREEN_HEIGHT - 4 - 2
lb bc, 4, SCREEN_WIDTH - 2
2015-02-11 21:27:15 +00:00
call TextBox
call EnableLCD
2015-10-24 14:34:19 +00:00
call DrawPackGFX
2015-02-11 21:27:15 +00:00
ret
; 109a5
2015-11-23 21:04:53 +00:00
PlacePackGFX: ; 109a5
2015-02-11 21:27:15 +00:00
hlcoord 0, 3
ld a, $50
2015-11-23 21:04:53 +00:00
ld de, SCREEN_WIDTH - 5
2015-02-11 21:27:15 +00:00
ld b, 3
2015-11-23 21:04:53 +00:00
.row
2015-02-11 21:27:15 +00:00
ld c, 5
2015-11-23 21:04:53 +00:00
.column
2015-02-11 21:27:15 +00:00
ld [hli], a
inc a
dec c
2015-11-23 21:04:53 +00:00
jr nz, .column
2015-02-11 21:27:15 +00:00
add hl, de
dec b
2015-11-23 21:04:53 +00:00
jr nz, .row
2015-02-11 21:27:15 +00:00
ret
; 109bb
2015-10-24 14:34:19 +00:00
DrawPocketName: ; 109bb
2015-12-13 19:15:16 +00:00
ld a, [wCurrPocket]
2015-02-11 21:27:15 +00:00
; * 15
ld d, a
swap a
sub d
ld d, 0
ld e, a
2015-10-24 14:34:19 +00:00
ld hl, .tilemap
2015-02-11 21:27:15 +00:00
add hl, de
ld d, h
ld e, l
hlcoord 0, 7
ld c, 3
2015-10-24 14:34:19 +00:00
.row
2015-02-11 21:27:15 +00:00
ld b, 5
2015-10-24 14:34:19 +00:00
.col
2015-02-11 21:27:15 +00:00
ld a, [de]
inc de
ld [hli], a
dec b
2015-10-24 14:34:19 +00:00
jr nz, .col
2015-02-11 21:27:15 +00:00
ld a, c
2015-10-24 14:34:19 +00:00
ld c, SCREEN_WIDTH - 5
2015-02-11 21:27:15 +00:00
add hl, bc
ld c, a
dec c
2015-10-24 14:34:19 +00:00
jr nz, .row
2015-02-11 21:27:15 +00:00
ret
; 109e1
.tilemap ; 109e1
2018-01-11 17:00:01 +00:00
; ITEM_POCKET
2015-11-23 21:04:53 +00:00
db $00, $04, $04, $04, $01 ; top border
db $06, $07, $08, $09, $0a ; Items
db $02, $05, $05, $05, $03 ; bottom border
2018-01-11 17:00:01 +00:00
; BALL_POCKET
2015-11-23 21:04:53 +00:00
db $00, $04, $04, $04, $01 ; top border
db $15, $16, $17, $18, $19 ; Balls
db $02, $05, $05, $05, $03 ; bottom border
2018-01-11 17:00:01 +00:00
; KEY_ITEM_POCKET
2015-11-23 21:04:53 +00:00
db $00, $04, $04, $04, $01 ; top border
db $0b, $0c, $0d, $0e, $0f ; Key Items
db $02, $05, $05, $05, $03 ; bottom border
2018-01-11 17:00:01 +00:00
; TM_HM_POCKET
2015-11-23 21:04:53 +00:00
db $00, $04, $04, $04, $01 ; top border
db $10, $11, $12, $13, $14 ; TM/HM
db $02, $05, $05, $05, $03 ; bottom border
2015-02-11 21:27:15 +00:00
; 10a1d
2015-11-23 21:04:53 +00:00
Pack_GetItemName: ; 10a1d
2015-02-11 21:27:15 +00:00
ld a, [CurItem]
2015-11-23 21:04:53 +00:00
ld [wNamedObjectIndexBuffer], a
2015-02-11 21:27:15 +00:00
call GetItemName
call CopyName1
ret
; 10a2a
2015-11-23 21:04:53 +00:00
Pack_ClearTilemap: ; 10a2a
; unreferenced
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
2015-10-24 14:34:19 +00:00
ld a, " "
2015-02-11 21:27:15 +00:00
call ByteFill
ret
; 10a36
2015-10-24 14:34:19 +00:00
ClearPocketList: ; 10a36 (4:4a36)
2015-02-11 21:27:15 +00:00
hlcoord 5, 2
2015-10-24 14:34:19 +00:00
lb bc, 10, SCREEN_WIDTH - 5
2015-02-11 21:27:15 +00:00
call ClearBox
ret
2015-12-13 19:15:16 +00:00
Pack_InitColors: ; 10a40
2015-02-11 21:27:15 +00:00
call WaitBGMap
ld b, SCGB_PACKPALS
2015-02-11 21:27:15 +00:00
call GetSGBLayout
2015-09-09 23:27:07 +00:00
call SetPalettes
2015-02-11 21:27:15 +00:00
call DelayFrame
ret
; 10a4f
2015-12-13 19:15:16 +00:00
ItemsPocketMenuDataHeader: ; 0x10a4f
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10a57
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10a57
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, NumItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10a67
2015-12-13 19:15:16 +00:00
PC_Mart_ItemsPocketMenuDataHeader: ; 0x10a67
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10a6f
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10a6f
2015-02-11 21:27:15 +00:00
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, NumItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10a7f
2015-12-13 19:15:16 +00:00
KeyItemsPocketMenuDataHeader: ; 0x10a7f
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10a87
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10a87
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, NumKeyItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10a97
2015-12-13 19:15:16 +00:00
PC_Mart_KeyItemsPocketMenuDataHeader: ; 0x10a97
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10a9f
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10a9f
2015-02-11 21:27:15 +00:00
db $2e ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, NumKeyItems
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10aaf
2015-12-13 19:15:16 +00:00
BallsPocketMenuDataHeader: ; 0x10aaf
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10ab7
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10ab7
2015-02-11 21:27:15 +00:00
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, NumBalls
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10ac7
2015-12-13 19:15:16 +00:00
PC_Mart_BallsPocketMenuDataHeader: ; 0x10ac7
2015-02-11 21:27:15 +00:00
db $40 ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-12-13 19:15:16 +00:00
dw .MenuData2
2015-02-11 21:27:15 +00:00
db 1 ; default option
; 0x10acf
2015-12-13 19:15:16 +00:00
.MenuData2: ; 0x10acf
2015-02-11 21:27:15 +00:00
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, NumBalls
2015-11-04 00:43:47 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-02-11 21:27:15 +00:00
; 10adf
2015-11-23 21:04:53 +00:00
Text_PackNoItems: ; 0x10adf
2015-02-11 21:27:15 +00:00
; No items.
text_jump UnknownText_0x1c0b9a
db "@"
; 0x10ae4
2015-11-23 21:04:53 +00:00
Text_ThrowAwayHowMany: ; 0x10ae4
2015-02-11 21:27:15 +00:00
; Throw away how many?
text_jump UnknownText_0x1c0ba5
db "@"
; 0x10ae9
2015-11-23 21:04:53 +00:00
Text_ConfirmThrowAway: ; 0x10ae9
2015-02-11 21:27:15 +00:00
; Throw away @ @ (S)?
text_jump UnknownText_0x1c0bbb
db "@"
; 0x10aee
2015-11-23 21:04:53 +00:00
Text_ThrewAway: ; 0x10aee
2015-02-11 21:27:15 +00:00
; Threw away @ (S).
text_jump UnknownText_0x1c0bd8
db "@"
; 0x10af3
2015-11-23 21:04:53 +00:00
Text_ThisIsntTheTime: ; 0x10af3
2015-02-11 21:27:15 +00:00
; OAK: ! This isn't the time to use that!
text_jump UnknownText_0x1c0bee
db "@"
; 0x10af8
TextJump_YouDontHaveAPkmn: ; 0x10af8
2015-02-11 21:27:15 +00:00
; You don't have a #MON!
text_jump Text_YouDontHaveAPkmn
2015-02-11 21:27:15 +00:00
db "@"
; 0x10afd
2015-11-23 21:04:53 +00:00
Text_RegisteredItem: ; 0x10afd
2015-02-11 21:27:15 +00:00
; Registered the @ .
text_jump UnknownText_0x1c0c2e
db "@"
; 0x10b02
2015-11-23 21:04:53 +00:00
Text_CantRegister: ; 0x10b02
2015-02-11 21:27:15 +00:00
; You can't register that item.
text_jump UnknownText_0x1c0c45
db "@"
; 0x10b07
2015-11-23 21:04:53 +00:00
Text_MoveItemWhere: ; 0x10b07
2015-02-11 21:27:15 +00:00
; Where should this be moved to?
text_jump UnknownText_0x1c0c63
db "@"
; 0x10b0c
2015-11-23 21:04:53 +00:00
Text_PackEmptyString: ; 0x10b0c
;
2015-02-11 21:27:15 +00:00
text_jump UnknownText_0x1c0c83
db "@"
; 0x10b11
TextJump_YouCantUseItInABattle: ; 0x10b11
; Doesn't seem to be used anywhere
; "You can't use it in a battle."
text_jump Text_YouCantUseItInABattle
2015-02-11 21:27:15 +00:00
db "@"
; 0x10b16
PackMenuGFX:
INCBIN "gfx/pack/pack_menu.2bpp"
2015-02-11 21:27:15 +00:00
PackGFX:
INCBIN "gfx/pack/pack.2bpp"