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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
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
|
2015-10-17 16:58:26 +00:00
|
|
|
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
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wLastPocket], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2015-11-23 21:04:53 +00:00
|
|
|
res NO_TEXT_SCROLL, [hl]
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.RunJumptable:
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitGFX:
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
xor a ; ITEM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ItemsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, ItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitKeyItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, KEY_ITEM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.KeyItemsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, KeyItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitTMHMPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, TM_HM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], a
|
2015-10-24 14:34:19 +00:00
|
|
|
call ClearPocketList
|
|
|
|
call DrawPocketName
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TMHMPocketMenu:
|
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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader2
|
2015-12-13 19:15:16 +00:00
|
|
|
ld de, .Jumptable2
|
|
|
|
jr .load_jump
|
|
|
|
|
|
|
|
.use_quit
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader1
|
2015-12-13 19:15:16 +00:00
|
|
|
ld de, .Jumptable1
|
|
|
|
.load_jump
|
2015-02-11 21:27:15 +00:00
|
|
|
push de
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadMenuHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-07-20 07:51:52 +00:00
|
|
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader1:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData_1
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData_1:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 2 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable1:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .UseItem
|
|
|
|
dw QuitItemSubmenu
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader2:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData_2
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData_2:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 3 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "GIVE@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable2:
|
2015-12-13 19:15:16 +00:00
|
|
|
dw .UseItem
|
2015-11-23 21:04:53 +00:00
|
|
|
dw GiveItem
|
|
|
|
dw QuitItemSubmenu
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UseItem:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2015-02-11 21:27:15 +00:00
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2015-12-13 19:15:16 +00:00
|
|
|
.declined
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitBallsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BALL_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BallsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, BallsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ItemBallsKey_LoadSubmenu:
|
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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_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
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadMenuHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-07-20 07:51:52 +00:00
|
|
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_UsableKeyItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "GIVE@"
|
|
|
|
db "TOSS@"
|
|
|
|
db "SEL@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_UseGiveTossRegisterQuit:
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_UsableItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 4 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "GIVE@"
|
|
|
|
db "TOSS@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_UseGiveTossQuit:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw UseItem
|
|
|
|
dw GiveItem
|
|
|
|
dw TossMenu
|
|
|
|
dw QuitItemSubmenu
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_UnusableItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 2 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_UseQuit:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw UseItem
|
|
|
|
dw QuitItemSubmenu
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_UnusableKeyItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 3 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "SEL@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_UseRegisterQuit:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw UseItem
|
|
|
|
dw RegisterItem
|
|
|
|
dw QuitItemSubmenu
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_HoldableKeyItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 4 ; items
|
|
|
|
db "GIVE@"
|
|
|
|
db "TOSS@"
|
|
|
|
db "SEL@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_GiveTossRegisterQuit:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw GiveItem
|
|
|
|
dw TossMenu
|
|
|
|
dw RegisterItem
|
|
|
|
dw QuitItemSubmenu
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_HoldableItem:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 3 ; items
|
|
|
|
db "GIVE@"
|
|
|
|
db "TOSS@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Jumptable_GiveTossQuit:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw GiveItem
|
|
|
|
dw TossMenu
|
|
|
|
dw QuitItemSubmenu
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
UseItem:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.dw
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Oak:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, OakThisIsntTheTimeText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Current:
|
2015-02-11 21:27:15 +00:00
|
|
|
call DoItemEffect
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Party:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-02-11 21:27:15 +00:00
|
|
|
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
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoPokemon:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, YouDontHaveAMonText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Field:
|
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
|
2015-12-25 03:58:42 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
TossMenu:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AskThrowAwayText
|
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
|
2015-07-20 07:51:52 +00:00
|
|
|
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
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AskQuantityThrowAwayText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextbox
|
2015-02-11 21:27:15 +00:00
|
|
|
call YesNoBox
|
|
|
|
push af
|
2015-07-20 07:51:52 +00:00
|
|
|
call ExitMenu
|
2015-02-11 21:27:15 +00:00
|
|
|
pop af
|
2015-11-23 21:04:53 +00:00
|
|
|
jr c, .finish
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wNumItems
|
|
|
|
ld a, [wCurItemQuantity]
|
2015-02-11 21:27:15 +00:00
|
|
|
call TossItem
|
2015-11-23 21:04:53 +00:00
|
|
|
call Pack_GetItemName
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, ThrewAwayText
|
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
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
ResetPocketCursorPositions: ; unreferenced
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
RegisterItem:
|
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
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
2015-02-11 21:27:15 +00:00
|
|
|
rrca
|
|
|
|
rrca
|
2018-05-20 21:50:53 +00:00
|
|
|
and REGISTERED_POCKET
|
2015-02-11 21:27:15 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurItemQuantity]
|
2015-02-11 21:27:15 +00:00
|
|
|
inc a
|
2018-05-20 21:50:53 +00:00
|
|
|
and REGISTERED_NUMBER
|
2015-02-11 21:27:15 +00:00
|
|
|
or b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wWhichRegisteredItem], a
|
|
|
|
ld a, [wCurItem]
|
|
|
|
ld [wRegisteredItem], 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
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, RegisteredItemText
|
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
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, CantRegisterText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GiveItem:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-02-11 21:27:15 +00:00
|
|
|
and a
|
2015-12-13 19:15:16 +00:00
|
|
|
jp z, .NoPokemon
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wOptions]
|
2015-02-11 21:27:15 +00:00
|
|
|
push af
|
2015-12-13 19:15:16 +00:00
|
|
|
res NO_TEXT_SCROLL, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2017-11-30 19:27:25 +00:00
|
|
|
ld a, PARTYMENUACTION_GIVE_ITEM
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPartyMenuActionText], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-02-11 21:27:15 +00:00
|
|
|
cp EGG
|
2015-12-13 19:15:16 +00:00
|
|
|
jr nz, .give
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .AnEggCantHoldAnItemText
|
2015-02-11 21:27:15 +00:00
|
|
|
call PrintText
|
2015-12-13 19:15:16 +00:00
|
|
|
jr .loop
|
2015-09-12 02:21:00 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2018-01-20 17:25:55 +00:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-02-11 21:27:15 +00:00
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.NoPokemon:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, YouDontHaveAMonText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
2019-10-20 22:24:17 +00:00
|
|
|
.AnEggCantHoldAnItemText:
|
|
|
|
text_far _AnEggCantHoldAnItemText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
QuitItemSubmenu:
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BattlePack:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2015-12-13 19:15:16 +00:00
|
|
|
set NO_TEXT_SCROLL, [hl]
|
|
|
|
call InitPackBuffers
|
2015-11-23 21:04:53 +00:00
|
|
|
.loop
|
2015-10-17 16:58:26 +00:00
|
|
|
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
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wLastPocket], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2015-12-13 19:15:16 +00:00
|
|
|
res NO_TEXT_SCROLL, [hl]
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.RunJumptable:
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitGFX:
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
xor a ; ITEM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ItemsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, ItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitKeyItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, KEY_ITEM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.KeyItemsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, KeyItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitTMHMPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, TM_HM_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], a
|
2015-10-24 14:34:19 +00:00
|
|
|
call ClearPocketList
|
|
|
|
call DrawPocketName
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-10-24 14:34:19 +00:00
|
|
|
call WaitBGMap_DrawPackGFX
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PackEmptyText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
|
|
|
call Pack_JumptableNext
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TMHMPocketMenu:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.InitBallsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BALL_POCKET
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BallsPocketMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, BallsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ItemSubmenu:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckItemContext
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wItemAttributeParamBuffer]
|
2018-06-24 14:09:41 +00:00
|
|
|
TMHMSubmenu:
|
2015-02-11 21:27:15 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .NoUse
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .UsableMenuHeader
|
2015-10-24 14:34:19 +00:00
|
|
|
ld de, .UsableJumptable
|
|
|
|
jr .proceed
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NoUse:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .UnusableMenuHeader
|
2015-10-24 14:34:19 +00:00
|
|
|
ld de, .UnusableJumptable
|
|
|
|
.proceed
|
2015-02-11 21:27:15 +00:00
|
|
|
push de
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadMenuHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-07-20 07:51:52 +00:00
|
|
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.UsableMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .UsableMenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.UsableMenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 2 ; items
|
|
|
|
db "USE@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UsableJumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .Use
|
|
|
|
dw .Quit
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.UnusableMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .UnusableMenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.UnusableMenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; items
|
|
|
|
db "QUIT@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UnusableJumptable:
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .Quit
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Use:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ItemFunctionJumptable:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Oak:
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, OakThisIsntTheTimeText
|
2015-12-13 19:15:16 +00:00
|
|
|
call Pack_PrintTextNoScroll
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Unused:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BattleField:
|
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
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ReturnToBattle:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BattleOnly:
|
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
|
2018-06-24 14:09:41 +00:00
|
|
|
.quit_run_script
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.didnt_use_item
|
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
|
2018-06-24 14:09:41 +00:00
|
|
|
.Quit:
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitPackBuffers:
|
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-16 22:27:50 +00:00
|
|
|
maskbits NUM_POCKETS
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DepositSellInitPackBuffers:
|
2015-02-11 21:27:15 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-11 20:36:11 +00:00
|
|
|
ld [wJumptableIndex], a ; PACKSTATE_INITGFX
|
|
|
|
ld [wPackJumptableIndex], a ; PACKSTATE_INITGFX
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], a ; ITEM_POCKET
|
2018-01-11 20:36:11 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DepositSellPack:
|
2015-12-13 19:15:16 +00:00
|
|
|
.loop
|
|
|
|
call .RunJumptable
|
|
|
|
call DepositSellTutorial_InterpretJoypad
|
|
|
|
jr c, .loop
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.RunJumptable:
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
xor a ; ITEM_POCKET
|
2015-10-24 14:34:19 +00:00
|
|
|
call InitPocket
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, PC_Mart_ItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.KeyItemsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, KEY_ITEM_POCKET
|
2015-10-24 14:34:19 +00:00
|
|
|
call InitPocket
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, PC_Mart_KeyItemsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TMHMPocket:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurItem]
|
|
|
|
ld [wCurItem], a
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BallsPocket:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BALL_POCKET
|
2015-10-24 14:34:19 +00:00
|
|
|
call InitPocket
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, PC_Mart_BallsPocketMenuHeader
|
|
|
|
call CopyMenuHeader
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitPocket:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurPocket], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DepositSellTutorial_InterpretJoypad:
|
2015-12-13 19:15:16 +00:00
|
|
|
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-16 22:27:50 +00:00
|
|
|
maskbits NUM_POCKETS
|
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-16 22:27:50 +00:00
|
|
|
maskbits NUM_POCKETS
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
TutorialPack:
|
2015-12-13 19:15:16 +00:00
|
|
|
call DepositSellInitPackBuffers
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wInputType]
|
2015-02-11 21:27:15 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.RunJumptable:
|
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
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.dw
|
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
|
2018-02-05 03:45:04 +00:00
|
|
|
dw .KeyItems
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .TMHM
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Items:
|
2018-01-11 17:00:01 +00:00
|
|
|
xor a ; ITEM_POCKET
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .ItemsMenuHeader
|
2015-12-13 19:15:16 +00:00
|
|
|
jr .DisplayPocket
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.ItemsMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .ItemsMenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.ItemsMenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2020-10-21 19:39:15 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.KeyItems:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, KEY_ITEM_POCKET
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .KeyItemsMenuHeader
|
2015-12-13 19:15:16 +00:00
|
|
|
jr .DisplayPocket
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.KeyItemsMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .KeyItemsMenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.KeyItemsMenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2020-10-21 19:39:15 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TMHM:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurItem]
|
|
|
|
ld [wCurItem], a
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Balls:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BALL_POCKET
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .BallsMenuHeader
|
2015-12-13 19:15:16 +00:00
|
|
|
jr .DisplayPocket
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.BallsMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .BallsMenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.BallsMenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2020-10-21 19:39:15 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.DisplayPocket:
|
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
|
2018-01-23 21:08:43 +00:00
|
|
|
call CopyMenuHeader
|
2015-12-18 03:31:16 +00:00
|
|
|
call ScrollingMenu
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_JumptableNext:
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2015-02-11 21:27:15 +00:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_GetJumptablePointer:
|
2015-02-11 21:27:15 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-02-11 21:27:15 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_QuitNoScript:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_QuitRunScript:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_PrintTextNoScroll:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wOptions]
|
2015-02-11 21:27:15 +00:00
|
|
|
push af
|
2015-12-13 19:15:16 +00:00
|
|
|
set NO_TEXT_SCROLL, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2015-02-11 21:27:15 +00:00
|
|
|
call PrintText
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
WaitBGMap_DrawPackGFX:
|
2015-02-11 21:27:15 +00:00
|
|
|
call WaitBGMap
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawPackGFX:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_POCKETS
|
2015-02-11 21:27:15 +00:00
|
|
|
ld e, a
|
2018-05-20 21:50:53 +00:00
|
|
|
ld d, 0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBattleType]
|
2015-02-11 21:27:15 +00:00
|
|
|
cp BATTLETYPE_TUTORIAL
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .male_dude
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wPlayerGender]
|
2018-01-22 19:34:55 +00:00
|
|
|
bit PLAYERGENDER_FEMALE_F, 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
|
2016-05-04 15:46:23 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PackGFXPointers:
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_InterpretJoypad:
|
2015-12-13 19:15:16 +00:00
|
|
|
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
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AskItemMoveText
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_InitGFX:
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBGPalettes
|
2020-02-13 17:30:13 +00:00
|
|
|
call ClearTilemap
|
2015-02-11 21:27:15 +00:00
|
|
|
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
|
2015-07-22 19:57:02 +00:00
|
|
|
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
|
2019-04-08 12:15:10 +00:00
|
|
|
call Textbox
|
2015-02-11 21:27:15 +00:00
|
|
|
call EnableLCD
|
2015-10-24 14:34:19 +00:00
|
|
|
call DrawPackGFX
|
2015-02-11 21:27:15 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PlacePackGFX:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawPocketName:
|
2018-09-09 19:09:51 +00:00
|
|
|
ld a, [wCurPocket]
|
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
|
|
|
|
|
2020-08-13 00:59:54 +00:00
|
|
|
.tilemap: ; 5x12
|
|
|
|
; the 5x3 pieces correspond to *_POCKET constants
|
|
|
|
INCBIN "gfx/pack/pack_menu.tilemap"
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_GetItemName:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurItem]
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-02-11 21:27:15 +00:00
|
|
|
call GetItemName
|
|
|
|
call CopyName1
|
|
|
|
ret
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
Pack_ClearTilemap: ; unreferenced
|
2015-07-22 19:57:02 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ClearPocketList:
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Pack_InitColors:
|
2015-02-11 21:27:15 +00:00
|
|
|
call WaitBGMap
|
2015-12-22 23:03:00 +00:00
|
|
|
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
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
ItemsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumItems
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
PC_Mart_ItemsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumItems
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
KeyItemsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumKeyItems
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
PC_Mart_KeyItemsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumKeyItems
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
BallsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumBalls
|
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
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
PC_Mart_BallsPocketMenuHeader:
|
2018-01-15 04:43:51 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-02-11 21:27:15 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-15 04:43:51 +00:00
|
|
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
|
2015-02-11 21:27:15 +00:00
|
|
|
db 5, 8 ; rows, columns
|
2019-06-09 00:31:24 +00:00
|
|
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wNumBalls
|
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
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
PackNoItemText: ; unreferenced
|
2019-10-20 22:24:17 +00:00
|
|
|
text_far _PackNoItemText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
AskThrowAwayText:
|
|
|
|
text_far _AskThrowAwayText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
AskQuantityThrowAwayText:
|
|
|
|
text_far _AskQuantityThrowAwayText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
ThrewAwayText:
|
|
|
|
text_far _ThrewAwayText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
OakThisIsntTheTimeText:
|
|
|
|
text_far _OakThisIsntTheTimeText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
YouDontHaveAMonText:
|
|
|
|
text_far _YouDontHaveAMonText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
RegisteredItemText:
|
|
|
|
text_far _RegisteredItemText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
CantRegisterText:
|
|
|
|
text_far _CantRegisterText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
AskItemMoveText:
|
|
|
|
text_far _AskItemMoveText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
PackEmptyText:
|
|
|
|
text_far _PackEmptyText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
YouCantUseItInABattleText: ; unreferenced
|
2019-10-20 22:24:17 +00:00
|
|
|
text_far _YouCantUseItInABattleText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-02-11 21:27:15 +00:00
|
|
|
|
2018-01-19 05:29:05 +00:00
|
|
|
PackMenuGFX:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/pack/pack_menu.2bpp"
|
2015-02-11 21:27:15 +00:00
|
|
|
PackGFX:
|
2017-12-10 03:57:41 +00:00
|
|
|
INCBIN "gfx/pack/pack.2bpp"
|