2018-06-24 14:09:41 +00:00
|
|
|
_BillsPC:
|
2016-03-27 16:47:28 +00:00
|
|
|
call .CheckCanUsePC
|
|
|
|
ret c
|
|
|
|
call .LogIn
|
|
|
|
call .UseBillsPC
|
|
|
|
jp .LogOut
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckCanUsePC:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2016-03-27 16:47:28 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .PCGottaHavePokemonText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2016-03-27 16:47:28 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.PCGottaHavePokemonText:
|
|
|
|
text_far _PCGottaHavePokemonText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LogIn:
|
2016-03-27 16:47:28 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2016-03-27 16:47:28 +00:00
|
|
|
call ClearPCItemScreen
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set NO_TEXT_SCROLL, [hl]
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .PCWhatText
|
2016-03-27 16:47:28 +00:00
|
|
|
call PrintText
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2016-03-27 16:47:28 +00:00
|
|
|
call LoadFontsBattleExtra
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.PCWhatText:
|
|
|
|
text_far _PCWhatText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LogOut:
|
2016-03-27 16:47:28 +00:00
|
|
|
call CloseSubmenu
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UseBillsPC:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call LoadMenuHeader
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, $1
|
|
|
|
.loop
|
|
|
|
ld [wMenuCursorBuffer], a
|
|
|
|
call SetPalettes
|
|
|
|
xor a
|
|
|
|
ld [wWhichIndexSet], a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2016-03-27 16:47:28 +00:00
|
|
|
call DoNthMenu
|
|
|
|
jr c, .cancel
|
|
|
|
ld a, [wMenuCursorBuffer]
|
|
|
|
push af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2016-03-27 16:47:28 +00:00
|
|
|
ld hl, .Jumptable
|
|
|
|
rst JumpTable
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
jr nc, .loop
|
|
|
|
.cancel
|
|
|
|
call CloseWindow
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2016-03-27 16:47:28 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR ; flags
|
2016-03-27 16:47:28 +00:00
|
|
|
db 0 ; items
|
|
|
|
dw .items
|
|
|
|
dw PlaceMenuStrings
|
|
|
|
dw .strings
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.strings
|
2016-03-27 16:47:28 +00:00
|
|
|
db "WITHDRAW <PK><MN>@"
|
|
|
|
db "DEPOSIT <PK><MN>@"
|
|
|
|
db "CHANGE BOX@"
|
|
|
|
db "MOVE <PK><MN> W/O MAIL@"
|
|
|
|
db "SEE YA!@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Jumptable:
|
2016-03-27 16:47:28 +00:00
|
|
|
dw BillsPC_WithdrawMenu
|
|
|
|
dw BillsPC_DepositMenu
|
|
|
|
dw BillsPC_ChangeBoxMenu
|
|
|
|
dw BillsPC_MovePKMNMenu
|
|
|
|
dw BillsPC_SeeYa
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.items
|
2018-05-20 21:55:27 +00:00
|
|
|
db 5 ; # items
|
2016-03-27 16:47:28 +00:00
|
|
|
db 0 ; WITHDRAW
|
2018-05-20 21:55:27 +00:00
|
|
|
db 1 ; DEPOSIT
|
2016-03-27 16:47:28 +00:00
|
|
|
db 2 ; CHANGE BOX
|
|
|
|
db 3 ; MOVE PKMN
|
|
|
|
db 4 ; SEE YA!
|
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BillsPC_SeeYa:
|
2016-03-27 16:47:28 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BillsPC_MovePKMNMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall IsAnyMonHoldingMail
|
2016-03-27 16:47:28 +00:00
|
|
|
jr nc, .no_mail
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .PCMonHoldingMailText
|
2016-03-27 16:47:28 +00:00
|
|
|
call PrintText
|
|
|
|
jr .quit
|
|
|
|
|
|
|
|
.no_mail
|
2018-02-22 16:13:29 +00:00
|
|
|
farcall StartMoveMonWOMail_SaveGame
|
2016-03-27 16:47:28 +00:00
|
|
|
jr c, .quit
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _MovePKMNWithoutMail
|
2016-03-27 16:47:28 +00:00
|
|
|
call ReturnToMapFromSubmenu
|
|
|
|
call ClearPCItemScreen
|
|
|
|
|
|
|
|
.quit
|
|
|
|
call CloseWindow
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.PCMonHoldingMailText:
|
|
|
|
text_far _PCMonHoldingMailText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BillsPC_DepositMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _DepositPKMN
|
2016-03-27 16:47:28 +00:00
|
|
|
call ReturnToMapFromSubmenu
|
|
|
|
call ClearPCItemScreen
|
|
|
|
call CloseWindow
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
Functione512: ; unreferenced
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2016-03-27 16:47:28 +00:00
|
|
|
and a
|
2018-02-22 16:13:29 +00:00
|
|
|
jr z, .no_mon
|
2016-03-27 16:47:28 +00:00
|
|
|
cp 2
|
2018-02-22 16:13:29 +00:00
|
|
|
jr c, .only_one_mon
|
2016-03-27 16:47:28 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-02-22 16:13:29 +00:00
|
|
|
.no_mon
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .PCNoSingleMonText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2016-03-27 16:47:28 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-02-22 16:13:29 +00:00
|
|
|
.only_one_mon
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .PCCantDepositLastMonText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2016-03-27 16:47:28 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.PCNoSingleMonText:
|
|
|
|
text_far _PCNoSingleMonText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.PCCantDepositLastMonText:
|
|
|
|
text_far _PCCantDepositLastMonText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckCurPartyMonFainted:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1HP
|
2016-03-27 16:47:28 +00:00
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
|
|
|
ld b, $0
|
|
|
|
.loop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2016-03-27 16:47:28 +00:00
|
|
|
cp b
|
|
|
|
jr z, .skip
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
jr nz, .notfainted
|
|
|
|
dec hl
|
|
|
|
|
|
|
|
.skip
|
|
|
|
inc b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2016-03-27 16:47:28 +00:00
|
|
|
cp b
|
|
|
|
jr z, .done
|
|
|
|
add hl, de
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.notfainted
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BillsPC_WithdrawMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _WithdrawPKMN
|
2016-03-27 16:47:28 +00:00
|
|
|
call ReturnToMapFromSubmenu
|
|
|
|
call ClearPCItemScreen
|
|
|
|
call CloseWindow
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
Functione56d: ; unreferenced
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2016-03-27 16:47:28 +00:00
|
|
|
cp PARTY_LENGTH
|
2020-06-17 21:03:38 +00:00
|
|
|
jr nc, .party_full
|
2016-03-27 16:47:28 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-06-17 21:03:38 +00:00
|
|
|
.party_full
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, PCCantTakeText
|
2019-04-08 12:15:10 +00:00
|
|
|
call MenuTextboxBackup
|
2016-03-27 16:47:28 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
PCCantTakeText:
|
|
|
|
text_far _PCCantTakeText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2016-03-27 16:47:28 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BillsPC_ChangeBoxMenu:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _ChangeBox
|
2016-03-27 16:47:28 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ClearPCItemScreen:
|
2016-03-27 16:47:28 +00:00
|
|
|
call DisableSpriteUpdates
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2016-03-27 16:47:28 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
2017-12-10 05:06:20 +00:00
|
|
|
hlcoord 0, 0
|
2016-03-27 16:47:28 +00:00
|
|
|
lb bc, 10, 18
|
2019-04-08 12:15:10 +00:00
|
|
|
call Textbox
|
2017-12-10 05:06:20 +00:00
|
|
|
hlcoord 0, 12
|
2016-03-27 16:47:28 +00:00
|
|
|
lb bc, 4, 18
|
2019-04-08 12:15:10 +00:00
|
|
|
call Textbox
|
2016-03-27 16:47:28 +00:00
|
|
|
call WaitBGMap2
|
|
|
|
call SetPalettes ; load regular palettes?
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CopyBoxmonToTempMon:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2016-03-27 16:47:28 +00:00
|
|
|
ld hl, sBoxMon1Species
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wTempMonSpecies
|
2016-03-27 16:47:28 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
ld a, BANK(sBoxMon1Species)
|
2020-06-17 21:03:38 +00:00
|
|
|
call OpenSRAM
|
2016-03-27 16:47:28 +00:00
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
LoadBoxMonListing: ; unreferenced
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, [wCurBox]
|
|
|
|
cp b
|
|
|
|
jr z, .same_box
|
|
|
|
ld a, b
|
|
|
|
ld hl, .BoxAddrs
|
|
|
|
ld bc, 3
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hli]
|
|
|
|
push af
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
pop af
|
|
|
|
jr .okay
|
|
|
|
|
|
|
|
.same_box
|
|
|
|
ld a, BANK(sBoxCount)
|
|
|
|
ld hl, sBoxCount
|
|
|
|
|
|
|
|
.okay
|
2020-06-17 21:03:38 +00:00
|
|
|
call OpenSRAM
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, [hl]
|
2019-11-24 01:56:22 +00:00
|
|
|
ld bc, sBoxMons - sBox
|
2016-03-27 16:47:28 +00:00
|
|
|
add hl, bc
|
|
|
|
ld b, a
|
|
|
|
ld c, $0
|
2019-11-24 01:56:22 +00:00
|
|
|
ld de, wBoxPartialData
|
2016-03-27 16:47:28 +00:00
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
jr z, .empty_box
|
|
|
|
.loop
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
2019-11-24 01:56:22 +00:00
|
|
|
ld bc, sBoxMon1Species - sBoxMons
|
2016-03-27 16:47:28 +00:00
|
|
|
add hl, bc
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurSpecies], a
|
2016-03-27 16:47:28 +00:00
|
|
|
call GetBaseData
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
2019-11-24 01:56:22 +00:00
|
|
|
ld bc, sBoxMonNicknames - sBoxMons
|
2016-03-27 16:47:28 +00:00
|
|
|
add hl, bc
|
|
|
|
call SkipNames
|
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
|
|
|
ld bc, MON_LEVEL
|
|
|
|
add hl, bc
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld a, c
|
|
|
|
ld bc, MON_DVS
|
|
|
|
add hl, bc
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hli]
|
|
|
|
and $f0
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
and $f0
|
|
|
|
swap a
|
|
|
|
or b
|
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBaseGender]
|
2016-03-27 16:47:28 +00:00
|
|
|
cp b
|
|
|
|
ld a, $1
|
|
|
|
jr c, .okay2
|
|
|
|
xor a
|
|
|
|
.okay2
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
inc c
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
.empty_box
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BoxAddrs:
|
2016-03-27 16:47:28 +00:00
|
|
|
dba sBox1
|
|
|
|
dba sBox2
|
|
|
|
dba sBox3
|
|
|
|
dba sBox4
|
|
|
|
dba sBox5
|
|
|
|
dba sBox6
|
|
|
|
dba sBox7
|
|
|
|
dba sBox8
|
|
|
|
dba sBox9
|
|
|
|
dba sBox10
|
|
|
|
dba sBox11
|
|
|
|
dba sBox12
|
|
|
|
dba sBox13
|
|
|
|
dba sBox14
|