pokecrystal-board/engine/events/pokecenter_pc.asm

679 lines
11 KiB
NASM
Raw Normal View History

2015-11-16 18:46:36 -08:00
PokemonCenterPC: ; 1559a
call PC_CheckPartyForPokemon
ret c
call PC_PlayBootSound
ld hl, PokecenterPCText_BootedUpPC
2015-11-16 18:46:36 -08:00
call PC_DisplayText
ld hl, PokecenterPCText_AccessWhosePC
2015-11-16 18:46:36 -08:00
call PC_DisplayTextWaitMenu
ld hl, .TopMenu
call LoadMenuDataHeader
.loop
xor a
ld [hBGMapMode], a
call .ChooseWhichPCListToUse
2015-12-18 17:07:09 -08:00
ld [wWhichIndexSet], a
2015-11-16 18:46:36 -08:00
call DoNthMenu
jr c, .shutdown
ld a, [MenuSelection]
ld hl, .JumpTable
call MenuJumptable
jr nc, .loop
.shutdown
call PC_PlayShutdownSound
call ExitMenu
call CloseWindow
2015-11-16 18:46:36 -08:00
ret
.TopMenu:
2015-11-16 18:46:36 -08:00
db $48 ; flags
db 00, 00 ; start coords
db 12, 15 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2:
2015-11-16 18:46:36 -08:00
db $a0 ; flags
db 0 ; items
dw .WhichPC
dw PlaceNthMenuStrings
dw .JumpTable
.JumpTable:
2015-11-16 18:46:36 -08:00
dw PlayersPC, .String_PlayersPC
dw BillsPC, .String_BillsPC
dw OaksPC, .String_OaksPC
dw HallOfFamePC, .String_HallOfFame
dw TurnOffPC, .String_TurnOff
2016-03-01 19:31:21 -08:00
.String_PlayersPC: db "<PLAYER>'s PC@"
.String_BillsPC: db "BILL's PC@"
.String_OaksPC: db "PROF.OAK's PC@"
.String_HallOfFame: db "HALL OF FAME@"
.String_TurnOff: db "TURN OFF@"
2015-11-16 18:46:36 -08:00
.WhichPC:
2015-11-16 18:46:36 -08:00
; before pokedex
db 3 ; items
db 1, 0, 4 ; bill's, player's, turn off
db -1
; before Hall Of Fame
db 4 ; items
db 1, 0, 2, 4 ; bill's, player's, oak's, turn off
db -1
; postgame
db 5 ; items
db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off
db -1
.ChooseWhichPCListToUse:
2015-11-16 18:46:36 -08:00
call CheckReceivedDex
jr nz, .got_dex
ld a, $0
ret
.got_dex
ld a, [wHallOfFameCount]
and a
ld a, $1
ret z
ld a, $2
ret
; 15650
PC_CheckPartyForPokemon: ; 15650
ld a, [PartyCount]
and a
ret nz
ld de, SFX_CHOOSE_PC_OPTION
call PlaySFX
2016-03-01 19:31:21 -08:00
ld hl, .MustHavePokemonToUse
2015-11-16 18:46:36 -08:00
call PC_DisplayText
scf
ret
.MustHavePokemonToUse:
2015-11-16 18:46:36 -08:00
; Bzzzzt! You must have a #MON to use this!
text_jump UnknownText_0x1c1328
db "@"
; 0x15668
BillsPC: ; 15668
call PC_PlayChoosePCSound
ld hl, PokecenterPCText_AccessedBillsPC
2015-11-16 18:46:36 -08:00
call PC_DisplayText
2017-12-24 09:47:30 -08:00
farcall _BillsPC
2015-11-16 18:46:36 -08:00
and a
ret
; 15679 (5:5679)
PlayersPC: ; 15679
call PC_PlayChoosePCSound
ld hl, PokecenterPCText_AccessedOwnPC
2015-11-16 18:46:36 -08:00
call PC_DisplayText
ld b, $0
call _PlayersPC
and a
ret
; 15689
OaksPC: ; 15689
call PC_PlayChoosePCSound
ld hl, PokecenterPCText_AccessedOaksPC
2015-11-16 18:46:36 -08:00
call PC_DisplayText
2017-12-24 09:47:30 -08:00
farcall ProfOaksPC
2015-11-16 18:46:36 -08:00
and a
ret
; 1569a
HallOfFamePC: ; 1569a
call PC_PlayChoosePCSound
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall _HallOfFamePC
call CloseSubmenu
2015-11-16 18:46:36 -08:00
and a
ret
; 156ab
TurnOffPC: ; 156ab
ld hl, PokecenterPCText_LinkClosed
2015-11-16 18:46:36 -08:00
call PrintText
scf
ret
; 156b3
PC_PlayBootSound: ; 156b3
ld de, SFX_BOOT_PC
jr PC_WaitPlaySFX
PC_PlayShutdownSound: ; 156b8
ld de, SFX_SHUT_DOWN_PC
call PC_WaitPlaySFX
call WaitSFX
ret
PC_PlayChoosePCSound: ; 156c2
ld de, SFX_CHOOSE_PC_OPTION
jr PC_WaitPlaySFX
2016-03-01 19:31:21 -08:00
PC_PlaySwapItemsSound: ; 156c7
2015-11-16 18:46:36 -08:00
ld de, SFX_SWITCH_POKEMON
call PC_WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
PC_WaitPlaySFX: ; 156d0
push de
call WaitSFX
pop de
call PlaySFX
ret
; 156d9
2015-11-16 19:29:54 -08:00
_KrissHousePC: ; 156d9
2015-11-16 18:46:36 -08:00
call PC_PlayBootSound
ld hl, UnknownText_0x156ff
call PC_DisplayText
ld b, $1
call _PlayersPC
and a
jr nz, .asm_156f9
call OverworldTextModeSwitch
2015-11-25 07:16:29 -08:00
call ApplyTilemap
2015-11-16 18:46:36 -08:00
call UpdateSprites
call PC_PlayShutdownSound
ld c, $0
ret
.asm_156f9
call ClearBGPalettes
ld c, $1
ret
; 156ff
UnknownText_0x156ff: ; 0x156ff
; turned on the PC.
text_jump UnknownText_0x1c1353
db "@"
; 0x15704
_PlayersPC: ; 15704
ld a, b
2015-12-18 17:07:09 -08:00
ld [wWhichIndexSet], a
2015-11-16 18:46:36 -08:00
ld hl, UnknownText_0x157cc
call PC_DisplayTextWaitMenu
call Function15715
call ExitMenu
ret
; 15715
Function15715: ; 15715
xor a
2016-03-01 19:31:21 -08:00
ld [wPCItemsCursor], a
ld [wPCItemsScrollPosition], a
2015-11-16 18:46:36 -08:00
ld hl, KrissPCMenuData
call LoadMenuDataHeader
.asm_15722
call UpdateTimePals
call DoNthMenu
jr c, .asm_15731
call MenuJumptable
jr nc, .asm_15722
jr .asm_15732
.asm_15731
xor a
.asm_15732
call ExitMenu
ret
; 15736
KrissPCMenuData: ; 0x15736
db %01000000
db 0, 0 ; top left corner coords (y, x)
db 12, 15 ; bottom right corner coords (y, x)
dw .KrissPCMenuData2
db 1 ; default selected option
.KrissPCMenuData2:
2015-11-16 18:46:36 -08:00
db %10100000 ; bit7
db 0 ; # items?
dw .KrissPCMenuList1
dw PlaceNthMenuStrings
dw .KrissPCMenuPointers
.KrissPCMenuPointers: ; 0x15746
2015-11-16 18:46:36 -08:00
dw KrisWithdrawItemMenu, .WithdrawItem
dw KrisDepositItemMenu, .DepositItem
dw KrisTossItemMenu, .TossItem
dw KrisMailBoxMenu, .MailBox
dw KrisDecorationMenu, .Decoration
dw KrisLogOffMenu, .LogOff
dw KrisLogOffMenu, .TurnOff
.WithdrawItem: db "WITHDRAW ITEM@"
.DepositItem: db "DEPOSIT ITEM@"
.TossItem: db "TOSS ITEM@"
.MailBox: db "MAIL BOX@"
.Decoration: db "DECORATION@"
.TurnOff: db "TURN OFF@"
.LogOff: db "LOG OFF@"
2015-11-16 18:46:36 -08:00
WITHDRAW_ITEM EQU 0
DEPOSIT_ITEM EQU 1
TOSS_ITEM EQU 2
MAIL_BOX EQU 3
DECORATION EQU 4
TURN_OFF EQU 5
LOG_OFF EQU 6
.KrissPCMenuList1:
2015-11-16 18:46:36 -08:00
db 5
db WITHDRAW_ITEM
db DEPOSIT_ITEM
db TOSS_ITEM
db MAIL_BOX
db TURN_OFF
db -1
.KrissPCMenuList2:
2015-11-16 18:46:36 -08:00
db 6
db WITHDRAW_ITEM
db DEPOSIT_ITEM
db TOSS_ITEM
db MAIL_BOX
db DECORATION
db LOG_OFF
db -1
PC_DisplayTextWaitMenu: ; 157bb
ld a, [Options]
push af
set NO_TEXT_SCROLL, a
ld [Options], a
call MenuTextBox
pop af
ld [Options], a
ret
; 157cc
UnknownText_0x157cc: ; 0x157cc
; What do you want to do?
text_jump UnknownText_0x1c1368
db "@"
; 0x157d1
KrisWithdrawItemMenu: ; 0x157d1
call LoadStandardMenuDataHeader
2017-12-24 09:47:30 -08:00
farcall ClearPCItemScreen
2016-03-01 19:31:21 -08:00
.loop
call PCItemsJoypad
jr c, .quit
call .Submenu
jr .loop
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.quit
call CloseSubmenu
2015-11-16 18:46:36 -08:00
xor a
ret
.Submenu:
2015-11-16 18:46:36 -08:00
; check if the item has a quantity
2017-12-24 09:47:30 -08:00
farcall _CheckTossableItem
2015-11-16 18:46:36 -08:00
ld a, [wItemAttributeParamBuffer]
and a
jr z, .askquantity
; items without quantity are always ×1
ld a, 1
ld [wItemQuantityChangeBuffer], a
jr .withdraw
.askquantity
ld hl, .HowManyText
call MenuTextBox
2017-12-24 09:47:30 -08:00
farcall SelectQuantityToToss
2015-11-16 18:46:36 -08:00
call ExitMenu
call ExitMenu
jr c, .done
.withdraw
ld a, [wItemQuantityChangeBuffer]
ld [Buffer1], a ; quantity
2016-03-01 19:31:21 -08:00
ld a, [CurItemQuantity]
2015-11-16 18:46:36 -08:00
ld [Buffer2], a
ld hl, NumItems
call ReceiveItem
jr nc, .PackFull
ld a, [Buffer1]
ld [wItemQuantityChangeBuffer], a
ld a, [Buffer2]
2016-03-01 19:31:21 -08:00
ld [CurItemQuantity], a
2015-11-16 18:46:36 -08:00
ld hl, PCItems
call TossItem
predef PartyMonItemName
ld hl, .WithdrewText
call MenuTextBox
xor a
ld [hBGMapMode], a
call ExitMenu
ret
.PackFull:
2015-11-16 18:46:36 -08:00
ld hl, .NoRoomText
call MenuTextBoxBackup
ret
.done
ret
.HowManyText: ; 0x15850
2015-11-16 18:46:36 -08:00
text_jump _KrissPCHowManyWithdrawText
db "@"
.WithdrewText: ; 0x15855
2015-11-16 18:46:36 -08:00
text_jump _KrissPCWithdrewItemsText
db "@"
.NoRoomText: ; 0x1585a
2015-11-16 18:46:36 -08:00
text_jump _KrissPCNoRoomWithdrawText
db "@"
KrisTossItemMenu: ; 0x1585f
call LoadStandardMenuDataHeader
2017-12-24 09:47:30 -08:00
farcall ClearPCItemScreen
2016-03-01 19:31:21 -08:00
.loop
call PCItemsJoypad
jr c, .quit
2015-11-16 18:46:36 -08:00
ld de, PCItems
2017-12-24 09:47:30 -08:00
farcall TossItemFromPC
2016-03-01 19:31:21 -08:00
jr .loop
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.quit
call CloseSubmenu
2015-11-16 18:46:36 -08:00
xor a
ret
; 0x1587d
KrisDecorationMenu: ; 0x1587d
2017-12-24 09:47:30 -08:00
farcall _KrisDecorationMenu
2015-11-16 18:46:36 -08:00
ld a, c
and a
ret z
scf
ret
; 0x15888
KrisLogOffMenu: ; 0x15888
xor a
scf
ret
; 0x1588b
KrisDepositItemMenu: ; 0x1588b
2016-03-01 19:31:21 -08:00
call .CheckItemsInBag
jr c, .nope
2015-11-16 18:46:36 -08:00
call DisableSpriteUpdates
call LoadStandardMenuDataHeader
2017-12-24 09:47:30 -08:00
farcall DepositSellInitPackBuffers
2016-03-01 19:31:21 -08:00
.loop
2017-12-24 09:47:30 -08:00
farcall DepositSellPack
2015-11-16 18:46:36 -08:00
ld a, [wcf66]
and a
2016-03-01 19:31:21 -08:00
jr z, .close
call .TryDepositItem
2017-12-24 09:47:30 -08:00
farcall CheckRegisteredItem
2016-03-01 19:31:21 -08:00
jr .loop
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.close
call CloseSubmenu
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.nope
2015-11-16 18:46:36 -08:00
xor a
ret
.CheckItemsInBag:
2017-12-24 09:47:30 -08:00
farcall HasNoItems
2015-11-16 18:46:36 -08:00
ret nc
2016-03-01 19:31:21 -08:00
ld hl, .NoItemsInBag
2015-11-16 18:46:36 -08:00
call MenuTextBoxBackup
scf
ret
.NoItemsInBag:
2015-11-16 18:46:36 -08:00
; No items here!
text_jump UnknownText_0x1c13df
db "@"
.TryDepositItem:
2015-11-25 07:16:29 -08:00
ld a, [wSpriteUpdatesEnabled]
2015-11-16 18:46:36 -08:00
push af
ld a, $0
2015-11-25 07:16:29 -08:00
ld [wSpriteUpdatesEnabled], a
2017-12-24 09:47:30 -08:00
farcall CheckItemMenu
2015-11-16 18:46:36 -08:00
ld a, [wItemAttributeParamBuffer]
2015-12-26 18:59:03 -08:00
ld hl, .dw
2015-11-16 18:46:36 -08:00
rst JumpTable
pop af
2015-11-25 07:16:29 -08:00
ld [wSpriteUpdatesEnabled], a
2015-11-16 18:46:36 -08:00
ret
2016-03-01 19:31:21 -08:00
.dw
2015-11-16 18:46:36 -08:00
dw .tossable
dw .no_toss
dw .no_toss
dw .no_toss
dw .tossable
dw .tossable
dw .tossable
2016-03-01 19:31:21 -08:00
.no_toss
2015-11-16 18:46:36 -08:00
ret
2016-03-01 19:31:21 -08:00
.tossable
2015-11-16 18:46:36 -08:00
ld a, [Buffer1]
push af
ld a, [Buffer2]
push af
2016-03-01 19:31:21 -08:00
call .DepositItem_
2015-11-16 18:46:36 -08:00
pop af
ld [Buffer2], a
pop af
ld [Buffer1], a
ret
.DepositItem_:
2017-12-24 09:47:30 -08:00
farcall _CheckTossableItem
2015-11-16 18:46:36 -08:00
ld a, [wItemAttributeParamBuffer]
and a
2016-03-01 19:31:21 -08:00
jr z, .AskQuantity
2015-11-16 18:46:36 -08:00
ld a, $1
ld [wItemQuantityChangeBuffer], a
2016-03-01 19:31:21 -08:00
jr .DepositItem
2015-11-16 18:46:36 -08:00
.AskQuantity:
2015-11-16 18:46:36 -08:00
ld hl, .HowManyText
call MenuTextBox
2017-12-24 09:47:30 -08:00
farcall SelectQuantityToToss
2015-11-16 18:46:36 -08:00
push af
call ExitMenu
call ExitMenu
pop af
2016-03-01 19:31:21 -08:00
jr c, .DeclinedToDeposit
2015-11-16 18:46:36 -08:00
.DepositItem:
2015-11-16 18:46:36 -08:00
ld a, [wItemQuantityChangeBuffer]
ld [Buffer1], a
2016-03-01 19:31:21 -08:00
ld a, [CurItemQuantity]
2015-11-16 18:46:36 -08:00
ld [Buffer2], a
ld hl, PCItems
call ReceiveItem
2016-03-01 19:31:21 -08:00
jr nc, .NoRoomInPC
2015-11-16 18:46:36 -08:00
ld a, [Buffer1]
ld [wItemQuantityChangeBuffer], a
ld a, [Buffer2]
2016-03-01 19:31:21 -08:00
ld [CurItemQuantity], a
2015-11-16 18:46:36 -08:00
ld hl, NumItems
call TossItem
predef PartyMonItemName
ld hl, .DepositText
call PrintText
ret
.NoRoomInPC:
2015-11-16 18:46:36 -08:00
ld hl, .NoRoomText
call PrintText
ret
.DeclinedToDeposit:
2015-11-16 18:46:36 -08:00
and a
ret
.HowManyText: ; 0x1596e
2015-11-16 18:46:36 -08:00
text_jump _KrissPCHowManyDepositText
db "@"
.DepositText: ; 0x15973
2015-11-16 18:46:36 -08:00
text_jump _KrissPCDepositItemsText
db "@"
.NoRoomText: ; 0x15978
2015-11-16 18:46:36 -08:00
text_jump _KrissPCNoRoomDepositText
db "@"
KrisMailBoxMenu: ; 0x1597d
2017-12-24 09:47:30 -08:00
farcall _KrisMailBoxMenu
2015-11-16 18:46:36 -08:00
xor a
ret
; 0x15985
2016-03-01 19:31:21 -08:00
PCItemsJoypad: ; 0x15985
2015-11-16 18:46:36 -08:00
xor a
2016-03-01 19:31:21 -08:00
ld [wSwitchItem], a
.loop
2015-11-25 07:16:29 -08:00
ld a, [wSpriteUpdatesEnabled]
2015-11-16 18:46:36 -08:00
push af
ld a, $0
2015-11-25 07:16:29 -08:00
ld [wSpriteUpdatesEnabled], a
2016-03-01 19:31:21 -08:00
ld hl, .PCItemsMenuData
2015-11-16 18:46:36 -08:00
call CopyMenuDataHeader
hlcoord 0, 0
2016-03-01 19:31:21 -08:00
ld b, 10
ld c, 18
2015-11-16 18:46:36 -08:00
call TextBox
2016-03-01 19:31:21 -08:00
ld a, [wPCItemsCursor]
2015-11-16 18:46:36 -08:00
ld [wMenuCursorBuffer], a
2016-03-01 19:31:21 -08:00
ld a, [wPCItemsScrollPosition]
2015-11-23 13:04:53 -08:00
ld [wMenuScrollPosition], a
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
2016-03-01 19:31:21 -08:00
ld [wPCItemsScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2016-03-01 19:31:21 -08:00
ld [wPCItemsCursor], a
2015-11-16 18:46:36 -08:00
pop af
2015-11-25 07:16:29 -08:00
ld [wSpriteUpdatesEnabled], a
2016-03-01 19:31:21 -08:00
ld a, [wSwitchItem]
2015-11-16 18:46:36 -08:00
and a
2016-03-01 19:31:21 -08:00
jr nz, .moving_stuff_around
2015-12-15 15:59:49 -08:00
ld a, [wMenuJoypad]
2016-03-01 19:31:21 -08:00
cp B_BUTTON
jr z, .b_1
cp A_BUTTON
jr z, .a_1
cp SELECT
jr z, .select_1
jr .next
.moving_stuff_around
2015-12-15 15:59:49 -08:00
ld a, [wMenuJoypad]
2016-03-01 19:31:21 -08:00
cp B_BUTTON
jr z, .b_2
cp A_BUTTON
jr z, .a_select_2
cp SELECT
jr z, .a_select_2
jr .next
.b_2
2015-11-16 18:46:36 -08:00
xor a
2016-03-01 19:31:21 -08:00
ld [wSwitchItem], a
jr .next
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.a_select_2
call PC_PlaySwapItemsSound
.select_1
2017-12-24 09:47:30 -08:00
farcall SwitchItemsInBag
2016-03-01 19:31:21 -08:00
.next
jp .loop
2015-11-16 18:46:36 -08:00
2016-03-01 19:31:21 -08:00
.a_1
2017-12-24 09:47:30 -08:00
farcall ScrollingMenu_ClearLeftColumn
2015-12-17 19:31:16 -08:00
call PlaceHollowCursor
2015-11-16 18:46:36 -08:00
and a
ret
2016-03-01 19:31:21 -08:00
.b_1
2015-11-16 18:46:36 -08:00
scf
ret
.PCItemsMenuData:
2015-11-16 18:46:36 -08:00
db %01000000
db 1, 4 ; start coords
db 10, 18 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2:
2015-11-16 18:46:36 -08:00
db %10110000
db 4, 8 ; rows/cols?
db 2 ; horizontal spacing?
dbw 0, PCItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 13:04:53 -08:00
dba UpdateItemDescription
2015-11-16 18:46:36 -08:00
PC_DisplayText: ; 15a20
call MenuTextBox
call ExitMenu
ret
; 15a27
PokecenterPCText_BootedUpPC: ; 0x15a27
2015-11-16 18:46:36 -08:00
; turned on the PC.
text_jump UnknownText_0x1c144d
db "@"
; 0x15a2c
PokecenterPCText_AccessWhosePC: ; 0x15a2c
2015-11-16 18:46:36 -08:00
; Access whose PC?
text_jump UnknownText_0x1c1462
db "@"
; 0x15a31
PokecenterPCText_AccessedBillsPC: ; 0x15a31
2015-11-16 18:46:36 -08:00
; BILL's PC accessed. #MON Storage System opened.
text_jump UnknownText_0x1c1474
db "@"
; 0x15a36
PokecenterPCText_AccessedOwnPC: ; 0x15a36
2015-11-16 18:46:36 -08:00
; Accessed own PC. Item Storage System opened.
text_jump UnknownText_0x1c14a4
db "@"
; 0x15a3b
PokecenterPCText_AccessedOaksPC: ; 0x15a3b
2015-11-16 18:46:36 -08:00
; PROF.OAK's PC accessed. #DEX Rating System opened.
text_jump UnknownText_0x1c14d2
db "@"
; 0x15a40
PokecenterPCText_LinkClosed: ; 0x15a40
2015-11-16 18:46:36 -08:00
; … Link closed…
text_jump UnknownText_0x1c1505
db "@"
; 0x15a45