pokered/engine/menu/bills_pc.asm

558 lines
10 KiB
NASM
Raw Normal View History

2015-07-16 03:04:58 +00:00
DisplayPCMainMenu:: ; 213c8 (8:53c8)
xor a
2015-02-08 06:18:42 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
call SaveScreenTilesToBuffer2
2015-07-15 02:46:52 +00:00
ld a, [wNumHoFTeams]
and a
2015-07-16 03:04:58 +00:00
jr nz, .leaguePCAvailable
2015-07-21 01:32:02 +00:00
CheckEvent EVENT_GOT_POKEDEX
2015-07-16 03:04:58 +00:00
jr z, .noOaksPC
2015-07-15 02:46:52 +00:00
ld a, [wNumHoFTeams]
and a
2015-07-16 03:04:58 +00:00
jr nz, .leaguePCAvailable
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-16 03:04:58 +00:00
ld b, 8
ld c, 14
jr .next
.noOaksPC
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-16 03:04:58 +00:00
ld b, 6
ld c, 14
jr .next
.leaguePCAvailable
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-16 03:04:58 +00:00
ld b, 10
ld c, 14
.next
call TextBoxBorder
call UpdateSprites
2015-07-16 03:04:58 +00:00
ld a, 3
2015-02-08 06:18:42 +00:00
ld [wMaxMenuItem], a
2015-07-21 01:32:02 +00:00
CheckEvent EVENT_550
2015-07-16 03:04:58 +00:00
jr nz, .metBill
2015-07-18 20:52:03 +00:00
coord hl, 2, 2
2015-02-08 06:18:42 +00:00
ld de, SomeonesPCText
2015-07-16 03:04:58 +00:00
jr .next2
.metBill
2015-07-18 20:52:03 +00:00
coord hl, 2, 2
2015-02-08 06:18:42 +00:00
ld de, BillsPCText
2015-07-16 03:04:58 +00:00
.next2
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 2, 4
2015-02-08 06:18:42 +00:00
ld de, wPlayerName
call PlaceString
ld l, c
ld h, b
2015-02-08 06:18:42 +00:00
ld de, PlayersPCText
call PlaceString
2015-07-21 01:32:02 +00:00
CheckEvent EVENT_GOT_POKEDEX
2015-07-16 03:04:58 +00:00
jr z, .noOaksPC2
2015-07-18 20:52:03 +00:00
coord hl, 2, 6
2015-02-08 06:18:42 +00:00
ld de, OaksPCText
call PlaceString
2015-07-15 02:46:52 +00:00
ld a, [wNumHoFTeams]
and a
2015-07-16 03:04:58 +00:00
jr z, .noLeaguePC
ld a, 4
2015-02-08 06:18:42 +00:00
ld [wMaxMenuItem], a
2015-07-18 20:52:03 +00:00
coord hl, 2, 8
2015-02-08 06:18:42 +00:00
ld de, PKMNLeaguePCText
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 2, 10
2015-02-08 06:18:42 +00:00
ld de, LogOffPCText
2015-07-16 03:04:58 +00:00
jr .next3
.noLeaguePC
2015-07-18 20:52:03 +00:00
coord hl, 2, 8
2015-02-08 06:18:42 +00:00
ld de, LogOffPCText
2015-07-16 03:04:58 +00:00
jr .next3
.noOaksPC2
ld a, $2
2015-02-08 06:18:42 +00:00
ld [wMaxMenuItem], a
2015-07-18 20:52:03 +00:00
coord hl, 2, 6
2015-02-08 06:18:42 +00:00
ld de, LogOffPCText
2015-07-16 03:04:58 +00:00
.next3
call PlaceString
2015-07-16 03:04:58 +00:00
ld a, A_BUTTON | B_BUTTON
2015-02-08 06:18:42 +00:00
ld [wMenuWatchedKeys], a
2015-07-16 03:04:58 +00:00
ld a, 2
2015-02-08 06:18:42 +00:00
ld [wTopMenuItemY], a
2015-07-16 03:04:58 +00:00
ld a, 1
2015-02-08 06:18:42 +00:00
ld [wTopMenuItemX], a
xor a
2015-02-08 06:18:42 +00:00
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
2015-07-16 03:04:58 +00:00
ld a, 1
2015-02-08 06:18:42 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
ret
SomeonesPCText: db "SOMEONE's PC@"
BillsPCText: db "BILL's PC@"
PlayersPCText: db "'s PC@"
OaksPCText: db "PROF.OAK's PC@"
PKMNLeaguePCText: db $4a, "LEAGUE@"
LogOffPCText: db "LOG OFF@"
BillsPC_:: ; 0x214c2
ld hl, wd730
set 6, [hl]
xor a
2015-07-16 03:04:58 +00:00
ld [wParentMenuItem], a
inc a ; MONSTER_NAME
2015-02-08 09:44:41 +00:00
ld [wNameListType], a
call LoadHpBarAndStatusTilePatterns
2015-02-08 06:18:42 +00:00
ld a, [wListScrollOffset]
push af
ld a, [wFlags_0xcd60]
2015-07-16 03:04:58 +00:00
bit 3, a ; accessing Bill's PC through another PC?
jr nz, BillsPCMenu
2015-07-16 03:04:58 +00:00
; accessing it directly
ld a, $99
call PlaySound
ld hl, SwitchOnText
call PrintText
2015-07-16 03:04:58 +00:00
BillsPCMenu: ; 214e8 (8:54e8)
ld a, [wParentMenuItem]
2015-02-08 06:18:42 +00:00
ld [wCurrentMenuItem], a
2014-05-29 08:31:46 +00:00
ld hl, vChars2 + $780
2015-02-08 06:18:42 +00:00
ld de, PokeballTileGraphics
ld bc, (BANK(PokeballTileGraphics) << 8) + $01
call CopyVideoData
call LoadScreenTilesFromBuffer2DisableBGTransfer
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-16 03:04:58 +00:00
ld b, 10
ld c, 12
call TextBoxBorder
2015-07-18 20:52:03 +00:00
coord hl, 2, 2
2015-02-08 06:18:42 +00:00
ld de, BillsPCMenuText
call PlaceString
2015-02-08 06:18:42 +00:00
ld hl, wTopMenuItemY
2015-07-16 03:04:58 +00:00
ld a, 2
ld [hli], a ; wTopMenuItemY
dec a
2015-07-16 03:04:58 +00:00
ld [hli], a ; wTopMenuItemX
inc hl
inc hl
2015-07-16 03:04:58 +00:00
ld a, 4
ld [hli], a ; wMaxMenuItem
ld a, A_BUTTON | B_BUTTON
ld [hli], a ; wMenuWatchedKeys
xor a
2015-07-16 03:04:58 +00:00
ld [hli], a ; wLastMenuItem
ld [hli], a ; wPartyAndBillsPCSavedMenuItem
2015-02-08 06:18:42 +00:00
ld hl, wListScrollOffset
2015-07-16 03:04:58 +00:00
ld [hli], a ; wListScrollOffset
ld [hl], a ; wMenuWatchMovingOutOfBounds
2015-02-08 06:18:42 +00:00
ld [wPlayerMonNumber], a
ld hl, WhatText
call PrintText
2015-07-18 20:52:03 +00:00
coord hl, 9, 14
2015-07-16 03:04:58 +00:00
ld b, 2
ld c, 9
call TextBoxBorder
2015-07-16 03:04:58 +00:00
ld a, [wCurrentBoxNum]
and $7f
cp 9
2015-07-16 03:04:58 +00:00
jr c, .singleDigitBoxNum
; two digit box num
sub 9
2015-07-18 20:52:03 +00:00
coord hl, 17, 16
ld [hl], "1"
add "0"
2015-07-16 03:04:58 +00:00
jr .next
.singleDigitBoxNum
add "1"
2015-07-16 03:04:58 +00:00
.next
Coorda 18, 16
2015-07-18 20:52:03 +00:00
coord hl, 10, 16
2015-02-08 06:18:42 +00:00
ld de, BoxNoPCText
call PlaceString
2015-07-16 03:04:58 +00:00
ld a, 1
2015-02-08 06:18:42 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
call HandleMenuInput
bit 1, a
2015-07-16 03:04:58 +00:00
jp nz, ExitBillsPC ; b button
call PlaceUnfilledArrowMenuCursor
2015-02-08 06:18:42 +00:00
ld a, [wCurrentMenuItem]
2015-07-16 03:04:58 +00:00
ld [wParentMenuItem], a
and a
2015-07-16 03:04:58 +00:00
jp z, BillsPCWithdraw ; withdraw
cp $1
2015-07-16 03:04:58 +00:00
jp z, BillsPCDeposit ; deposit
cp $2
2015-07-16 03:04:58 +00:00
jp z, BillsPCRelease ; release
cp $3
2015-07-16 03:04:58 +00:00
jp z, BillsPCChangeBox ; change box
2015-07-16 03:04:58 +00:00
ExitBillsPC: ; 21588 (8:5588)
ld a, [wFlags_0xcd60]
2015-07-16 03:04:58 +00:00
bit 3, a ; accessing Bill's PC through another PC?
jr nz, .next
; accessing it directly
call LoadTextBoxTilePatterns
ld a, $9a
call PlaySound
call WaitForSoundToFinish
2015-07-16 03:04:58 +00:00
.next
ld hl, wFlags_0xcd60
res 5, [hl]
call LoadScreenTilesFromBuffer2
pop af
2015-02-08 06:18:42 +00:00
ld [wListScrollOffset], a
ld hl, wd730
res 6, [hl]
ret
2015-07-16 03:04:58 +00:00
BillsPCDeposit: ; 215ac (8:55ac)
2015-02-08 06:18:42 +00:00
ld a, [wPartyCount]
dec a
2015-07-16 03:04:58 +00:00
jr nz, .partyLargeEnough
ld hl, CantDepositLastMonText
call PrintText
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
.partyLargeEnough
2015-02-08 06:18:42 +00:00
ld a, [W_NUMINBOX]
cp MONS_PER_BOX
2015-07-16 03:04:58 +00:00
jr nz, .boxNotFull
2015-02-08 06:18:42 +00:00
ld hl, BoxFullText
call PrintText
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
.boxNotFull
2015-02-08 06:18:42 +00:00
ld hl, wPartyCount
2015-07-16 03:04:58 +00:00
call DisplayMonListMenu
jp c, BillsPCMenu
2015-07-16 03:04:58 +00:00
call DisplayDepositWithdrawMenu
jp nc, BillsPCMenu
ld a, [wcf91]
call GetCryData
call PlaySoundWaitForCurrent
ld a, PARTY_TO_BOX
ld [wMoveMonType], a
2015-07-13 06:00:48 +00:00
call MoveMon
xor a
ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
2015-07-16 03:04:58 +00:00
ld hl, wBoxNumString
ld a, [wCurrentBoxNum]
and $7f
cp 9
2015-07-16 03:04:58 +00:00
jr c, .singleDigitBoxNum
sub 9
ld [hl], "1"
inc hl
add "0"
2015-07-16 03:04:58 +00:00
jr .next
.singleDigitBoxNum
add "1"
2015-07-16 03:04:58 +00:00
.next
ld [hli], a
ld [hl], $50
2015-02-08 06:18:42 +00:00
ld hl, MonWasStoredText
call PrintText
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
BillsPCWithdraw: ; 21618 (8:5618)
2015-02-08 06:18:42 +00:00
ld a, [W_NUMINBOX]
and a
2015-07-16 03:04:58 +00:00
jr nz, .boxNotEmpty
2015-02-08 06:18:42 +00:00
ld hl, NoMonText
call PrintText
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
.boxNotEmpty
2015-02-08 06:18:42 +00:00
ld a, [wPartyCount]
cp PARTY_LENGTH
2015-07-16 03:04:58 +00:00
jr nz, .partyNotFull
2015-02-08 06:18:42 +00:00
ld hl, CantTakeMonText
call PrintText
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
.partyNotFull
2015-02-08 06:18:42 +00:00
ld hl, W_NUMINBOX
2015-07-16 03:04:58 +00:00
call DisplayMonListMenu
jp c, BillsPCMenu
call DisplayDepositWithdrawMenu
jp nc, BillsPCMenu
2015-02-08 06:18:42 +00:00
ld a, [wWhichPokemon]
ld hl, wBoxMonNicks
call GetPartyMonName
ld a, [wcf91]
call GetCryData
call PlaySoundWaitForCurrent
xor a ; BOX_TO_PARTY
ld [wMoveMonType], a
2015-07-13 06:00:48 +00:00
call MoveMon
ld a, 1
ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
2015-02-08 06:18:42 +00:00
ld hl, MonIsTakenOutText
call PrintText
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
BillsPCRelease: ; 21673 (8:5673)
2015-02-08 06:18:42 +00:00
ld a, [W_NUMINBOX]
and a
2015-07-16 03:04:58 +00:00
jr nz, .loop
2015-02-08 06:18:42 +00:00
ld hl, NoMonText
call PrintText
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
.loop
2015-02-08 06:18:42 +00:00
ld hl, W_NUMINBOX
2015-07-16 03:04:58 +00:00
call DisplayMonListMenu
jp c, BillsPCMenu
2015-02-08 06:18:42 +00:00
ld hl, OnceReleasedText
call PrintText
call YesNoChoice
2015-02-08 06:18:42 +00:00
ld a, [wCurrentMenuItem]
and a
2015-07-16 03:04:58 +00:00
jr nz, .loop
inc a
ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
ld a, [wcf91]
call PlayCry
2015-02-08 06:18:42 +00:00
ld hl, MonWasReleasedText
call PrintText
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
BillsPCChangeBox: ; 216b3 (8:56b3)
2014-09-14 18:29:18 +00:00
callba ChangeBox
2015-07-16 03:04:58 +00:00
jp BillsPCMenu
2015-07-16 03:04:58 +00:00
DisplayMonListMenu: ; 216be (8:56be)
ld a, l
2015-07-15 06:16:06 +00:00
ld [wListPointer], a
ld a, h
2015-07-15 06:16:06 +00:00
ld [wListPointer + 1], a
xor a
2015-07-13 06:00:48 +00:00
ld [wPrintItemPrices], a
2015-02-08 06:18:42 +00:00
ld [wListMenuID], a
inc a ; MONSTER_NAME
2015-02-08 09:44:41 +00:00
ld [wNameListType], a
2015-07-16 03:04:58 +00:00
ld a, [wPartyAndBillsPCSavedMenuItem]
2015-02-08 06:18:42 +00:00
ld [wCurrentMenuItem], a
call DisplayListMenuID
2015-02-08 06:18:42 +00:00
ld a, [wCurrentMenuItem]
2015-07-16 03:04:58 +00:00
ld [wPartyAndBillsPCSavedMenuItem], a
ret
BillsPCMenuText: ; 216e1 (8:56e1)
db "WITHDRAW ", $4a
next "DEPOSIT ", $4a
next "RELEASE ", $4a
next "CHANGE BOX"
2014-10-17 08:42:32 +00:00
IF DEF(_YELLOW)
2014-10-10 07:46:06 +00:00
next "PRINT BOX"
ENDC
next "SEE YA!"
db "@"
BoxNoPCText: ; 21713 (8:5713)
db "BOX No.@"
2015-07-16 03:04:58 +00:00
KnowsHMMove:: ; 2171b (8:571b)
; returns whether mon with party index [wWhichPokemon] knows an HM move
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
2015-07-16 03:04:58 +00:00
jr .next
; unreachable
ld hl, wBoxMon1Moves
ld bc, wBoxMon2 - wBoxMon1
2015-07-16 03:04:58 +00:00
.next
ld a, [wWhichPokemon]
call AddNTimes
ld b, NUM_MOVES
2015-07-16 03:04:58 +00:00
.loop
ld a, [hli]
push hl
push bc
2015-02-08 06:18:42 +00:00
ld hl, HMMoveArray
ld de, 1
call IsInArray
pop bc
pop hl
ret c
dec b
2015-07-16 03:04:58 +00:00
jr nz, .loop
and a
ret
HMMoveArray: ; 21745 (8:5745)
db CUT
db FLY
db SURF
db STRENGTH
db FLASH
db -1
2015-07-16 03:04:58 +00:00
DisplayDepositWithdrawMenu: ; 2174b (8:574b)
2015-07-18 20:52:03 +00:00
coord hl, 9, 10
2015-07-16 03:04:58 +00:00
ld b, 6
ld c, 9
call TextBoxBorder
2015-07-16 03:04:58 +00:00
ld a, [wParentMenuItem]
and a ; was the Deposit or Withdraw item selected in the parent menu?
2015-02-08 06:18:42 +00:00
ld de, DepositPCText
2015-07-16 03:04:58 +00:00
jr nz, .next
2015-02-08 06:18:42 +00:00
ld de, WithdrawPCText
2015-07-16 03:04:58 +00:00
.next
2015-07-18 20:52:03 +00:00
coord hl, 11, 12
call PlaceString
2015-07-18 20:52:03 +00:00
coord hl, 11, 14
2015-02-08 06:18:42 +00:00
ld de, StatsCancelPCText
call PlaceString
2015-02-08 06:18:42 +00:00
ld hl, wTopMenuItemY
2015-07-16 03:04:58 +00:00
ld a, 12
ld [hli], a ; wTopMenuItemY
ld a, 10
ld [hli], a ; wTopMenuItemX
xor a
2015-07-16 03:04:58 +00:00
ld [hli], a ; wCurrentMenuItem
inc hl
2015-07-16 03:04:58 +00:00
ld a, 2
ld [hli], a ; wMaxMenuItem
ld a, A_BUTTON | B_BUTTON
ld [hli], a ; wMenuWatchedKeys
xor a
2015-07-16 03:04:58 +00:00
ld [hl], a ; wLastMenuItem
2015-02-08 06:18:42 +00:00
ld hl, wListScrollOffset
2015-07-16 03:04:58 +00:00
ld [hli], a ; wListScrollOffset
ld [hl], a ; wMenuWatchMovingOutOfBounds
2015-02-08 06:18:42 +00:00
ld [wPlayerMonNumber], a
2015-07-16 03:04:58 +00:00
ld [wPartyAndBillsPCSavedMenuItem], a
.loop
call HandleMenuInput
2015-07-16 03:04:58 +00:00
bit 1, a ; pressed B?
jr nz, .exit
2015-02-08 06:18:42 +00:00
ld a, [wCurrentMenuItem]
and a
2015-07-16 03:04:58 +00:00
jr z, .choseDepositWithdraw
dec a
2015-07-16 03:04:58 +00:00
jr z, .viewStats
.exit
and a
ret
2015-07-16 03:04:58 +00:00
.choseDepositWithdraw
scf
ret
2015-07-16 03:04:58 +00:00
.viewStats
call SaveScreenTilesToBuffer1
2015-07-16 03:04:58 +00:00
ld a, [wParentMenuItem]
and a
2015-07-16 03:04:58 +00:00
ld a, PLAYER_PARTY_DATA
jr nz, .next2
ld a, BOX_DATA
.next2
ld [wMonDataLocation], a
predef StatusScreen
predef StatusScreen2
call LoadScreenTilesFromBuffer1
call ReloadTilesetTilePatterns
call GoPAL_SET_CF1C
call LoadGBPal
2015-07-16 03:04:58 +00:00
jr .loop
DepositPCText: db "DEPOSIT@"
WithdrawPCText: db "WITHDRAW@"
StatsCancelPCText:
db "STATS"
next "CANCEL@"
SwitchOnText: ; 0x217e9
TX_FAR _SwitchOnText
db "@"
WhatText: ; 0x217ee
TX_FAR _WhatText
db "@"
DepositWhichMonText: ; 0x217f3
TX_FAR _DepositWhichMonText
db "@"
MonWasStoredText: ; 0x217f8
TX_FAR _MonWasStoredText
db "@"
CantDepositLastMonText: ; 0x217fd
TX_FAR _CantDepositLastMonText
db "@"
BoxFullText: ; 0x21802
TX_FAR _BoxFullText
db "@"
MonIsTakenOutText: ; 0x21807
TX_FAR _MonIsTakenOutText
db "@"
NoMonText: ; 0x2180c
TX_FAR _NoMonText
db "@"
CantTakeMonText: ; 0x21811
TX_FAR _CantTakeMonText
db "@"
ReleaseWhichMonText: ; 0x21816
TX_FAR _ReleaseWhichMonText
db "@"
OnceReleasedText: ; 0x2181b
TX_FAR _OnceReleasedText
db "@"
MonWasReleasedText: ; 0x21820
TX_FAR _MonWasReleasedText
db "@"
2015-02-07 10:43:08 +00:00
CableClubLeftGameboy:: ; 5824 (8:5825)
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
ret z
2015-02-07 10:43:08 +00:00
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_RIGHT
ret nz
ld a, [W_CURMAP]
cp TRADE_CENTER
2015-02-07 10:43:08 +00:00
ld a, LINK_STATE_START_TRADE
2015-07-16 03:04:58 +00:00
jr z, .next
2015-02-07 10:43:08 +00:00
inc a ; LINK_STATE_START_BATTLE
2015-07-16 03:04:58 +00:00
.next
2015-02-07 10:43:08 +00:00
ld [wLinkState], a
call EnableAutoTextBoxDrawing
tx_pre_jump JustAMomentText
2015-02-07 10:43:08 +00:00
CableClubRightGameboy:: ; 5845 (8:5845)
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret z
2015-02-07 10:43:08 +00:00
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_LEFT
ret nz
ld a, [W_CURMAP]
cp TRADE_CENTER
2015-02-07 10:43:08 +00:00
ld a, LINK_STATE_START_TRADE
2015-07-16 03:04:58 +00:00
jr z, .next
2015-02-07 10:43:08 +00:00
inc a ; LINK_STATE_START_BATTLE
2015-07-16 03:04:58 +00:00
.next
2015-02-07 10:43:08 +00:00
ld [wLinkState], a
call EnableAutoTextBoxDrawing
tx_pre_jump JustAMomentText
2014-05-15 23:58:24 +00:00
JustAMomentText:: ; 21865 (8:5865)
TX_FAR _JustAMomentText
db "@"
2015-02-07 10:43:08 +00:00
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
tx_pre_jump OpenBillsPCText
OpenBillsPCText:: ; 21878 (8:5878)
2014-05-21 23:08:32 +00:00
db $FD ; FuncTX_BillsPC