pokecrystal-board/engine/items/pack.asm

1596 lines
29 KiB
NASM
Raw Normal View History

2018-01-11 09:00:01 -08: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 07:09:41 -07:00
Pack:
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-11-23 13:04:53 -08:00
set NO_TEXT_SCROLL, [hl]
2015-12-13 11:15:16 -08:00
call InitPackBuffers
2015-02-11 13:27:15 -08:00
.loop
call JoyTextDelay
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-02-11 13:27:15 -08:00
bit 7, a
jr nz, .done
2015-12-13 11:15:16 -08:00
call .RunJumptable
2015-02-11 13:27:15 -08:00
call DelayFrame
jr .loop
.done
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2015-11-23 13:04:53 -08:00
ld [wLastPocket], a
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-11-23 13:04:53 -08:00
res NO_TEXT_SCROLL, [hl]
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.RunJumptable:
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-12-13 11:15:16 -08:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2018-01-11 09:00:01 -08:00
; entries correspond to PACKSTATE_* constants
2015-12-26 18:59:03 -08: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 11:15:16 -08:00
2018-06-24 07:09:41 -07:00
.InitGFX:
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2018-01-11 12:36:11 -08:00
ld a, [wPackJumptableIndex]
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitItemsPocket:
2018-01-11 09:00:01 -08:00
xor a ; ITEM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.ItemsPocketMenu:
ld hl, ItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wItemsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITTMHMPOCKET ; left
ld c, PACKSTATE_INITBALLSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitKeyItemsPocket:
2018-01-11 09:00:01 -08:00
ld a, KEY_ITEM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.KeyItemsPocketMenu:
ld hl, KeyItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wKeyItemsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITBALLSPOCKET ; left
ld c, PACKSTATE_INITTMHMPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitTMHMPocket:
2018-01-11 09:00:01 -08:00
ld a, TM_HM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.TMHMPocketMenu:
2017-12-24 09:47:30 -08:00
farcall TMHMPocket
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2017-12-24 09:47:30 -08:00
farcall _CheckTossableItem
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jr nz, .use_quit
ld hl, .MenuHeader2
2015-12-13 11:15:16 -08:00
ld de, .Jumptable2
jr .load_jump
.use_quit
ld hl, .MenuHeader1
2015-12-13 11:15:16 -08:00
ld de, .Jumptable1
.load_jump
2015-02-11 13:27:15 -08:00
push de
call LoadMenuHeader
2015-12-15 15:59:49 -08:00
call VerticalMenu
call ExitMenu
2015-02-11 13:27:15 -08:00
pop hl
ret c
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-02-11 13:27:15 -08:00
dec a
2015-12-13 11:15:16 -08:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
.MenuHeader1:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData_1
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData_1:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 2 ; items
db "USE@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
.Jumptable1:
2015-12-26 18:59:03 -08:00
dw .UseItem
dw QuitItemSubmenu
2015-12-13 11:15:16 -08:00
.MenuHeader2:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData_2
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData_2:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 3 ; items
db "USE@"
db "GIVE@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
.Jumptable2:
2015-12-13 11:15:16 -08:00
dw .UseItem
2015-11-23 13:04:53 -08:00
dw GiveItem
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.UseItem:
2017-12-24 09:47:30 -08:00
farcall AskTeachTMHM
2015-02-11 13:27:15 -08:00
ret c
2017-12-24 09:47:30 -08:00
farcall ChooseMonToLearnTMHM
2015-12-13 11:15:16 -08:00
jr c, .declined
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-02-11 13:27:15 -08:00
ld a, [hl]
push af
2015-12-13 11:15:16 -08:00
res NO_TEXT_SCROLL, [hl]
2017-12-24 09:47:30 -08:00
farcall TeachTMHM
2015-02-11 13:27:15 -08:00
pop af
2018-01-23 14:39:09 -08:00
ld [wOptions], a
2015-12-13 11:15:16 -08:00
.declined
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitBallsPocket:
2018-01-11 09:00:01 -08:00
ld a, BALL_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.BallsPocketMenu:
ld hl, BallsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wBallsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wBallsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITITEMSPOCKET ; left
ld c, PACKSTATE_INITKEYITEMSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call .ItemBallsKey_LoadSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.ItemBallsKey_LoadSubmenu:
2017-12-24 09:47:30 -08:00
farcall _CheckTossableItem
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr nz, .tossable
2017-12-24 09:47:30 -08:00
farcall CheckSelectableItem
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr nz, .selectable
2017-12-24 09:47:30 -08:00
farcall CheckItemMenu
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr nz, .usable
jr .unusable
.selectable
2017-12-24 09:47:30 -08:00
farcall CheckItemMenu
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr nz, .selectable_usable
jr .selectable_unusable
.tossable
2017-12-24 09:47:30 -08:00
farcall CheckSelectableItem
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr nz, .tossable_selectable
jr .tossable_unselectable
.usable
ld hl, MenuHeader_UsableKeyItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_UseGiveTossRegisterQuit
2015-10-24 07:34:19 -07:00
jr .build_menu
.selectable_usable
ld hl, MenuHeader_UsableItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_UseGiveTossQuit
2015-10-24 07:34:19 -07:00
jr .build_menu
.tossable_selectable
ld hl, MenuHeader_UnusableItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_UseQuit
2015-10-24 07:34:19 -07:00
jr .build_menu
.tossable_unselectable
ld hl, MenuHeader_UnusableKeyItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_UseRegisterQuit
2015-10-24 07:34:19 -07:00
jr .build_menu
.unusable
ld hl, MenuHeader_HoldableKeyItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_GiveTossRegisterQuit
2015-10-24 07:34:19 -07:00
jr .build_menu
.selectable_unusable
ld hl, MenuHeader_HoldableItem
2015-12-13 11:15:16 -08:00
ld de, Jumptable_GiveTossQuit
2015-10-24 07:34:19 -07:00
.build_menu
2015-02-11 13:27:15 -08:00
push de
call LoadMenuHeader
2015-12-15 15:59:49 -08:00
call VerticalMenu
call ExitMenu
2015-02-11 13:27:15 -08:00
pop hl
ret c
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-02-11 13:27:15 -08:00
dec a
2015-12-13 11:15:16 -08:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
MenuHeader_UsableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 5 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_UseGiveTossRegisterQuit:
2015-12-26 18:59:03 -08:00
dw UseItem
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
MenuHeader_UsableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 4 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_UseGiveTossQuit:
2015-12-26 18:59:03 -08:00
dw UseItem
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
MenuHeader_UnusableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 2 ; items
db "USE@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_UseQuit:
2015-12-26 18:59:03 -08:00
dw UseItem
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
MenuHeader_UnusableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 3 ; items
db "USE@"
db "SEL@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_UseRegisterQuit:
2015-12-26 18:59:03 -08:00
dw UseItem
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
MenuHeader_HoldableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 4 ; items
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_GiveTossRegisterQuit:
2015-12-26 18:59:03 -08:00
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
2015-02-11 13:27:15 -08:00
MenuHeader_HoldableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 3 ; items
db "GIVE@"
db "TOSS@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
Jumptable_GiveTossQuit:
2015-12-26 18:59:03 -08:00
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
2015-12-13 11:15:16 -08:00
2018-06-24 07:09:41 -07:00
UseItem:
2017-12-24 09:47:30 -08:00
farcall CheckItemMenu
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-12-26 18:59:03 -08:00
ld hl, .dw
2015-02-11 13:27:15 -08:00
rst JumpTable
ret
2018-06-24 07:09:41 -07:00
.dw
2018-01-11 09:00:01 -08:00
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
2015-12-26 18:59:03 -08:00
dw .Oak
dw .Oak
dw .Oak
2018-01-11 09:00:01 -08:00
dw .Current ; ITEMMENU_CURRENT
dw .Party ; ITEMMENU_PARTY
dw .Field ; ITEMMENU_CLOSE
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Oak:
ld hl, OakThisIsntTheTimeText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.Current:
2015-02-11 13:27:15 -08:00
call DoItemEffect
ret
2018-06-24 07:09:41 -07:00
.Party:
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr z, .NoPokemon
2015-02-11 13:27:15 -08:00
call DoItemEffect
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2015-12-13 11:15:16 -08:00
.NoPokemon:
ld hl, YouDontHaveAMonText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.Field:
2015-02-11 13:27:15 -08:00
call DoItemEffect
2015-12-13 11:15:16 -08:00
ld a, [wItemEffectSucceeded]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr z, .Oak
2018-01-11 09:00:01 -08:00
ld a, PACKSTATE_QUITRUNSCRIPT
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
TossMenu:
ld hl, AskThrowAwayText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2017-12-24 09:47:30 -08:00
farcall SelectQuantityToToss
2015-02-11 13:27:15 -08:00
push af
call ExitMenu
2015-02-11 13:27:15 -08:00
pop af
2015-11-23 13:04:53 -08:00
jr c, .finish
call Pack_GetItemName
ld hl, AskQuantityThrowAwayText
2019-04-08 05:15:10 -07:00
call MenuTextbox
2015-02-11 13:27:15 -08:00
call YesNoBox
push af
call ExitMenu
2015-02-11 13:27:15 -08:00
pop af
2015-11-23 13:04:53 -08:00
jr c, .finish
2018-01-23 14:39:09 -08:00
ld hl, wNumItems
ld a, [wCurItemQuantity]
2015-02-11 13:27:15 -08:00
call TossItem
2015-11-23 13:04:53 -08:00
call Pack_GetItemName
ld hl, ThrewAwayText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-11-23 13:04:53 -08:00
.finish
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
Unreferenced_ResetPocketCursorPositions:
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2018-01-11 09:00:01 -08:00
and a ; ITEM_POCKET
2015-12-13 11:15:16 -08:00
jr z, .items
2018-01-11 09:00:01 -08:00
dec a ; BALL_POCKET
2015-12-13 11:15:16 -08:00
jr z, .balls
2018-01-11 09:00:01 -08:00
dec a ; KEY_ITEM_POCKET
2015-12-13 11:15:16 -08:00
jr z, .key
2015-02-11 13:27:15 -08:00
ret
2015-12-13 11:15:16 -08:00
.balls
2015-02-11 13:27:15 -08:00
xor a
2015-10-24 16:49:19 -07:00
ld [wBallsPocketCursor], a
2015-11-23 13:04:53 -08:00
ld [wBallsPocketScrollPosition], a
2015-02-11 13:27:15 -08:00
ret
2015-12-13 11:15:16 -08:00
.items
2015-02-11 13:27:15 -08:00
xor a
2015-10-24 16:49:19 -07:00
ld [wItemsPocketCursor], a
2015-11-23 13:04:53 -08:00
ld [wItemsPocketScrollPosition], a
2015-02-11 13:27:15 -08:00
ret
2015-12-13 11:15:16 -08:00
.key
2015-02-11 13:27:15 -08:00
xor a
2015-10-24 16:49:19 -07:00
ld [wKeyItemsPocketCursor], a
2015-11-23 13:04:53 -08:00
ld [wKeyItemsPocketScrollPosition], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
RegisterItem:
2017-12-24 09:47:30 -08:00
farcall CheckSelectableItem
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jr nz, .cant_register
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2015-02-11 13:27:15 -08:00
rrca
rrca
and REGISTERED_POCKET
2015-02-11 13:27:15 -08:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wCurItemQuantity]
2015-02-11 13:27:15 -08:00
inc a
and REGISTERED_NUMBER
2015-02-11 13:27:15 -08:00
or b
2018-01-23 14:39:09 -08:00
ld [wWhichRegisteredItem], a
ld a, [wCurItem]
ld [wRegisteredItem], a
2015-11-23 13:04:53 -08:00
call Pack_GetItemName
2015-02-11 13:27:15 -08:00
ld de, SFX_FULL_HEAL
call WaitPlaySFX
ld hl, RegisteredItemText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
2015-12-13 11:15:16 -08:00
.cant_register
ld hl, CantRegisterText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
GiveItem:
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jp z, .NoPokemon
2018-01-23 14:39:09 -08:00
ld a, [wOptions]
2015-02-11 13:27:15 -08:00
push af
2015-12-13 11:15:16 -08:00
res NO_TEXT_SCROLL, a
2018-01-23 14:39:09 -08:00
ld [wOptions], a
ld a, PARTYMENUACTION_GIVE_ITEM
2018-01-23 14:39:09 -08:00
ld [wPartyMenuActionText], a
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
2017-12-24 09:47:30 -08:00
farcall LoadPartyMenuGFX
farcall InitPartyMenuWithCancel
farcall InitPartyMenuGFX
2015-12-13 11:15:16 -08:00
.loop
2017-12-24 09:47:30 -08:00
farcall WritePartyMenuTilemap
farcall PrintPartyMenuText
2015-02-11 13:27:15 -08:00
call WaitBGMap
2015-09-09 16:27:07 -07:00
call SetPalettes
2015-02-11 13:27:15 -08:00
call DelayFrame
2017-12-24 09:47:30 -08:00
farcall PartyMenuSelect
2015-12-13 11:15:16 -08:00
jr c, .finish
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
2015-02-11 13:27:15 -08:00
cp EGG
2015-12-13 11:15:16 -08:00
jr nz, .give
ld hl, .AnEggCantHoldAnItemText
2015-02-11 13:27:15 -08:00
call PrintText
2015-12-13 11:15:16 -08:00
jr .loop
2015-12-13 11:15:16 -08:00
.give
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-02-11 13:27:15 -08:00
push af
2018-01-11 12:36:11 -08:00
ld a, [wPackJumptableIndex]
2015-02-11 13:27:15 -08:00
push af
call GetCurNick
2018-01-23 14:39:09 -08:00
ld hl, wStringBuffer1
2015-12-18 17:07:09 -08:00
ld de, wMonOrItemNameBuffer
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
2015-02-11 13:27:15 -08:00
call CopyBytes
2015-12-13 11:15:16 -08:00
call TryGiveItemToPartymon
2015-02-11 13:27:15 -08:00
pop af
2018-01-11 12:36:11 -08:00
ld [wPackJumptableIndex], a
2015-02-11 13:27:15 -08:00
pop af
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-12-13 11:15:16 -08:00
.finish
2015-02-11 13:27:15 -08:00
pop af
2018-01-23 14:39:09 -08:00
ld [wOptions], a
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.NoPokemon:
ld hl, YouDontHaveAMonText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
.AnEggCantHoldAnItemText:
text_far _AnEggCantHoldAnItemText
text_end
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
QuitItemSubmenu:
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
BattlePack:
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-12-13 11:15:16 -08:00
set NO_TEXT_SCROLL, [hl]
call InitPackBuffers
2015-11-23 13:04:53 -08:00
.loop
call JoyTextDelay
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-02-11 13:27:15 -08:00
bit 7, a
2015-11-23 13:04:53 -08:00
jr nz, .end
2015-12-13 11:15:16 -08:00
call .RunJumptable
2015-02-11 13:27:15 -08:00
call DelayFrame
2015-11-23 13:04:53 -08:00
jr .loop
2015-02-11 13:27:15 -08:00
2015-11-23 13:04:53 -08:00
.end
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2015-11-23 13:04:53 -08:00
ld [wLastPocket], a
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-12-13 11:15:16 -08:00
res NO_TEXT_SCROLL, [hl]
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.RunJumptable:
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-12-13 11:15:16 -08:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2018-01-11 09:00:01 -08:00
; entries correspond to PACKSTATE_* constants
2015-12-26 18:59:03 -08: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 11:15:16 -08:00
2018-06-24 07:09:41 -07:00
.InitGFX:
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2018-01-11 12:36:11 -08:00
ld a, [wPackJumptableIndex]
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitItemsPocket:
2018-01-11 09:00:01 -08:00
xor a ; ITEM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.ItemsPocketMenu:
ld hl, ItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wItemsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITTMHMPOCKET ; left
ld c, PACKSTATE_INITBALLSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call ItemSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitKeyItemsPocket:
2018-01-11 09:00:01 -08:00
ld a, KEY_ITEM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.KeyItemsPocketMenu:
ld hl, KeyItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wKeyItemsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITBALLSPOCKET ; left
ld c, PACKSTATE_INITTMHMPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call ItemSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitTMHMPocket:
2018-01-11 09:00:01 -08:00
ld a, TM_HM_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
ld hl, PackEmptyText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.TMHMPocketMenu:
2017-12-24 09:47:30 -08:00
farcall TMHMPocket
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
xor a
2015-12-13 11:15:16 -08:00
call TMHMSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.InitBallsPocket:
2018-01-11 09:00:01 -08:00
ld a, BALL_POCKET
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_JumptableNext
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.BallsPocketMenu:
ld hl, BallsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wBallsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wBallsPocketCursor], a
2018-01-11 09:00:01 -08:00
ld b, PACKSTATE_INITITEMSPOCKET ; left
ld c, PACKSTATE_INITKEYITEMSPOCKET ; right
2015-12-13 11:15:16 -08:00
call Pack_InterpretJoypad
2015-02-11 13:27:15 -08:00
ret c
2015-12-13 11:15:16 -08:00
call ItemSubmenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
ItemSubmenu:
2017-12-24 09:47:30 -08:00
farcall CheckItemContext
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
2018-06-24 07:09:41 -07:00
TMHMSubmenu:
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr z, .NoUse
ld hl, .UsableMenuHeader
2015-10-24 07:34:19 -07:00
ld de, .UsableJumptable
jr .proceed
2015-12-13 11:15:16 -08:00
.NoUse:
ld hl, .UnusableMenuHeader
2015-10-24 07:34:19 -07:00
ld de, .UnusableJumptable
.proceed
2015-02-11 13:27:15 -08:00
push de
call LoadMenuHeader
2015-12-15 15:59:49 -08:00
call VerticalMenu
call ExitMenu
2015-02-11 13:27:15 -08:00
pop hl
ret c
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-02-11 13:27:15 -08:00
dec a
2015-12-13 11:15:16 -08:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
.UsableMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .UsableMenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.UsableMenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 2 ; items
db "USE@"
db "QUIT@"
2018-06-24 07:09:41 -07:00
.UsableJumptable:
2015-12-26 18:59:03 -08:00
dw .Use
dw .Quit
2015-02-11 13:27:15 -08:00
.UnusableMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .UnusableMenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.UnusableMenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
2015-02-11 13:27:15 -08:00
db 1 ; items
db "QUIT@"
2018-06-24 07:09:41 -07:00
.UnusableJumptable:
2015-12-26 18:59:03 -08:00
dw .Quit
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Use:
2017-12-24 09:47:30 -08:00
farcall CheckItemContext
2015-10-24 07:34:19 -07:00
ld a, [wItemAttributeParamBuffer]
ld hl, .ItemFunctionJumptable
2015-02-11 13:27:15 -08:00
rst JumpTable
ret
2018-06-24 07:09:41 -07:00
.ItemFunctionJumptable:
2018-01-11 09:00:01 -08:00
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
2015-12-26 18:59:03 -08:00
dw .Oak
dw .Oak
dw .Oak
2018-01-11 09:00:01 -08:00
dw .Unused ; ITEMMENU_CURRENT
dw .BattleField ; ITEMMENU_PARTY
dw .BattleOnly ; ITEMMENU_CLOSE
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Oak:
ld hl, OakThisIsntTheTimeText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.Unused:
2015-02-11 13:27:15 -08:00
call DoItemEffect
2015-12-13 11:15:16 -08:00
ld a, [wItemEffectSucceeded]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jr nz, .ReturnToBattle
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.BattleField:
2015-02-11 13:27:15 -08:00
call DoItemEffect
2015-12-13 11:15:16 -08:00
ld a, [wItemEffectSucceeded]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jr nz, .quit_run_script
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2015-12-13 11:15:16 -08:00
call Pack_InitGFX
2015-10-24 07:34:19 -07:00
call WaitBGMap_DrawPackGFX
2015-12-13 11:15:16 -08:00
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2015-10-24 07:34:19 -07:00
2018-06-24 07:09:41 -07:00
.ReturnToBattle:
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
2015-12-13 11:15:16 -08:00
jr .quit_run_script
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.BattleOnly:
2015-02-11 13:27:15 -08:00
call DoItemEffect
2015-12-13 11:15:16 -08:00
ld a, [wItemEffectSucceeded]
2015-02-11 13:27:15 -08:00
and a
2015-10-24 07:34:19 -07:00
jr z, .Oak
2015-02-11 13:27:15 -08:00
cp $2
2015-12-13 11:15:16 -08:00
jr z, .didnt_use_item
2018-06-24 07:09:41 -07:00
.quit_run_script
2018-01-11 09:00:01 -08:00
ld a, PACKSTATE_QUITRUNSCRIPT
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-02-11 13:27:15 -08:00
ret
2015-10-24 07:34:19 -07:00
2018-06-24 07:09:41 -07:00
.didnt_use_item
2015-02-11 13:27:15 -08:00
xor a
2015-12-13 11:15:16 -08:00
ld [wItemEffectSucceeded], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.Quit:
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
InitPackBuffers:
2015-02-11 13:27:15 -08:00
xor a
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2018-01-11 12:36:11 -08:00
; pocket id -> jumptable index
2015-11-23 13:04:53 -08:00
ld a, [wLastPocket]
2018-01-16 14:27:50 -08:00
maskbits NUM_POCKETS
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-02-11 13:27:15 -08:00
inc a
add a
dec a
2018-01-11 12:36:11 -08:00
ld [wPackJumptableIndex], a
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
xor a
2015-12-13 11:15:16 -08:00
ld [wSwitchItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
DepositSellInitPackBuffers:
2015-02-11 13:27:15 -08:00
xor a
ldh [hBGMapMode], a
2018-01-11 12:36:11 -08:00
ld [wJumptableIndex], a ; PACKSTATE_INITGFX
ld [wPackJumptableIndex], a ; PACKSTATE_INITGFX
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a ; ITEM_POCKET
2018-01-11 12:36:11 -08:00
ld [wPackUsedItem], a
2015-12-13 11:15:16 -08:00
ld [wSwitchItem], a
call Pack_InitGFX
call Pack_InitColors
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
DepositSellPack:
2015-12-13 11:15:16 -08:00
.loop
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
jr c, .loop
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.RunJumptable:
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-12-13 11:15:16 -08:00
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2018-01-11 09:00:01 -08:00
; entries correspond to *_POCKET constants
2015-12-26 18:59:03 -08:00
dw .ItemsPocket
dw .BallsPocket
dw .KeyItemsPocket
dw .TMHMPocket
2017-12-29 04:52:42 -08:00
2018-06-24 07:09:41 -07:00
.ItemsPocket:
2018-01-11 09:00:01 -08:00
xor a ; ITEM_POCKET
2015-10-24 07:34:19 -07:00
call InitPocket
ld hl, PC_Mart_ItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wItemsPocketCursor], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.KeyItemsPocket:
2018-01-11 09:00:01 -08:00
ld a, KEY_ITEM_POCKET
2015-10-24 07:34:19 -07:00
call InitPocket
ld hl, PC_Mart_KeyItemsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wKeyItemsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wKeyItemsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wKeyItemsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wKeyItemsPocketCursor], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.TMHMPocket:
2018-01-11 09:00:01 -08:00
ld a, TM_HM_POCKET
2015-10-24 07:34:19 -07:00
call InitPocket
call WaitBGMap_DrawPackGFX
2017-12-24 09:47:30 -08:00
farcall TMHMPocket
2018-01-23 14:39:09 -08:00
ld a, [wCurItem]
ld [wCurItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.BallsPocket:
2018-01-11 09:00:01 -08:00
ld a, BALL_POCKET
2015-10-24 07:34:19 -07:00
call InitPocket
ld hl, PC_Mart_BallsPocketMenuHeader
call CopyMenuHeader
2015-10-24 16:49:19 -07:00
ld a, [wBallsPocketCursor]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-11-23 13:04:53 -08:00
ld a, [wBallsPocketScrollPosition]
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld [wBallsPocketScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-24 16:49:19 -07:00
ld [wBallsPocketCursor], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
InitPocket:
2018-09-09 12:09:51 -07:00
ld [wCurPocket], a
2015-10-24 07:34:19 -07:00
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
DepositSellTutorial_InterpretJoypad:
2015-12-13 11:15:16 -08:00
ld hl, wMenuJoypad
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and A_BUTTON
jr nz, .a_button
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and B_BUTTON
jr nz, .b_button
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and D_LEFT
jr nz, .d_left
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and D_RIGHT
jr nz, .d_right
2015-02-11 13:27:15 -08:00
scf
ret
2015-12-13 11:15:16 -08:00
.a_button
ld a, TRUE
2018-01-11 12:36:11 -08:00
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
and a
ret
2015-12-13 11:15:16 -08:00
.b_button
2018-01-11 12:36:11 -08:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
and a
ret
2015-12-13 11:15:16 -08:00
.d_left
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-02-11 13:27:15 -08:00
dec a
2018-01-16 14:27:50 -08:00
maskbits NUM_POCKETS
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-02-11 13:27:15 -08:00
push de
2015-12-13 11:15:16 -08:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 13:27:15 -08:00
call PlaySFX
pop de
scf
ret
2015-12-13 11:15:16 -08:00
.d_right
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-02-11 13:27:15 -08:00
inc a
2018-01-16 14:27:50 -08:00
maskbits NUM_POCKETS
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-02-11 13:27:15 -08:00
push de
2015-12-13 11:15:16 -08:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 13:27:15 -08:00
call PlaySFX
pop de
scf
ret
2018-06-24 07:09:41 -07:00
TutorialPack:
2015-12-13 11:15:16 -08:00
call DepositSellInitPackBuffers
2018-01-23 14:39:09 -08:00
ld a, [wInputType]
2015-02-11 13:27:15 -08:00
or a
2015-11-23 13:04:53 -08:00
jr z, .loop
2017-12-24 09:47:30 -08:00
farcall _DudeAutoInput_RightA
2015-11-23 13:04:53 -08:00
.loop
2015-12-13 11:15:16 -08:00
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
2015-11-23 13:04:53 -08:00
jr c, .loop
2018-01-11 12:36:11 -08:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.RunJumptable:
2015-10-24 16:49:19 -07:00
ld a, [wJumptableIndex]
2015-12-26 18:59:03 -08:00
ld hl, .dw
2015-12-13 11:15:16 -08:00
call Pack_GetJumptablePointer
jp hl
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.dw
2018-01-11 09:00:01 -08:00
; entries correspond to *_POCKET constants
2015-12-26 18:59:03 -08:00
dw .Items
dw .Balls
2018-02-04 19:45:04 -08:00
dw .KeyItems
2015-12-26 18:59:03 -08:00
dw .TMHM
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.Items:
2018-01-11 09:00:01 -08:00
xor a ; ITEM_POCKET
ld hl, .ItemsMenuHeader
2015-12-13 11:15:16 -08:00
jr .DisplayPocket
2015-02-11 13:27:15 -08:00
.ItemsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .ItemsMenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.ItemsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
2015-12-13 11:15:16 -08:00
dbw 0, wDudeNumItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.KeyItems:
2018-01-11 09:00:01 -08:00
ld a, KEY_ITEM_POCKET
ld hl, .KeyItemsMenuHeader
2015-12-13 11:15:16 -08:00
jr .DisplayPocket
2015-02-11 13:27:15 -08:00
.KeyItemsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .KeyItemsMenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.KeyItemsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
2015-12-13 11:15:16 -08:00
dbw 0, wDudeNumKeyItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.TMHM:
2018-01-11 09:00:01 -08:00
ld a, TM_HM_POCKET
2015-10-24 07:34:19 -07:00
call InitPocket
call WaitBGMap_DrawPackGFX
2017-12-24 09:47:30 -08:00
farcall TMHMPocket
2018-01-23 14:39:09 -08:00
ld a, [wCurItem]
ld [wCurItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.Balls:
2018-01-11 09:00:01 -08:00
ld a, BALL_POCKET
ld hl, .BallsMenuHeader
2015-12-13 11:15:16 -08:00
jr .DisplayPocket
2015-02-11 13:27:15 -08:00
.BallsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .BallsMenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.BallsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
2015-12-13 11:15:16 -08:00
dbw 0, wDudeNumBalls
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
.DisplayPocket:
2015-02-11 13:27:15 -08:00
push hl
2015-10-24 07:34:19 -07:00
call InitPocket
2015-02-11 13:27:15 -08:00
pop hl
call CopyMenuHeader
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
Pack_JumptableNext:
2015-10-24 16:49:19 -07:00
ld hl, wJumptableIndex
2015-02-11 13:27:15 -08:00
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Pack_GetJumptablePointer:
2015-02-11 13:27:15 -08:00
ld e, a
ld d, 0
add hl, de
add hl, de
2015-02-11 13:27:15 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
ret
2018-06-24 07:09:41 -07:00
Pack_QuitNoScript:
2015-10-24 16:49:19 -07:00
ld hl, wJumptableIndex
2015-02-11 13:27:15 -08:00
set 7, [hl]
2018-01-11 12:36:11 -08:00
xor a ; FALSE
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
Pack_QuitRunScript:
2015-10-24 16:49:19 -07:00
ld hl, wJumptableIndex
2015-02-11 13:27:15 -08:00
set 7, [hl]
2015-12-13 11:15:16 -08:00
ld a, TRUE
2018-01-11 12:36:11 -08:00
ld [wPackUsedItem], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
Pack_PrintTextNoScroll:
2018-01-23 14:39:09 -08:00
ld a, [wOptions]
2015-02-11 13:27:15 -08:00
push af
2015-12-13 11:15:16 -08:00
set NO_TEXT_SCROLL, a
2018-01-23 14:39:09 -08:00
ld [wOptions], a
2015-02-11 13:27:15 -08:00
call PrintText
pop af
2018-01-23 14:39:09 -08:00
ld [wOptions], a
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
WaitBGMap_DrawPackGFX:
2015-02-11 13:27:15 -08:00
call WaitBGMap
2018-06-24 07:09:41 -07:00
DrawPackGFX:
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2018-01-16 14:27:50 -08:00
maskbits NUM_POCKETS
2015-02-11 13:27:15 -08:00
ld e, a
ld d, 0
2018-01-23 14:39:09 -08:00
ld a, [wBattleType]
2015-02-11 13:27:15 -08:00
cp BATTLETYPE_TUTORIAL
2015-10-24 07:34:19 -07:00
jr z, .male_dude
ld a, [wPlayerGender]
2018-01-22 11:34:55 -08:00
bit PLAYERGENDER_FEMALE_F, a
2015-10-24 07:34:19 -07:00
jr nz, .female
.male_dude
2015-02-11 13:27:15 -08:00
ld hl, PackGFXPointers
add hl, de
add hl, de
2015-02-11 13:27:15 -08:00
ld a, [hli]
ld e, a
ld d, [hl]
2017-12-28 04:32:33 -08:00
ld hl, vTiles2 tile $50
2015-02-11 13:27:15 -08:00
lb bc, BANK(PackGFX), 15
call Request2bpp
ret
2015-10-24 07:34:19 -07:00
.female
2017-12-24 09:47:30 -08:00
farcall DrawKrisPackGFX
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
PackGFXPointers:
2018-01-11 09:00:01 -08: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 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
Pack_InterpretJoypad:
2015-12-13 11:15:16 -08:00
ld hl, wMenuJoypad
ld a, [wSwitchItem]
2015-02-11 13:27:15 -08:00
and a
2015-12-13 11:15:16 -08:00
jr nz, .switching_item
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and A_BUTTON
jr nz, .a_button
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and B_BUTTON
jr nz, .b_button
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and D_LEFT
jr nz, .d_left
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and D_RIGHT
jr nz, .d_right
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and SELECT
jr nz, .select
2015-02-11 13:27:15 -08:00
scf
ret
2015-12-13 11:15:16 -08:00
.a_button
2015-02-11 13:27:15 -08:00
and a
ret
2015-12-13 11:15:16 -08:00
.b_button
2018-01-11 09:00:01 -08:00
ld a, PACKSTATE_QUITNOSCRIPT
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2015-02-11 13:27:15 -08:00
scf
ret
2015-12-13 11:15:16 -08:00
.d_left
2015-02-11 13:27:15 -08:00
ld a, b
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2018-01-11 12:36:11 -08:00
ld [wPackJumptableIndex], a
2015-02-11 13:27:15 -08:00
push de
2015-12-13 11:15:16 -08:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 13:27:15 -08:00
call PlaySFX
pop de
scf
ret
2015-12-13 11:15:16 -08:00
.d_right
2015-02-11 13:27:15 -08:00
ld a, c
2015-10-24 16:49:19 -07:00
ld [wJumptableIndex], a
2018-01-11 12:36:11 -08:00
ld [wPackJumptableIndex], a
2015-02-11 13:27:15 -08:00
push de
2015-12-13 11:15:16 -08:00
ld de, SFX_SWITCH_POCKETS
2015-02-11 13:27:15 -08:00
call PlaySFX
pop de
scf
ret
2015-12-13 11:15:16 -08:00
.select
2017-12-24 09:47:30 -08:00
farcall SwitchItemsInBag
ld hl, AskItemMoveText
2015-12-13 11:15:16 -08:00
call Pack_PrintTextNoScroll
2015-02-11 13:27:15 -08:00
scf
ret
2015-12-13 11:15:16 -08:00
.switching_item
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and A_BUTTON | SELECT
jr nz, .place_insert
2015-02-11 13:27:15 -08:00
ld a, [hl]
2015-12-13 11:15:16 -08:00
and B_BUTTON
jr nz, .end_switch
2015-02-11 13:27:15 -08:00
scf
ret
2015-12-13 11:15:16 -08:00
.place_insert
2017-12-24 09:47:30 -08:00
farcall SwitchItemsInBag
2015-02-11 13:27:15 -08:00
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
2015-12-13 11:15:16 -08:00
.end_switch
2015-02-11 13:27:15 -08:00
xor a
2015-12-13 11:15:16 -08:00
ld [wSwitchItem], a
2015-02-11 13:27:15 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
Pack_InitGFX:
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
call ClearTilemap
2015-02-11 13:27:15 -08:00
call ClearSprites
call DisableLCD
ld hl, PackMenuGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2
2015-11-03 09:36:33 -08:00
ld bc, $60 tiles
2015-02-11 13:27:15 -08:00
ld a, BANK(PackMenuGFX)
call FarCopyBytes
2015-11-23 13:04:53 -08:00
; Background (blue if male, pink if female)
2015-02-11 13:27:15 -08:00
hlcoord 0, 1
2015-11-03 09:36:33 -08:00
ld bc, 11 * SCREEN_WIDTH
2015-02-11 13:27:15 -08:00
ld a, $24
call ByteFill
2015-11-23 13:04:53 -08:00
; This is where the items themselves will be listed.
2015-02-11 13:27:15 -08:00
hlcoord 5, 1
lb bc, 11, 15
call ClearBox
2015-11-23 13:04:53 -08:00
; ◀▶ POCKET ▼▲ ITEMS
hlcoord 0, 0
2015-02-11 13:27:15 -08:00
ld a, $28
2015-11-03 09:36:33 -08:00
ld c, SCREEN_WIDTH
.loop
2015-02-11 13:27:15 -08:00
ld [hli], a
inc a
dec c
2015-11-03 09:36:33 -08:00
jr nz, .loop
2015-10-24 07:34:19 -07:00
call DrawPocketName
2015-11-23 13:04:53 -08: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 05:15:10 -07:00
call Textbox
2015-02-11 13:27:15 -08:00
call EnableLCD
2015-10-24 07:34:19 -07:00
call DrawPackGFX
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
PlacePackGFX:
2015-02-11 13:27:15 -08:00
hlcoord 0, 3
ld a, $50
2015-11-23 13:04:53 -08:00
ld de, SCREEN_WIDTH - 5
2015-02-11 13:27:15 -08:00
ld b, 3
2015-11-23 13:04:53 -08:00
.row
2015-02-11 13:27:15 -08:00
ld c, 5
2015-11-23 13:04:53 -08:00
.column
2015-02-11 13:27:15 -08:00
ld [hli], a
inc a
dec c
2015-11-23 13:04:53 -08:00
jr nz, .column
2015-02-11 13:27:15 -08:00
add hl, de
dec b
2015-11-23 13:04:53 -08:00
jr nz, .row
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
DrawPocketName:
2018-09-09 12:09:51 -07:00
ld a, [wCurPocket]
2015-02-11 13:27:15 -08:00
; * 15
ld d, a
swap a
sub d
ld d, 0
ld e, a
2015-10-24 07:34:19 -07:00
ld hl, .tilemap
2015-02-11 13:27:15 -08:00
add hl, de
ld d, h
ld e, l
hlcoord 0, 7
ld c, 3
2015-10-24 07:34:19 -07:00
.row
2015-02-11 13:27:15 -08:00
ld b, 5
2015-10-24 07:34:19 -07:00
.col
2015-02-11 13:27:15 -08:00
ld a, [de]
inc de
ld [hli], a
dec b
2015-10-24 07:34:19 -07:00
jr nz, .col
2015-02-11 13:27:15 -08:00
ld a, c
2015-10-24 07:34:19 -07:00
ld c, SCREEN_WIDTH - 5
2015-02-11 13:27:15 -08:00
add hl, bc
ld c, a
dec c
2015-10-24 07:34:19 -07:00
jr nz, .row
2015-02-11 13:27:15 -08:00
ret
2018-06-24 07:09:41 -07:00
.tilemap
2018-01-11 09:00:01 -08:00
; ITEM_POCKET
2015-11-23 13:04:53 -08: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 09:00:01 -08:00
; BALL_POCKET
2015-11-23 13:04:53 -08: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 09:00:01 -08:00
; KEY_ITEM_POCKET
2015-11-23 13:04:53 -08: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 09:00:01 -08:00
; TM_HM_POCKET
2015-11-23 13:04:53 -08: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 13:27:15 -08:00
2018-06-24 07:09:41 -07:00
Pack_GetItemName:
2018-01-23 14:39:09 -08:00
ld a, [wCurItem]
2015-11-23 13:04:53 -08:00
ld [wNamedObjectIndexBuffer], a
2015-02-11 13:27:15 -08:00
call GetItemName
call CopyName1
ret
2018-06-24 07:09:41 -07:00
Unreferenced_Pack_ClearTilemap:
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
2015-10-24 07:34:19 -07:00
ld a, " "
2015-02-11 13:27:15 -08:00
call ByteFill
ret
2018-06-24 07:09:41 -07:00
ClearPocketList:
2015-02-11 13:27:15 -08:00
hlcoord 5, 2
2015-10-24 07:34:19 -07:00
lb bc, 10, SCREEN_WIDTH - 5
2015-02-11 13:27:15 -08:00
call ClearBox
ret
2018-06-24 07:09:41 -07:00
Pack_InitColors:
2015-02-11 13:27:15 -08:00
call WaitBGMap
ld b, SCGB_PACKPALS
2015-02-11 13:27:15 -08:00
call GetSGBLayout
2015-09-09 16:27:07 -07:00
call SetPalettes
2015-02-11 13:27:15 -08:00
call DelayFrame
ret
ItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
PC_Mart_ItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
KeyItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumKeyItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
PC_Mart_KeyItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumKeyItems
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
BallsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumBalls
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
PC_Mart_BallsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
2015-02-11 13:27:15 -08:00
db 1 ; default option
.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
2015-02-11 13:27:15 -08:00
db 5, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
2018-01-23 14:39:09 -08:00
dbw 0, wNumBalls
2015-11-03 16:43:47 -08:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-02-11 13:27:15 -08:00
PackNoItemText:
text_far _PackNoItemText
text_end
2015-02-11 13:27:15 -08:00
AskThrowAwayText:
text_far _AskThrowAwayText
text_end
2015-02-11 13:27:15 -08:00
AskQuantityThrowAwayText:
text_far _AskQuantityThrowAwayText
text_end
2015-02-11 13:27:15 -08:00
ThrewAwayText:
text_far _ThrewAwayText
text_end
2015-02-11 13:27:15 -08:00
OakThisIsntTheTimeText:
text_far _OakThisIsntTheTimeText
text_end
2015-02-11 13:27:15 -08:00
YouDontHaveAMonText:
text_far _YouDontHaveAMonText
text_end
2015-02-11 13:27:15 -08:00
RegisteredItemText:
text_far _RegisteredItemText
text_end
2015-02-11 13:27:15 -08:00
CantRegisterText:
text_far _CantRegisterText
text_end
2015-02-11 13:27:15 -08:00
AskItemMoveText:
text_far _AskItemMoveText
text_end
2015-02-11 13:27:15 -08:00
PackEmptyText:
text_far _PackEmptyText
text_end
2015-02-11 13:27:15 -08:00
YouCantUseItInABattleText:
text_far _YouCantUseItInABattleText
text_end
2015-02-11 13:27:15 -08:00
2018-01-18 21:29:05 -08:00
PackMenuGFX:
INCBIN "gfx/pack/pack_menu.2bpp"
2015-02-11 13:27:15 -08:00
PackGFX:
INCBIN "gfx/pack/pack.2bpp"