pokecrystal/engine/events/pokecenter_pc.asm

680 lines
12 KiB
NASM
Raw Normal View History

2020-06-29 23:35:47 +00:00
; PokemonCenterPC.WhichPC indexes
const_def
const PCPC_BEFORE_POKEDEX ; 0
const PCPC_BEFORE_HOF ; 1
const PCPC_POSTGAME ; 2
; PokemonCenterPC.JumpTable indexes
const_def
const PCPCITEM_PLAYERS_PC ; 0
const PCPCITEM_BILLS_PC ; 1
const PCPCITEM_OAKS_PC ; 2
const PCPCITEM_HALL_OF_FAME ; 3
const PCPCITEM_TURN_OFF ; 4
2018-06-24 14:09:41 +00:00
PokemonCenterPC:
2015-11-17 02:46:36 +00:00
call PC_CheckPartyForPokemon
ret c
call PC_PlayBootSound
ld hl, PokecenterPCTurnOnText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
ld hl, PokecenterPCWhoseText
2015-11-17 02:46:36 +00:00
call PC_DisplayTextWaitMenu
ld hl, .TopMenu
call LoadMenuHeader
2015-11-17 02:46:36 +00:00
.loop
xor a
ldh [hBGMapMode], a
2015-11-17 02:46:36 +00:00
call .ChooseWhichPCListToUse
2015-12-19 01:07:09 +00:00
ld [wWhichIndexSet], a
2015-11-17 02:46:36 +00:00
call DoNthMenu
jr c, .shutdown
2018-01-23 22:39:09 +00:00
ld a, [wMenuSelection]
2015-11-17 02:46:36 +00:00
ld hl, .JumpTable
call MenuJumptable
jr nc, .loop
.shutdown
call PC_PlayShutdownSound
call ExitMenu
call CloseWindow
2015-11-17 02:46:36 +00:00
ret
.TopMenu:
db MENU_BACKUP_TILES | MENU_NO_CLICK_SFX ; flags
menu_coords 0, 0, 15, 12
dw .MenuData
2015-11-17 02:46:36 +00:00
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
2015-11-17 02:46:36 +00:00
db 0 ; items
dw .WhichPC
dw PlaceNthMenuStrings
dw .JumpTable
.JumpTable:
2020-06-29 23:35:47 +00:00
; entries correspond to PCPCITEM_* constants
dw PlayersPC, .String_PlayersPC
dw BillsPC, .String_BillsPC
dw OaksPC, .String_OaksPC
2015-11-17 02:46:36 +00:00
dw HallOfFamePC, .String_HallOfFame
dw TurnOffPC, .String_TurnOff
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00: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-17 02:46:36 +00:00
.WhichPC:
2020-06-29 23:35:47 +00:00
; entries correspond to PCPC_* constants
; PCPC_BEFORE_POKEDEX
db 3
2020-06-29 23:35:47 +00:00
db PCPCITEM_BILLS_PC
db PCPCITEM_PLAYERS_PC
db PCPCITEM_TURN_OFF
db -1 ; end
2015-11-17 02:46:36 +00:00
2020-06-29 23:35:47 +00:00
; PCPC_BEFORE_HOF
db 4
2020-06-29 23:35:47 +00:00
db PCPCITEM_BILLS_PC
db PCPCITEM_PLAYERS_PC
db PCPCITEM_OAKS_PC
db PCPCITEM_TURN_OFF
db -1 ; end
2015-11-17 02:46:36 +00:00
2020-06-29 23:35:47 +00:00
; PCPC_POSTGAME
db 5
2020-06-29 23:35:47 +00:00
db PCPCITEM_BILLS_PC
db PCPCITEM_PLAYERS_PC
db PCPCITEM_OAKS_PC
db PCPCITEM_HALL_OF_FAME
db PCPCITEM_TURN_OFF
db -1 ; end
2015-11-17 02:46:36 +00:00
.ChooseWhichPCListToUse:
2015-11-17 02:46:36 +00:00
call CheckReceivedDex
jr nz, .got_dex
2020-06-29 23:35:47 +00:00
ld a, PCPC_BEFORE_POKEDEX
2015-11-17 02:46:36 +00:00
ret
.got_dex
ld a, [wHallOfFameCount]
and a
2020-06-29 23:35:47 +00:00
ld a, PCPC_BEFORE_HOF
2015-11-17 02:46:36 +00:00
ret z
2020-06-29 23:35:47 +00:00
ld a, PCPC_POSTGAME
2015-11-17 02:46:36 +00:00
ret
2018-06-24 14:09:41 +00:00
PC_CheckPartyForPokemon:
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2015-11-17 02:46:36 +00:00
and a
ret nz
ld de, SFX_CHOOSE_PC_OPTION
call PlaySFX
ld hl, .PokecenterPCCantUseText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
scf
ret
.PokecenterPCCantUseText:
text_far _PokecenterPCCantUseText
text_end
2015-11-17 02:46:36 +00:00
2020-06-29 23:35:47 +00:00
; PlayersPCMenuData.WhichPC indexes
const_def
const PLAYERSPC_NORMAL ; 0
const PLAYERSPC_HOUSE ; 1
; PlayersPCMenuData.PlayersPCMenuPointers indexes
const_def
const PLAYERSPCITEM_WITHDRAW_ITEM ; 0
const PLAYERSPCITEM_DEPOSIT_ITEM ; 1
const PLAYERSPCITEM_TOSS_ITEM ; 2
const PLAYERSPCITEM_MAIL_BOX ; 3
const PLAYERSPCITEM_DECORATION ; 4
const PLAYERSPCITEM_TURN_OFF ; 5
const PLAYERSPCITEM_LOG_OFF ; 6
2018-06-24 14:09:41 +00:00
BillsPC:
2015-11-17 02:46:36 +00:00
call PC_PlayChoosePCSound
ld hl, PokecenterBillsPCText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
2017-12-24 17:47:30 +00:00
farcall _BillsPC
2015-11-17 02:46:36 +00:00
and a
ret
2018-06-24 14:09:41 +00:00
PlayersPC:
2015-11-17 02:46:36 +00:00
call PC_PlayChoosePCSound
ld hl, PokecenterPlayersPCText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
2020-06-29 23:35:47 +00:00
ld b, PLAYERSPC_NORMAL
2015-11-17 02:46:36 +00:00
call _PlayersPC
and a
ret
2018-06-24 14:09:41 +00:00
OaksPC:
2015-11-17 02:46:36 +00:00
call PC_PlayChoosePCSound
ld hl, PokecenterOaksPCText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
2017-12-24 17:47:30 +00:00
farcall ProfOaksPC
2015-11-17 02:46:36 +00:00
and a
ret
2018-06-24 14:09:41 +00:00
HallOfFamePC:
2015-11-17 02:46:36 +00:00
call PC_PlayChoosePCSound
call FadeToMenu
2017-12-24 17:47:30 +00:00
farcall _HallOfFamePC
call CloseSubmenu
2015-11-17 02:46:36 +00:00
and a
ret
2018-06-24 14:09:41 +00:00
TurnOffPC:
ld hl, PokecenterPCOaksClosedText
2015-11-17 02:46:36 +00:00
call PrintText
scf
ret
2018-06-24 14:09:41 +00:00
PC_PlayBootSound:
2015-11-17 02:46:36 +00:00
ld de, SFX_BOOT_PC
jr PC_WaitPlaySFX
2018-06-24 14:09:41 +00:00
PC_PlayShutdownSound:
2015-11-17 02:46:36 +00:00
ld de, SFX_SHUT_DOWN_PC
call PC_WaitPlaySFX
call WaitSFX
ret
2018-06-24 14:09:41 +00:00
PC_PlayChoosePCSound:
2015-11-17 02:46:36 +00:00
ld de, SFX_CHOOSE_PC_OPTION
jr PC_WaitPlaySFX
2018-06-24 14:09:41 +00:00
PC_PlaySwapItemsSound:
2015-11-17 02:46:36 +00:00
ld de, SFX_SWITCH_POKEMON
call PC_WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
2018-06-24 14:09:41 +00:00
PC_WaitPlaySFX:
2015-11-17 02:46:36 +00:00
push de
call WaitSFX
pop de
call PlaySFX
ret
2018-06-24 14:09:41 +00:00
_PlayersHousePC:
2015-11-17 02:46:36 +00:00
call PC_PlayBootSound
ld hl, PlayersPCTurnOnText
2015-11-17 02:46:36 +00:00
call PC_DisplayText
2020-06-29 23:35:47 +00:00
ld b, PLAYERSPC_HOUSE
2015-11-17 02:46:36 +00:00
call _PlayersPC
and a
jr nz, .asm_156f9
call OverworldTextModeSwitch
2015-11-25 15:16:29 +00:00
call ApplyTilemap
2015-11-17 02:46:36 +00:00
call UpdateSprites
call PC_PlayShutdownSound
2020-06-29 23:35:47 +00:00
ld c, FALSE
2015-11-17 02:46:36 +00:00
ret
.asm_156f9
call ClearBGPalettes
2020-06-29 23:35:47 +00:00
ld c, TRUE
2015-11-17 02:46:36 +00:00
ret
PlayersPCTurnOnText:
text_far _PlayersPCTurnOnText
text_end
2015-11-17 02:46:36 +00:00
2018-06-24 14:09:41 +00:00
_PlayersPC:
2015-11-17 02:46:36 +00:00
ld a, b
2015-12-19 01:07:09 +00:00
ld [wWhichIndexSet], a
ld hl, PlayersPCAskWhatDoText
2015-11-17 02:46:36 +00:00
call PC_DisplayTextWaitMenu
call Function15715
call ExitMenu
ret
2018-06-24 14:09:41 +00:00
Function15715:
2015-11-17 02:46:36 +00:00
xor a
2016-03-02 03:31:21 +00:00
ld [wPCItemsCursor], a
ld [wPCItemsScrollPosition], a
2018-01-23 00:10:09 +00:00
ld hl, PlayersPCMenuData
call LoadMenuHeader
2015-11-17 02:46:36 +00:00
.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
PlayersPCMenuData:
db MENU_BACKUP_TILES ; flags
2019-06-04 11:11:29 +00:00
menu_coords 0, 0, 15, 12
dw .PlayersPCMenuData
2015-11-17 02:46:36 +00:00
db 1 ; default selected option
.PlayersPCMenuData:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
2015-11-17 02:46:36 +00:00
db 0 ; # items?
2020-06-29 23:35:47 +00:00
dw .WhichPC
2015-11-17 02:46:36 +00:00
dw PlaceNthMenuStrings
2018-01-23 00:10:09 +00:00
dw .PlayersPCMenuPointers
2015-11-17 02:46:36 +00:00
.PlayersPCMenuPointers:
2020-06-29 23:35:47 +00:00
; entries correspond to PLAYERSPCITEM_* constants
2018-01-23 00:10:09 +00:00
dw PlayerWithdrawItemMenu, .WithdrawItem
dw PlayerDepositItemMenu, .DepositItem
dw PlayerTossItemMenu, .TossItem
dw PlayerMailBoxMenu, .MailBox
dw PlayerDecorationMenu, .Decoration
dw PlayerLogOffMenu, .LogOff
dw PlayerLogOffMenu, .TurnOff
2015-11-17 02:46:36 +00:00
.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-17 02:46:36 +00:00
2020-06-29 23:35:47 +00:00
.WhichPC:
; entries correspond to PLAYERSPC_* constants
; PLAYERSPC_NORMAL
2015-11-17 02:46:36 +00:00
db 5
2020-06-29 23:35:47 +00:00
db PLAYERSPCITEM_WITHDRAW_ITEM
db PLAYERSPCITEM_DEPOSIT_ITEM
db PLAYERSPCITEM_TOSS_ITEM
db PLAYERSPCITEM_MAIL_BOX
db PLAYERSPCITEM_TURN_OFF
db -1 ; end
2015-11-17 02:46:36 +00:00
2020-06-29 23:35:47 +00:00
; PLAYERSPC_HOUSE
2015-11-17 02:46:36 +00:00
db 6
2020-06-29 23:35:47 +00:00
db PLAYERSPCITEM_WITHDRAW_ITEM
db PLAYERSPCITEM_DEPOSIT_ITEM
db PLAYERSPCITEM_TOSS_ITEM
db PLAYERSPCITEM_MAIL_BOX
db PLAYERSPCITEM_DECORATION
db PLAYERSPCITEM_LOG_OFF
db -1 ; end
2015-11-17 02:46:36 +00:00
2018-06-24 14:09:41 +00:00
PC_DisplayTextWaitMenu:
2018-01-23 22:39:09 +00:00
ld a, [wOptions]
2015-11-17 02:46:36 +00:00
push af
set NO_TEXT_SCROLL, a
2018-01-23 22:39:09 +00:00
ld [wOptions], a
2019-04-08 12:15:10 +00:00
call MenuTextbox
2015-11-17 02:46:36 +00:00
pop af
2018-01-23 22:39:09 +00:00
ld [wOptions], a
2015-11-17 02:46:36 +00:00
ret
PlayersPCAskWhatDoText:
text_far _PlayersPCAskWhatDoText
text_end
2015-11-17 02:46:36 +00:00
PlayerWithdrawItemMenu:
call LoadStandardMenuHeader
2017-12-24 17:47:30 +00:00
farcall ClearPCItemScreen
2016-03-02 03:31:21 +00:00
.loop
call PCItemsJoypad
jr c, .quit
call .Submenu
jr .loop
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.quit
call CloseSubmenu
2015-11-17 02:46:36 +00:00
xor a
ret
.Submenu:
2015-11-17 02:46:36 +00:00
; check if the item has a quantity
2017-12-24 17:47:30 +00:00
farcall _CheckTossableItem
2015-11-17 02:46:36 +00: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, .PlayersPCHowManyWithdrawText
2019-04-08 12:15:10 +00:00
call MenuTextbox
2017-12-24 17:47:30 +00:00
farcall SelectQuantityToToss
2015-11-17 02:46:36 +00:00
call ExitMenu
call ExitMenu
jr c, .done
.withdraw
ld a, [wItemQuantityChangeBuffer]
2018-01-23 22:39:09 +00:00
ld [wBuffer1], a ; quantity
ld a, [wCurItemQuantity]
ld [wBuffer2], a
ld hl, wNumItems
2015-11-17 02:46:36 +00:00
call ReceiveItem
jr nc, .PackFull
2018-01-23 22:39:09 +00:00
ld a, [wBuffer1]
2015-11-17 02:46:36 +00:00
ld [wItemQuantityChangeBuffer], a
2018-01-23 22:39:09 +00:00
ld a, [wBuffer2]
ld [wCurItemQuantity], a
2019-03-18 15:43:58 +00:00
ld hl, wNumPCItems
2015-11-17 02:46:36 +00:00
call TossItem
predef PartyMonItemName
ld hl, .PlayersPCWithdrewItemsText
2019-04-08 12:15:10 +00:00
call MenuTextbox
2015-11-17 02:46:36 +00:00
xor a
ldh [hBGMapMode], a
2015-11-17 02:46:36 +00:00
call ExitMenu
ret
.PackFull:
ld hl, .PlayersPCNoRoomWithdrawText
2019-04-08 12:15:10 +00:00
call MenuTextboxBackup
2015-11-17 02:46:36 +00:00
ret
.done
ret
.PlayersPCHowManyWithdrawText:
text_far _PlayersPCHowManyWithdrawText
text_end
2015-11-17 02:46:36 +00:00
.PlayersPCWithdrewItemsText:
text_far _PlayersPCWithdrewItemsText
text_end
2015-11-17 02:46:36 +00:00
.PlayersPCNoRoomWithdrawText:
text_far _PlayersPCNoRoomWithdrawText
text_end
2015-11-17 02:46:36 +00:00
PlayerTossItemMenu:
call LoadStandardMenuHeader
2017-12-24 17:47:30 +00:00
farcall ClearPCItemScreen
2016-03-02 03:31:21 +00:00
.loop
call PCItemsJoypad
jr c, .quit
2019-03-18 15:43:58 +00:00
ld de, wNumPCItems
2017-12-24 17:47:30 +00:00
farcall TossItemFromPC
2016-03-02 03:31:21 +00:00
jr .loop
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.quit
call CloseSubmenu
2015-11-17 02:46:36 +00:00
xor a
ret
PlayerDecorationMenu:
2018-01-23 00:10:09 +00:00
farcall _PlayerDecorationMenu
2015-11-17 02:46:36 +00:00
ld a, c
and a
ret z
scf
ret
PlayerLogOffMenu:
2015-11-17 02:46:36 +00:00
xor a
scf
ret
PlayerDepositItemMenu:
2016-03-02 03:31:21 +00:00
call .CheckItemsInBag
jr c, .nope
2015-11-17 02:46:36 +00:00
call DisableSpriteUpdates
call LoadStandardMenuHeader
2017-12-24 17:47:30 +00:00
farcall DepositSellInitPackBuffers
2016-03-02 03:31:21 +00:00
.loop
2017-12-24 17:47:30 +00:00
farcall DepositSellPack
2018-01-11 20:36:11 +00:00
ld a, [wPackUsedItem]
2015-11-17 02:46:36 +00:00
and a
2016-03-02 03:31:21 +00:00
jr z, .close
call .TryDepositItem
2017-12-24 17:47:30 +00:00
farcall CheckRegisteredItem
2016-03-02 03:31:21 +00:00
jr .loop
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.close
call CloseSubmenu
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.nope
2015-11-17 02:46:36 +00:00
xor a
ret
.CheckItemsInBag:
2017-12-24 17:47:30 +00:00
farcall HasNoItems
2015-11-17 02:46:36 +00:00
ret nc
ld hl, .PlayersPCNoItemsText
2019-04-08 12:15:10 +00:00
call MenuTextboxBackup
2015-11-17 02:46:36 +00:00
scf
ret
.PlayersPCNoItemsText:
text_far _PlayersPCNoItemsText
text_end
2015-11-17 02:46:36 +00:00
.TryDepositItem:
2015-11-25 15:16:29 +00:00
ld a, [wSpriteUpdatesEnabled]
2015-11-17 02:46:36 +00:00
push af
2020-06-29 23:35:47 +00:00
ld a, FALSE
2015-11-25 15:16:29 +00:00
ld [wSpriteUpdatesEnabled], a
2017-12-24 17:47:30 +00:00
farcall CheckItemMenu
2015-11-17 02:46:36 +00:00
ld a, [wItemAttributeParamBuffer]
2015-12-27 02:59:03 +00:00
ld hl, .dw
2015-11-17 02:46:36 +00:00
rst JumpTable
pop af
2015-11-25 15:16:29 +00:00
ld [wSpriteUpdatesEnabled], a
2015-11-17 02:46:36 +00:00
ret
2016-03-02 03:31:21 +00:00
.dw
; entries correspond to ITEMMENU_* constants
dw .tossable ; ITEMMENU_NOUSE
2015-11-17 02:46:36 +00:00
dw .no_toss
dw .no_toss
dw .no_toss
dw .tossable ; ITEMMENU_CURRENT
dw .tossable ; ITEMMENU_PARTY
dw .tossable ; ITEMMENU_CLOSE
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.no_toss
2015-11-17 02:46:36 +00:00
ret
2016-03-02 03:31:21 +00:00
.tossable
2018-01-23 22:39:09 +00:00
ld a, [wBuffer1]
2015-11-17 02:46:36 +00:00
push af
2018-01-23 22:39:09 +00:00
ld a, [wBuffer2]
2015-11-17 02:46:36 +00:00
push af
call .DepositItem
2015-11-17 02:46:36 +00:00
pop af
2018-01-23 22:39:09 +00:00
ld [wBuffer2], a
2015-11-17 02:46:36 +00:00
pop af
2018-01-23 22:39:09 +00:00
ld [wBuffer1], a
2015-11-17 02:46:36 +00:00
ret
.DepositItem:
2017-12-24 17:47:30 +00:00
farcall _CheckTossableItem
2015-11-17 02:46:36 +00:00
ld a, [wItemAttributeParamBuffer]
and a
2016-03-02 03:31:21 +00:00
jr z, .AskQuantity
2020-06-29 23:35:47 +00:00
ld a, 1
2015-11-17 02:46:36 +00:00
ld [wItemQuantityChangeBuffer], a
jr .ContinueDeposit
2015-11-17 02:46:36 +00:00
.AskQuantity:
ld hl, .PlayersPCHowManyDepositText
2019-04-08 12:15:10 +00:00
call MenuTextbox
2017-12-24 17:47:30 +00:00
farcall SelectQuantityToToss
2015-11-17 02:46:36 +00:00
push af
call ExitMenu
call ExitMenu
pop af
2016-03-02 03:31:21 +00:00
jr c, .DeclinedToDeposit
2015-11-17 02:46:36 +00:00
.ContinueDeposit:
2015-11-17 02:46:36 +00:00
ld a, [wItemQuantityChangeBuffer]
2018-01-23 22:39:09 +00:00
ld [wBuffer1], a
ld a, [wCurItemQuantity]
ld [wBuffer2], a
2019-03-18 15:43:58 +00:00
ld hl, wNumPCItems
2015-11-17 02:46:36 +00:00
call ReceiveItem
2016-03-02 03:31:21 +00:00
jr nc, .NoRoomInPC
2018-01-23 22:39:09 +00:00
ld a, [wBuffer1]
2015-11-17 02:46:36 +00:00
ld [wItemQuantityChangeBuffer], a
2018-01-23 22:39:09 +00:00
ld a, [wBuffer2]
ld [wCurItemQuantity], a
ld hl, wNumItems
2015-11-17 02:46:36 +00:00
call TossItem
predef PartyMonItemName
ld hl, .PlayersPCDepositItemsText
2015-11-17 02:46:36 +00:00
call PrintText
ret
.NoRoomInPC:
ld hl, .PlayersPCNoRoomDepositText
2015-11-17 02:46:36 +00:00
call PrintText
ret
.DeclinedToDeposit:
2015-11-17 02:46:36 +00:00
and a
ret
.PlayersPCHowManyDepositText:
text_far _PlayersPCHowManyDepositText
text_end
2015-11-17 02:46:36 +00:00
.PlayersPCDepositItemsText:
text_far _PlayersPCDepositItemsText
text_end
2015-11-17 02:46:36 +00:00
.PlayersPCNoRoomDepositText:
text_far _PlayersPCNoRoomDepositText
text_end
2015-11-17 02:46:36 +00:00
PlayerMailBoxMenu:
2018-01-23 00:10:09 +00:00
farcall _PlayerMailBoxMenu
2015-11-17 02:46:36 +00:00
xor a
ret
PCItemsJoypad:
2015-11-17 02:46:36 +00:00
xor a
2016-03-02 03:31:21 +00:00
ld [wSwitchItem], a
.loop
2015-11-25 15:16:29 +00:00
ld a, [wSpriteUpdatesEnabled]
2015-11-17 02:46:36 +00:00
push af
2020-06-29 23:35:47 +00:00
ld a, FALSE
2015-11-25 15:16:29 +00:00
ld [wSpriteUpdatesEnabled], a
2016-03-02 03:31:21 +00:00
ld hl, .PCItemsMenuData
call CopyMenuHeader
2015-11-17 02:46:36 +00:00
hlcoord 0, 0
2016-03-02 03:31:21 +00:00
ld b, 10
ld c, 18
2019-04-08 12:15:10 +00:00
call Textbox
2016-03-02 03:31:21 +00:00
ld a, [wPCItemsCursor]
2015-11-17 02:46:36 +00:00
ld [wMenuCursorBuffer], a
2016-03-02 03:31:21 +00:00
ld a, [wPCItemsScrollPosition]
2015-11-23 21:04:53 +00:00
ld [wMenuScrollPosition], a
2015-12-18 03:31:16 +00:00
call ScrollingMenu
2015-11-23 21:04:53 +00:00
ld a, [wMenuScrollPosition]
2016-03-02 03:31:21 +00:00
ld [wPCItemsScrollPosition], a
2015-12-15 23:59:49 +00:00
ld a, [wMenuCursorY]
2016-03-02 03:31:21 +00:00
ld [wPCItemsCursor], a
2015-11-17 02:46:36 +00:00
pop af
2015-11-25 15:16:29 +00:00
ld [wSpriteUpdatesEnabled], a
2016-03-02 03:31:21 +00:00
ld a, [wSwitchItem]
2015-11-17 02:46:36 +00:00
and a
2016-03-02 03:31:21 +00:00
jr nz, .moving_stuff_around
2015-12-15 23:59:49 +00:00
ld a, [wMenuJoypad]
2016-03-02 03:31:21 +00: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 23:59:49 +00:00
ld a, [wMenuJoypad]
2016-03-02 03:31:21 +00: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-17 02:46:36 +00:00
xor a
2016-03-02 03:31:21 +00:00
ld [wSwitchItem], a
jr .next
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.a_select_2
call PC_PlaySwapItemsSound
.select_1
2017-12-24 17:47:30 +00:00
farcall SwitchItemsInBag
2016-03-02 03:31:21 +00:00
.next
jp .loop
2015-11-17 02:46:36 +00:00
2016-03-02 03:31:21 +00:00
.a_1
2017-12-24 17:47:30 +00:00
farcall ScrollingMenu_ClearLeftColumn
2015-12-18 03:31:16 +00:00
call PlaceHollowCursor
2015-11-17 02:46:36 +00:00
and a
ret
2016-03-02 03:31:21 +00:00
.b_1
2015-11-17 02:46:36 +00:00
scf
ret
.PCItemsMenuData:
db MENU_BACKUP_TILES ; flags
menu_coords 4, 1, 18, 10
dw .MenuData
2015-11-17 02:46:36 +00:00
db 1 ; default option
.MenuData:
db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
2019-03-18 15:43:58 +00:00
dbw 0, wNumPCItems
2015-11-17 02:46:36 +00:00
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
2015-11-23 21:04:53 +00:00
dba UpdateItemDescription
2015-11-17 02:46:36 +00:00
2018-06-24 14:09:41 +00:00
PC_DisplayText:
2019-04-08 12:15:10 +00:00
call MenuTextbox
2015-11-17 02:46:36 +00:00
call ExitMenu
ret
PokecenterPCTurnOnText:
text_far _PokecenterPCTurnOnText
text_end
2015-11-17 02:46:36 +00:00
PokecenterPCWhoseText:
text_far _PokecenterPCWhoseText
text_end
2015-11-17 02:46:36 +00:00
PokecenterBillsPCText:
text_far _PokecenterBillsPCText
text_end
2015-11-17 02:46:36 +00:00
PokecenterPlayersPCText:
text_far _PokecenterPlayersPCText
text_end
2015-11-17 02:46:36 +00:00
PokecenterOaksPCText:
text_far _PokecenterOaksPCText
text_end
2015-11-17 02:46:36 +00:00
PokecenterPCOaksClosedText:
text_far _PokecenterPCOaksClosedText
text_end