2015-11-12 04:38:57 +00:00
|
|
|
_DepositPKMN: ; e2391 (38:6391)
|
|
|
|
ld hl, Options
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set 4, [hl]
|
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
ld a, [hInMenu]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hInMenu], a
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_InitRAM
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_LoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
2015-12-16 17:32:08 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .done
|
|
|
|
call .RunJumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
2015-12-16 17:32:08 +00:00
|
|
|
jr .loop
|
|
|
|
.done
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearSprites
|
|
|
|
pop af
|
|
|
|
ld [hInMenu], a
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
pop af
|
|
|
|
ld [Options], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.RunJumptable: ; e23d5 (38:63d5)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, .Jumptable
|
|
|
|
call BillsPC_Jumptable
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Jumptable: ; e23df (38:63df)
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .Init
|
|
|
|
dw .HandleJoypad
|
|
|
|
dw .WhatsUp
|
|
|
|
dw .Submenu
|
|
|
|
dw BillsPC_EndJumptableLoop
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Init: ; e23e9 (38:63e9)
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call CopyBoxmonSpecies
|
|
|
|
call BillsPC_BoxName
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_ChooseaPKMN
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $5
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_NumMonsOnScreen], a
|
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $ff
|
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitBGMap
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.HandleJoypad: ; e241a (38:641a)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyPressed ; $ffa7
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .a_button
|
|
|
|
call Withdraw_UpDown
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
|
|
|
.a_button
|
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
|
|
|
jr z, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $2
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e2452 (38:6452)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.go_back
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.WhatsUp: ; e245d (38:645d)
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Submenu: ; e247d (38:647d)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, BillsPCDepositMenuDataHeader
|
|
|
|
call CopyMenuDataHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-16 17:32:08 +00:00
|
|
|
call StoreTo_wMenuCursorBuffer
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-11-12 04:38:57 +00:00
|
|
|
jp c, BillsPCDepositFuncCancel
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
and $3
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, BillsPCDepositJumptable
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
BillsPCDepositJumptable: ; e24a1 (38:64a1)
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2015-12-27 02:59:03 +00:00
|
|
|
dw BillsPCDepositFuncDeposit ; Deposit Pokemon
|
|
|
|
dw BillsPCDepositFuncStats ; Pokemon Stats
|
|
|
|
dw BillsPCDepositFuncRelease ; Release Pokemon
|
|
|
|
dw BillsPCDepositFuncCancel ; Cancel
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_CheckMail_PreventBlackout
|
2015-11-12 04:38:57 +00:00
|
|
|
jp c, BillsPCDepositFuncCancel
|
2015-12-16 17:32:08 +00:00
|
|
|
call DepositPokemon
|
|
|
|
jr c, .box_full
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
|
|
|
.box_full
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
BillsPCDepositFuncStats: ; e24c8 (38:64c8)
|
|
|
|
call LoadStandardMenuDataHeader
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_StatsScreen
|
2015-11-12 04:38:57 +00:00
|
|
|
call ExitMenu
|
|
|
|
call PCMonInfo
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_CheckMail_PreventBlackout
|
2015-11-12 04:38:57 +00:00
|
|
|
jr c, BillsPCDepositFuncCancel
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IsMonAnEgg
|
2015-11-12 04:38:57 +00:00
|
|
|
jr c, BillsPCDepositFuncCancel
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
push af
|
|
|
|
ld de, PCString_ReleasePKMN
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
call LoadStandardMenuDataHeader
|
|
|
|
lb bc, 14, 11
|
|
|
|
call PlaceYesNoBox
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
call ExitMenu
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .failed_release
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
xor a
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-12-16 17:32:08 +00:00
|
|
|
call ReleasePKMN_ByePKMN
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
|
|
|
.failed_release
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
BillsPCDepositFuncCancel: ; e2537 (38:6537)
|
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e253d (38:653d)
|
|
|
|
|
|
|
|
BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d)
|
|
|
|
db $40 ; flags
|
|
|
|
db 04, 09 ; start coords
|
|
|
|
db 13, 19 ; end coords
|
2015-12-16 17:32:08 +00:00
|
|
|
dw .MenuData2
|
2015-11-12 04:38:57 +00:00
|
|
|
db 1 ; default option
|
|
|
|
; 0xe2545
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.MenuData2: ; 0xe2545 (38:6545)
|
2015-11-12 04:38:57 +00:00
|
|
|
db $80 ; flags
|
|
|
|
db 4 ; items
|
|
|
|
db "DEPOSIT@"
|
|
|
|
db "STATS@"
|
|
|
|
db "RELEASE@"
|
|
|
|
db "CANCEL@"
|
|
|
|
; 0xe2564 (38:6564)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_ClearThreeBoxes: ; e2564
|
|
|
|
; unreferenced
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 0, 0
|
2015-12-16 17:32:08 +00:00
|
|
|
ld b, 4
|
|
|
|
ld c, 8
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 4
|
2015-12-16 17:32:08 +00:00
|
|
|
ld b, 10
|
|
|
|
ld c, 9
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 14
|
2015-12-16 17:32:08 +00:00
|
|
|
ld b, 2
|
|
|
|
ld c, 8
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
; e2583
|
|
|
|
|
|
|
|
_WithdrawPKMN: ; e2583 (38:6583)
|
|
|
|
ld hl, Options
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set 4, [hl]
|
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
ld a, [hInMenu]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hInMenu], a
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_InitRAM
|
|
|
|
ld a, NUM_BOXES + 1
|
|
|
|
ld [wBillsPC_LoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
2015-12-16 17:32:08 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .done
|
|
|
|
call .RunJumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
2015-12-16 17:32:08 +00:00
|
|
|
jr .loop
|
|
|
|
.done
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearSprites
|
|
|
|
pop af
|
|
|
|
ld [hInMenu], a
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
pop af
|
|
|
|
ld [Options], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.RunJumptable: ; e25c8 (38:65c8)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, .Jumptable
|
|
|
|
call BillsPC_Jumptable
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Jumptable: ; e25d2 (38:65d2)
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .Init
|
|
|
|
dw .Joypad
|
|
|
|
dw .PrepSubmenu
|
|
|
|
dw BillsPC_Withdraw
|
|
|
|
dw BillsPC_EndJumptableLoop
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Init: ; e25dc (38:65dc)
|
|
|
|
ld a, NUM_BOXES + 1
|
|
|
|
ld [wBillsPC_LoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call CopyBoxmonSpecies
|
|
|
|
call BillsPC_BoxName
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_ChooseaPKMN
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $5
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_NumMonsOnScreen], a
|
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $ff
|
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitBGMap
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Joypad: ; e2612 (38:6612)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyPressed ; $ffa7
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .a_button
|
|
|
|
call Withdraw_UpDown
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
.a_button
|
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
|
|
|
jr z, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $2
|
|
|
|
ld [wJumptableIndex], a
|
2015-12-16 17:32:08 +00:00
|
|
|
ret ; e264a (38:664a)
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.unused
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e2655
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PrepSubmenu: ; e2655 (38:6655)
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
BillsPC_Withdraw: ; e2675 (38:6675)
|
|
|
|
ld hl, .MenuDataHeader
|
|
|
|
call CopyMenuDataHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-16 17:32:08 +00:00
|
|
|
call StoreTo_wMenuCursorBuffer
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-11-12 04:38:57 +00:00
|
|
|
jp c, .cancel
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
and 3
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-27 02:59:03 +00:00
|
|
|
ld hl, .dw
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.dw ; e2699 (38:6699) #mark
|
2015-11-12 04:38:57 +00:00
|
|
|
dw .withdraw ; Withdraw
|
|
|
|
dw .stats ; Stats
|
|
|
|
dw .release ; Release
|
|
|
|
dw .cancel ; Cancel
|
|
|
|
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.withdraw ; e26a1 (38:66a1)
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_CheckMail_PreventBlackout
|
2015-11-12 04:38:57 +00:00
|
|
|
jp c, .cancel
|
|
|
|
call TryWithdrawPokemon
|
|
|
|
jr c, .FailedWithdraw
|
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2016-04-10 18:42:14 +00:00
|
|
|
.FailedWithdraw:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.stats ; e26c0 (38:66c0)
|
2015-11-12 04:38:57 +00:00
|
|
|
call LoadStandardMenuDataHeader
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_StatsScreen
|
2015-11-12 04:38:57 +00:00
|
|
|
call ExitMenu
|
|
|
|
call PCMonInfo
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.release ; e26d8 (38:66d8)
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
push af
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IsMonAnEgg
|
2015-11-12 04:38:57 +00:00
|
|
|
jr c, .FailedRelease
|
|
|
|
ld de, PCString_ReleasePKMN
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
call LoadStandardMenuDataHeader
|
|
|
|
lb bc, 14, 11
|
|
|
|
call PlaceYesNoBox
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
call ExitMenu
|
|
|
|
and a
|
|
|
|
jr nz, .FailedRelease
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld a, PC_DEPOSIT
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-12-16 17:32:08 +00:00
|
|
|
call ReleasePKMN_ByePKMN
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
|
|
|
ret
|
2016-04-10 18:42:14 +00:00
|
|
|
.FailedRelease:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.cancel ; e272b (38:672b)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e2731 (38:6731)
|
|
|
|
|
|
|
|
.MenuDataHeader: ; 0xe2731
|
|
|
|
db $40 ; flags
|
|
|
|
db 04, 09 ; start coords
|
|
|
|
db 13, 19 ; end coords
|
|
|
|
dw .MenuData
|
|
|
|
db 1 ; default option
|
|
|
|
; 0xe2739
|
|
|
|
|
|
|
|
.MenuData: ; 0xe2739
|
|
|
|
db $80 ; flags
|
|
|
|
db 4 ; items
|
|
|
|
db "WITHDRAW@"
|
|
|
|
db "STATS@"
|
|
|
|
db "RELEASE@"
|
|
|
|
db "CANCEL@"
|
|
|
|
; 0xe2759
|
|
|
|
|
|
|
|
_MovePKMNWithoutMail: ; e2759
|
|
|
|
ld hl, Options
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set 4, [hl]
|
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
ld a, [hInMenu]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hInMenu], a
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_InitRAM
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wCurBox]
|
|
|
|
and $f
|
|
|
|
inc a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_LoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
|
|
|
.asm_e2781
|
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .asm_e2793
|
2015-12-16 17:32:08 +00:00
|
|
|
call .RunJumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
call DelayFrame
|
|
|
|
jr .asm_e2781
|
|
|
|
|
|
|
|
.asm_e2793
|
|
|
|
call ClearSprites
|
|
|
|
pop af
|
|
|
|
ld [hInMenu], a
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
pop af
|
|
|
|
ld [Options], a
|
|
|
|
ret
|
|
|
|
; e27a2
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.RunJumptable: ; e27a2
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wJumptableIndex]
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, .Jumptable
|
|
|
|
call BillsPC_Jumptable
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
; e27ac
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Jumptable: ; e27ac
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .Init
|
|
|
|
dw .Joypad
|
|
|
|
dw .PrepSubmenu
|
|
|
|
dw .MoveMonWOMailSubmenu
|
|
|
|
dw .PrepInsertCursor
|
|
|
|
dw .Joypad2
|
|
|
|
dw BillsPC_EndJumptableLoop
|
2015-11-12 04:38:57 +00:00
|
|
|
; e27ba
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Init: ; e27ba
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call CopyBoxmonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_ChooseaPKMN
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
|
|
|
ld a, 5
|
|
|
|
ld [wBillsPC_NumMonsOnScreen], a
|
|
|
|
call BillsPC_RefreshTextboxes
|
|
|
|
call BillsPC_MoveMonWOMail_BoxNameAndArrows
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $ff
|
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitBGMap
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e27eb
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Joypad: ; e27eb
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyPressed
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .a_button
|
|
|
|
call MovePkmnWithoutMail_DPad
|
|
|
|
jr c, .d_pad
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateSelectionCursor
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
call PCMonInfo
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.d_pad
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.a_button
|
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
|
|
|
jr z, .b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $2
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.unused
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.b_button
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $6
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e283d
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PrepSubmenu: ; e283d
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_WhatsUp
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e285d
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.MoveMonWOMailSubmenu: ; e285d
|
|
|
|
ld hl, .MenuDataHeader
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyMenuDataHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-16 17:32:08 +00:00
|
|
|
call StoreTo_wMenuCursorBuffer
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-12-16 17:32:08 +00:00
|
|
|
jp c, .Cancel
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
and 3
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, .Jumptable2
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2881
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Jumptable2: ; e2881
|
|
|
|
dw .Move
|
|
|
|
dw .Stats
|
|
|
|
dw .Cancel
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2887
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Move: ; e2887
|
|
|
|
call BillsPC_CheckMail_PreventBlackout
|
|
|
|
jp c, .Cancel
|
|
|
|
ld a, [wBillsPC_ScrollPosition]
|
|
|
|
ld [wBillsPC_BackupScrollPosition], a
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld [wBillsPC_BackupCursorPosition], a
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
|
|
|
ld [wBillsPC_BackupLoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e28a5
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Stats: ; e28a5
|
2015-11-12 04:38:57 +00:00
|
|
|
call LoadStandardMenuDataHeader
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_StatsScreen
|
2015-11-12 04:38:57 +00:00
|
|
|
call ExitMenu
|
|
|
|
call PCMonInfo
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [CurPartySpecies], a
|
2016-06-06 22:23:00 +00:00
|
|
|
ld a, SCGB_BILLS_PC
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ApplyPalettes
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e28bd
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Cancel: ; e28bd
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e28c3
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.MenuDataHeader: ; 0xe28c3
|
2015-11-12 04:38:57 +00:00
|
|
|
db $40 ; flags
|
|
|
|
db 04, 09 ; start coords
|
|
|
|
db 13, 19 ; end coords
|
2015-12-16 17:32:08 +00:00
|
|
|
dw .MenuData2
|
2015-11-12 04:38:57 +00:00
|
|
|
db 1 ; default option
|
|
|
|
; 0xe28cb
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.MenuData2: ; 0xe28cb
|
2015-11-12 04:38:57 +00:00
|
|
|
db $80 ; flags
|
|
|
|
db 3 ; items
|
|
|
|
db "MOVE@"
|
|
|
|
db "STATS@"
|
|
|
|
db "CANCEL@"
|
|
|
|
; 0xe28df
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PrepInsertCursor: ; e28df
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call CopyBoxmonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_MoveToWhere
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $5
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_NumMonsOnScreen], a
|
|
|
|
call BillsPC_RefreshTextboxes
|
|
|
|
call BillsPC_MoveMonWOMail_BoxNameAndArrows
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearSprites
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateInsertCursor
|
2015-11-12 04:38:57 +00:00
|
|
|
call WaitBGMap
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_IncrementJumptableIndex
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e2903
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Joypad2: ; e2903
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyPressed
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .b_button_2
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .a_button_2
|
|
|
|
call MovePkmnWithoutMail_DPad_2
|
|
|
|
jr c, .dpad_2
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_UpdateInsertCursor
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_RefreshTextboxes
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.dpad_2
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.a_button_2
|
|
|
|
call BillsPC_CheckSpaceInDestination
|
|
|
|
jr c, .no_space
|
|
|
|
call MovePKMNWitoutMail_InsertMon
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.no_space
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.b_button_2
|
|
|
|
ld a, [wBillsPC_BackupScrollPosition]
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
|
|
|
ld a, [wBillsPC_BackupCursorPosition]
|
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld a, [wBillsPC_BackupLoadedBox]
|
|
|
|
ld [wBillsPC_LoadedBox], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $0
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
; e2963
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_InitRAM: ; e2963 (38:6963)
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearSprites
|
|
|
|
call ClearTileMap
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_InitGFX
|
|
|
|
ld hl, wBillsPCPokemonList
|
2015-11-12 04:38:57 +00:00
|
|
|
ld bc, $338
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ld [wcf64], a
|
|
|
|
ld [wcf65], a
|
|
|
|
ld [wcf66], a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_CursorPosition], a
|
|
|
|
ld [wBillsPC_ScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_IncrementJumptableIndex: ; e298d (38:698d)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_EndJumptableLoop: ; e2992 (38:6992)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
_StatsScreenDPad: ; e2998 (38:6998)
|
|
|
|
ld a, [wBillsPC_NumMonsOnScreen]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .empty
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
cp $1
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .empty
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressUp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressDown
|
|
|
|
.empty
|
|
|
|
jp BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
Withdraw_UpDown: ; e29b5 (38:69b5)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyLast
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsOnScreen]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .empty
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressUp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressDown
|
|
|
|
.empty
|
|
|
|
jp BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
; e29d0 (38:69d0)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
MovePkmnWithoutMail_DPad: ; e29d0
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyLast
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsOnScreen]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .check_left_right
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressUp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressDown
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.check_left_right
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressLeft
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressRight
|
|
|
|
jr BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
MovePkmnWithoutMail_DPad_2: ; e29f4
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyLast
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsOnScreen]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld d, a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .check_left_right
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressUp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressDown
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.check_left_right
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressLeft
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, BillsPC_PressRight
|
|
|
|
jr BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PressUp: ; e2a18 (38:6a18)
|
|
|
|
ld hl, wBillsPC_CursorPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .top
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_UpDownDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.top
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_UpDownDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PressDown: ; e2a2c (38:6a2c)
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
inc a
|
|
|
|
cp e
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nc, BillsPC_JoypadDidNothing
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, wBillsPC_CursorPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
cp d
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nc, .not_bottom
|
2015-11-12 04:38:57 +00:00
|
|
|
inc [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_UpDownDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.not_bottom
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
inc [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_UpDownDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2a48 (38:6a48)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PressLeft: ; e2a48
|
|
|
|
ld hl, wBillsPC_LoadedBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .wrap_around
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_LeftRightDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.wrap_around
|
|
|
|
ld [hl], NUM_BOXES
|
|
|
|
jr BillsPC_LeftRightDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PressRight: ; e2a56
|
|
|
|
ld hl, wBillsPC_LoadedBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
cp NUM_BOXES
|
|
|
|
jr z, .wrap_around
|
2015-11-12 04:38:57 +00:00
|
|
|
inc [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr BillsPC_LeftRightDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.wrap_around
|
|
|
|
ld [hl], 0
|
|
|
|
jr BillsPC_LeftRightDidSomething
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_JoypadDidNothing: ; e2a65 (38:6a65)
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_UpDownDidSomething: ; e2a68 (38:6a68)
|
|
|
|
ld a, TRUE
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; e2a6c (38:6a6c)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_LeftRightDidSomething: ; e2a6c
|
2015-11-12 04:38:57 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; e2a6e
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PlaceString: ; e2a6e (38:6a6e)
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
pop de
|
|
|
|
hlcoord 1, 16
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e2a80 (38:6a80)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_MoveMonWOMail_BoxNameAndArrows: ; e2a80
|
|
|
|
call BillsPC_BoxName
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 8, 1
|
|
|
|
ld [hl], $5f
|
|
|
|
hlcoord 19, 1
|
|
|
|
ld [hl], $5e
|
|
|
|
ret
|
|
|
|
; e2a8e
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_BoxName: ; e2a8e (38:6a8e)
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 8, 0
|
|
|
|
lb bc, 1, 10
|
|
|
|
call TextBox
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
jr z, .party
|
|
|
|
|
|
|
|
cp NUM_BOXES + 1
|
|
|
|
jr nz, .gotbox
|
|
|
|
|
|
|
|
ld a, [wCurBox]
|
|
|
|
inc a
|
|
|
|
.gotbox
|
|
|
|
dec a
|
|
|
|
ld hl, wBoxNames
|
|
|
|
ld bc, BOX_NAME_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
jr .print
|
|
|
|
|
|
|
|
.party
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, .PartyPKMN
|
2015-11-12 04:38:57 +00:00
|
|
|
.print
|
|
|
|
hlcoord 10, 1
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e2abd (38:6abd)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PartyPKMN:
|
2015-11-12 04:38:57 +00:00
|
|
|
db "PARTY <PK><MN>@"
|
|
|
|
; e2ac6
|
|
|
|
|
|
|
|
PCMonInfo: ; e2ac6 (38:6ac6)
|
|
|
|
; Display a monster's pic and
|
|
|
|
; attributes when highlighting
|
|
|
|
; it in a PC menu.
|
|
|
|
|
|
|
|
; Includes the neat cascading
|
|
|
|
; effect when showing the pic.
|
|
|
|
|
|
|
|
; Example: Species, level, gender,
|
|
|
|
; whether it's holding an item.
|
|
|
|
|
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 15, 8
|
|
|
|
call ClearBox
|
|
|
|
|
|
|
|
hlcoord 8, 14
|
|
|
|
lb bc, 1, 3
|
|
|
|
call ClearBox
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret z
|
|
|
|
|
|
|
|
ld [wd265], a
|
|
|
|
hlcoord 1, 4
|
|
|
|
xor a
|
|
|
|
ld b, 7
|
2015-12-16 17:32:08 +00:00
|
|
|
.row
|
2015-11-12 04:38:57 +00:00
|
|
|
ld c, 7
|
|
|
|
push af
|
|
|
|
push hl
|
2015-12-16 17:32:08 +00:00
|
|
|
.col
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hli], a
|
|
|
|
add 7
|
|
|
|
dec c
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .col
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, SCREEN_WIDTH
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
pop af
|
|
|
|
inc a
|
|
|
|
dec b
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .row
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_LoadMonStats
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wd265]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld [CurSpecies], a
|
|
|
|
ld hl, TempMonDVs
|
|
|
|
predef GetUnownLetter
|
|
|
|
call GetBaseData
|
|
|
|
ld de, VTiles2 tile $00
|
|
|
|
predef GetFrontpic
|
|
|
|
xor a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_MonHasMail], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
ld [wd265], a
|
|
|
|
cp EGG
|
|
|
|
ret z
|
|
|
|
|
|
|
|
call GetBasePokemonName
|
|
|
|
hlcoord 1, 14
|
|
|
|
call PlaceString
|
|
|
|
|
|
|
|
hlcoord 1, 12
|
|
|
|
call PrintLevel
|
|
|
|
|
|
|
|
ld a, $3
|
|
|
|
ld [MonType], a
|
|
|
|
callba GetGender
|
2015-12-16 17:32:08 +00:00
|
|
|
jr c, .skip_gender
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, "♂"
|
|
|
|
jr nz, .printgender
|
|
|
|
ld a, "♀"
|
|
|
|
.printgender
|
|
|
|
hlcoord 5, 12
|
|
|
|
ld [hl], a
|
2015-12-16 17:32:08 +00:00
|
|
|
.skip_gender
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
ld a, [TempMonItem]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld d, a
|
|
|
|
callab ItemIsMail
|
|
|
|
jr c, .mail
|
|
|
|
ld a, $5d ; item icon
|
|
|
|
jr .printitem
|
|
|
|
.mail
|
|
|
|
ld a, $1
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_MonHasMail], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $5c ; mail icon
|
|
|
|
.printitem
|
|
|
|
hlcoord 7, 12
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_LoadMonStats: ; e2b6d (38:6b6d)
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2016-05-08 18:11:24 +00:00
|
|
|
ld hl, wBillsPCPokemonList + 1 ; box number
|
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .party
|
|
|
|
cp NUM_BOXES + 1
|
|
|
|
jr z, .sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld b, a
|
2015-11-18 04:29:14 +00:00
|
|
|
call GetBoxPointer
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, b
|
|
|
|
call GetSRAMBank
|
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMon1Level - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonLevel], a
|
|
|
|
pop hl
|
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMon1Item - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonItem], a
|
|
|
|
pop hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMon1DVs - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, TempMonDVs
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
|
|
|
.party
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMon1Level
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonLevel], a
|
|
|
|
ld hl, PartyMon1Item
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonItem], a
|
|
|
|
ld hl, PartyMon1DVs
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, TempMonDVs
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, BANK(sBox)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxMon1Level
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonLevel], a
|
|
|
|
|
|
|
|
ld hl, sBoxMon1Item
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
ld [TempMonItem], a
|
|
|
|
|
|
|
|
ld hl, sBoxMon1DVs
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, TempMonDVs
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c)
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 8, 2
|
|
|
|
lb bc, 10, 10
|
|
|
|
call TextBox
|
|
|
|
|
|
|
|
hlcoord 8, 2
|
|
|
|
ld [hl], "└"
|
|
|
|
hlcoord 19, 2
|
|
|
|
ld [hl], "┘"
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_ScrollPosition]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, wBillsPCPokemonList
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2016-05-08 18:11:24 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
hlcoord 9, 4
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsOnScreen]
|
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
push af
|
|
|
|
push de
|
|
|
|
push hl
|
2015-12-16 17:32:08 +00:00
|
|
|
call .PlaceNickname
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, 2 * SCREEN_WIDTH
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
inc de
|
2016-05-08 18:11:24 +00:00
|
|
|
inc de
|
|
|
|
inc de
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
|
|
|
dec a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e2c67 (38:6c67)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CancelString:
|
2015-11-12 04:38:57 +00:00
|
|
|
db "CANCEL@"
|
|
|
|
; e2c6e
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PlaceNickname: ; e2c6e (38:6c6e)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
|
|
|
jr nz, .get_nickname
|
|
|
|
ld de, .CancelString
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.get_nickname
|
2015-11-12 04:38:57 +00:00
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld b, a
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld e, a
|
|
|
|
ld a, b
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .party
|
|
|
|
cp NUM_BOXES + 1
|
|
|
|
jr z, .sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
call GetBoxPointer
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, b
|
|
|
|
call GetSRAMBank
|
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMons - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .boxfail
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMonNicknames - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, StringBuffer1
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
pop hl
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.boxfail
|
2015-11-12 04:38:57 +00:00
|
|
|
call CloseSRAM
|
|
|
|
pop hl
|
2015-12-16 17:32:08 +00:00
|
|
|
jr .placeholder_string
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.party
|
2015-11-12 04:38:57 +00:00
|
|
|
push hl
|
|
|
|
ld hl, PartySpecies
|
|
|
|
ld d, $0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .partyfail
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMonNicknames
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, StringBuffer1
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.partyfail
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
2015-12-16 17:32:08 +00:00
|
|
|
jr .placeholder_string
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
push hl
|
|
|
|
ld a, BANK(sBox)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxSpecies
|
|
|
|
ld d, $0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .sBoxFail
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMonNicknames
|
|
|
|
ld bc, PKMN_NAME_LENGTH
|
|
|
|
ld a, e
|
|
|
|
call AddNTimes
|
|
|
|
ld de, StringBuffer1
|
|
|
|
ld bc, PKMN_NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
pop hl
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.sBoxFail
|
2015-11-12 04:38:57 +00:00
|
|
|
call CloseSRAM
|
|
|
|
pop hl
|
2015-12-16 17:32:08 +00:00
|
|
|
.placeholder_string
|
|
|
|
ld de, .Placeholder
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e2d2a (38:6d2a)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Placeholder:
|
2015-11-12 04:38:57 +00:00
|
|
|
db "-----@"
|
|
|
|
; e2d30
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
copy_box_data: MACRO
|
|
|
|
.loop\@
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
|
|
|
jr z, .done\@
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .done\@
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [wd003]
|
|
|
|
ld [de], a
|
|
|
|
inc a
|
|
|
|
ld [wd003], a
|
|
|
|
inc de
|
|
|
|
inc hl
|
|
|
|
ld a, [wd004]
|
|
|
|
inc a
|
|
|
|
ld [wd004], a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr .loop\@
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.done\@
|
|
|
|
IF \1
|
2015-11-12 04:38:57 +00:00
|
|
|
call CloseSRAM
|
2015-12-16 17:32:08 +00:00
|
|
|
ENDC
|
|
|
|
ld a, -1
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [de], a
|
|
|
|
ld a, [wd004]
|
|
|
|
inc a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld [wBillsPC_NumMonsInBox], a
|
|
|
|
endm
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
CopyBoxmonSpecies: ; e2d30 (38:6d30)
|
|
|
|
xor a
|
|
|
|
ld hl, wBillsPCPokemonList
|
|
|
|
ld bc, 3 * 30
|
|
|
|
call ByteFill
|
|
|
|
ld de, wBillsPCPokemonList
|
|
|
|
xor a
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wd003], a
|
|
|
|
ld [wd004], a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_LoadedBox]
|
|
|
|
and a
|
|
|
|
jr z, .party
|
|
|
|
cp NUM_BOXES + 1
|
|
|
|
jr z, .sBox
|
|
|
|
ld b, a
|
|
|
|
call GetBoxPointer
|
|
|
|
ld a, b
|
|
|
|
call GetSRAMBank
|
|
|
|
inc hl
|
|
|
|
copy_box_data 1
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.party
|
|
|
|
ld hl, PartySpecies
|
|
|
|
copy_box_data 0
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, BANK(sBox)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxSpecies
|
2015-12-16 17:32:08 +00:00
|
|
|
copy_box_data 1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def)
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, wBillsPCPokemonList
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, de
|
2016-05-08 18:11:24 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01)
|
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .place_cursor
|
2015-11-12 04:38:57 +00:00
|
|
|
call ClearSprites
|
|
|
|
ret
|
2015-11-18 04:29:14 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.place_cursor
|
|
|
|
ld hl, .OAM
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, Sprites
|
2015-11-18 04:29:14 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
2015-11-12 04:38:57 +00:00
|
|
|
and $7
|
|
|
|
swap a
|
|
|
|
add [hl]
|
|
|
|
inc hl
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-16 17:32:08 +00:00
|
|
|
rept 3
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-16 17:32:08 +00:00
|
|
|
endr
|
2015-11-18 04:29:14 +00:00
|
|
|
jr .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2e2b (38:6e2b)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.OAM: ; e2e2b
|
|
|
|
dsprite 4, 6, 10, 0, $00, $00
|
|
|
|
dsprite 4, 6, 11, 0, $00, $00
|
|
|
|
dsprite 4, 6, 12, 0, $00, $00
|
|
|
|
dsprite 4, 6, 13, 0, $00, $00
|
|
|
|
dsprite 4, 6, 14, 0, $00, $00
|
|
|
|
dsprite 4, 6, 15, 0, $00, $00
|
|
|
|
dsprite 4, 6, 16, 0, $00, $00
|
|
|
|
dsprite 4, 6, 17, 0, $00, $00
|
|
|
|
dsprite 4, 6, 18, 0, $00, $00
|
|
|
|
dsprite 4, 6, 18, 7, $00, $00
|
|
|
|
dsprite 7, 1, 10, 0, $00, $40
|
|
|
|
dsprite 7, 1, 11, 0, $00, $40
|
|
|
|
dsprite 7, 1, 12, 0, $00, $40
|
|
|
|
dsprite 7, 1, 13, 0, $00, $40
|
|
|
|
dsprite 7, 1, 14, 0, $00, $40
|
|
|
|
dsprite 7, 1, 15, 0, $00, $40
|
|
|
|
dsprite 7, 1, 16, 0, $00, $40
|
|
|
|
dsprite 7, 1, 17, 0, $00, $40
|
|
|
|
dsprite 7, 1, 18, 0, $00, $40
|
|
|
|
dsprite 7, 1, 18, 7, $00, $40
|
|
|
|
dsprite 5, 6, 9, 6, $01, $00
|
|
|
|
dsprite 6, 1, 9, 6, $01, $40
|
|
|
|
dsprite 5, 6, 19, 1, $01, $20
|
|
|
|
dsprite 6, 1, 19, 1, $01, $60
|
|
|
|
db -1
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2e8c
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_UpdateInsertCursor: ; e2e8c
|
|
|
|
ld hl, .OAM
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, Sprites
|
2015-12-16 17:32:08 +00:00
|
|
|
.loop
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
cp -1
|
2015-11-12 04:38:57 +00:00
|
|
|
ret z
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
2015-11-12 04:38:57 +00:00
|
|
|
and $7
|
|
|
|
swap a
|
|
|
|
add [hl]
|
|
|
|
inc hl
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-16 17:32:08 +00:00
|
|
|
rept 3
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-16 17:32:08 +00:00
|
|
|
endr
|
|
|
|
jr .loop
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2eac
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.OAM: ; e2eac
|
|
|
|
dsprite 4, 7, 10, 0, $06, $00
|
|
|
|
dsprite 5, 3, 11, 0, $00, $40
|
|
|
|
dsprite 5, 3, 12, 0, $00, $40
|
|
|
|
dsprite 5, 3, 13, 0, $00, $40
|
|
|
|
dsprite 5, 3, 14, 0, $00, $40
|
|
|
|
dsprite 5, 3, 15, 0, $00, $40
|
|
|
|
dsprite 5, 3, 16, 0, $00, $40
|
|
|
|
dsprite 5, 3, 17, 0, $00, $40
|
|
|
|
dsprite 5, 3, 18, 0, $00, $40
|
|
|
|
dsprite 4, 7, 19, 0, $07, $00
|
|
|
|
db -1
|
2015-11-12 04:38:57 +00:00
|
|
|
; e2ed5
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_UnusedFillBox: ; e2ed5
|
|
|
|
.row
|
2015-11-12 04:38:57 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-16 17:32:08 +00:00
|
|
|
.col
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .col
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .row
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e2ee5
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_CheckSpaceInDestination: ; e2ee5
|
|
|
|
; If moving within a box, no need to be here.
|
|
|
|
ld hl, wBillsPC_LoadedBox
|
|
|
|
ld a, [wBillsPC_BackupLoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .same_box
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
; Exceeding box or party capacity is a big no-no.
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
|
|
|
and a
|
|
|
|
jr z, .party
|
|
|
|
ld e, MONS_PER_BOX + 1
|
|
|
|
jr .compare
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.party
|
|
|
|
ld e, PARTY_LENGTH + 1
|
|
|
|
.compare
|
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp e
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nc, .no_room
|
|
|
|
.same_box
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.no_room
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_TheresNoRoom
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; e2f18
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18)
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
jr nz, .Okay
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_NumMonsInBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $3
|
|
|
|
jr c, .ItsYourLastPokemon
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
callba CheckCurPartyMonFainted
|
|
|
|
jr c, .AllOthersFainted
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_MonHasMail]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
jr nz, .HasMail
|
2016-04-10 18:42:14 +00:00
|
|
|
.Okay:
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.HasMail:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_RemoveMail
|
|
|
|
jr .NotOkay
|
2015-12-16 17:32:08 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.AllOthersFainted:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_NoMoreUsablePKMN
|
|
|
|
jr .NotOkay
|
2015-12-16 17:32:08 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.ItsYourLastPokemon:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_ItsYourLastPKMN
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotOkay:
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
cp EGG
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .egg
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
2015-12-16 17:32:08 +00:00
|
|
|
|
|
|
|
.egg
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_NoReleasingEGGS
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_StatsScreen: ; e2f7e (38:6f7e)
|
2015-11-12 04:38:57 +00:00
|
|
|
call LowVolume
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_CopyMon
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $3
|
|
|
|
ld [MonType], a
|
|
|
|
predef StatsScreenInit
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_InitGFX
|
2015-11-12 04:38:57 +00:00
|
|
|
call MaxVolume
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
StatsScreenDPad: ; e2f95 (38:6f95)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, hJoyPressed ; $ffa7
|
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuJoypad], a
|
2015-11-12 04:38:57 +00:00
|
|
|
jr nz, .pressed_a_b_right_left
|
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN | D_UP
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuJoypad], a
|
2015-11-12 04:38:57 +00:00
|
|
|
jr nz, .pressed_down_up
|
|
|
|
jr .pressed_a_b_right_left
|
|
|
|
|
|
|
|
.pressed_down_up
|
2015-12-16 17:32:08 +00:00
|
|
|
call _StatsScreenDPad
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .did_nothing
|
|
|
|
call BillsPC_GetSelectedPokemonSpecies
|
2015-11-12 04:38:57 +00:00
|
|
|
ld [wd265], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_LoadMonStats
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [wd265]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld [CurSpecies], a
|
|
|
|
ld hl, TempMonDVs
|
|
|
|
predef GetUnownLetter
|
|
|
|
call GetBaseData
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_CopyMon
|
2015-11-12 04:38:57 +00:00
|
|
|
.pressed_a_b_right_left
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.did_nothing
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuJoypad], a
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_CopyMon: ; e2fd6 (38:6fd6)
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .party
|
|
|
|
cp NUM_BOXES + 1
|
|
|
|
jr nz, .box
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, BANK(sBox)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxSpecies
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopySpeciesToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMonNicknames
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyNicknameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMonOT
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyOTNameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMons
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, wBufferMon
|
2015-11-12 04:38:57 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
2015-12-16 17:32:08 +00:00
|
|
|
callba CalcwBufferMonStats
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.party
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartySpecies
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopySpeciesToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMonNicknames
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyNicknameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMonOT
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyOTNameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, wBufferMon
|
2015-11-12 04:38:57 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.box
|
2015-11-12 04:38:57 +00:00
|
|
|
ld b, a
|
2015-11-18 04:29:14 +00:00
|
|
|
call GetBoxPointer
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, b
|
|
|
|
call GetSRAMBank
|
|
|
|
push hl
|
|
|
|
inc hl
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopySpeciesToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMonNicknames - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyNicknameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
|
|
|
push hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMonOT - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyOTNameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
pop hl
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, sBoxMons - sBox
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
call CopyMonToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
call CloseSRAM
|
2015-12-16 17:32:08 +00:00
|
|
|
callba CalcwBufferMonStats
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
DepositPokemon: ; e307c (38:707c)
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld hl, PartyMonNicknames
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call GetNick
|
|
|
|
ld a, PC_DEPOSIT
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
|
|
|
predef SentGetPkmnIntoFromBox
|
|
|
|
jr c, .asm_boxisfull
|
|
|
|
xor a
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
call PlayCry
|
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 15, 8
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 8, 14
|
|
|
|
lb bc, 1, 3
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
call WaitBGMap
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld de, PCString_Stored
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ld a, "!"
|
|
|
|
ld [bc], a
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_boxisfull
|
|
|
|
ld de, PCString_BoxFull
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
TryWithdrawPokemon: ; e30fa (38:70fa)
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld a, BANK(sBoxMonNicknames)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
ld hl, sBoxMonNicknames
|
|
|
|
call GetNick
|
|
|
|
call CloseSRAM
|
|
|
|
xor a
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
|
|
|
predef SentGetPkmnIntoFromBox
|
|
|
|
jr c, .PartyFull
|
|
|
|
ld a, PC_DEPOSIT
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
call PlayCry
|
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 15, 8
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 8, 14
|
|
|
|
lb bc, 1, 3
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
call WaitBGMap
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld de, PCString_Got
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ld a, $e7
|
|
|
|
ld [bc], a
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.PartyFull:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, PCString_PartyFull
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
ReleasePKMN_ByePKMN: ; e3180 (38:7180)
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 0, 0
|
|
|
|
lb bc, 15, 8
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 8, 14
|
|
|
|
lb bc, 1, 3
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
|
|
|
|
call WaitBGMap
|
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
call GetCryIndex
|
2015-12-16 17:32:08 +00:00
|
|
|
jr c, .skip_cry
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, c
|
|
|
|
ld d, b
|
|
|
|
call PlayCryHeader
|
2015-12-16 17:32:08 +00:00
|
|
|
.skip_cry
|
2015-11-12 04:38:57 +00:00
|
|
|
|
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld de, PCString_ReleasedPKMN
|
|
|
|
call PlaceString
|
|
|
|
ld c, 80
|
|
|
|
call DelayFrames
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld de, PCString_Bye
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
inc hl
|
|
|
|
ld de, StringBuffer1
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
ld [hl], $e7
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
; e31e7 (38:71e7)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
MovePKMNWitoutMail_InsertMon: ; e31e7
|
2015-11-12 04:38:57 +00:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
hlcoord 0, 15
|
|
|
|
lb bc, 1, 18
|
|
|
|
call TextBox
|
|
|
|
hlcoord 1, 16
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, .Saving_LeaveOn
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
ld c, 20
|
|
|
|
call DelayFrames
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ld a, [wCurBox]
|
|
|
|
push af
|
|
|
|
ld bc, 0
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_BackupLoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .moving_from_box
|
2015-11-12 04:38:57 +00:00
|
|
|
set 0, c
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.moving_from_box
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr nz, .moving_to_box
|
2015-11-12 04:38:57 +00:00
|
|
|
set 1, c
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.moving_to_box
|
|
|
|
ld hl, .Jumptable
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, bc
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-27 02:59:03 +00:00
|
|
|
ld de, .dw_return
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-12 04:38:57 +00:00
|
|
|
; e322a
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.dw_return ; e322a
|
2015-11-12 04:38:57 +00:00
|
|
|
pop af
|
|
|
|
ld e, a
|
2016-05-12 01:19:52 +00:00
|
|
|
callba MovePkmnWOMail_InsertMon_SaveGame
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3233
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Saving_LeaveOn:
|
2015-11-12 04:38:57 +00:00
|
|
|
db "Saving… Leave ON!@"
|
|
|
|
; e3245
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Jumptable: ; e3245
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2015-12-27 02:59:03 +00:00
|
|
|
dw .BoxToBox
|
|
|
|
dw .PartyToBox
|
|
|
|
dw .BoxToParty
|
|
|
|
dw .PartyToParty
|
2015-11-12 04:38:57 +00:00
|
|
|
; e324d
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.BoxToBox: ; e324d
|
|
|
|
ld hl, wBillsPC_BackupLoadedBox
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp [hl]
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .same_box
|
|
|
|
call .CopyFromBox
|
|
|
|
call .CopyToBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.same_box
|
|
|
|
call .CopyFromBox
|
|
|
|
call .CheckTrivialMove
|
|
|
|
call .CopyToBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3267
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PartyToBox: ; e3267
|
|
|
|
call .CopyFromParty
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, $1
|
2016-05-08 18:11:24 +00:00
|
|
|
ld [wGameLogicPaused], a
|
2015-11-12 04:38:57 +00:00
|
|
|
callba SaveGameData
|
|
|
|
xor a
|
2016-05-08 18:11:24 +00:00
|
|
|
ld [wGameLogicPaused], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call .CopyToBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e327d
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.BoxToParty: ; e327d
|
|
|
|
call .CopyFromBox
|
|
|
|
call .CopyToParty
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3284
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.PartyToParty: ; e3284
|
|
|
|
call .CopyFromParty
|
|
|
|
call .CheckTrivialMove
|
|
|
|
call .CopyToParty
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e328e
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CheckTrivialMove: ; e328e
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld e, a
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_BackupCursorPosition]
|
|
|
|
ld hl, wBillsPC_BackupScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
cp e
|
|
|
|
ret nc
|
2015-12-16 17:32:08 +00:00
|
|
|
ld hl, wBillsPC_CursorPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-16 17:32:08 +00:00
|
|
|
jr z, .top_of_screen
|
2015-11-12 04:38:57 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.top_of_screen
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
; e32b0
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CopyFromBox: ; e32b0
|
|
|
|
ld a, [wBillsPC_BackupLoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
ld e, a
|
2015-11-18 04:29:14 +00:00
|
|
|
callba MovePkmnWOMail_SaveGame
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_BackupCursorPosition]
|
|
|
|
ld hl, wBillsPC_BackupScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld a, $1
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxSpecies
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopySpeciesToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMonNicknames
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyNicknameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMonOT
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyOTNameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, sBoxMons
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyMonToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
call CloseSRAM
|
2015-12-16 17:32:08 +00:00
|
|
|
callba CalcwBufferMonStats
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, PC_DEPOSIT
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e32fa
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CopyToBox: ; e32fa
|
|
|
|
ld a, [wBillsPC_LoadedBox]
|
2015-11-12 04:38:57 +00:00
|
|
|
dec a
|
|
|
|
ld e, a
|
2015-11-18 04:29:14 +00:00
|
|
|
callba MovePkmnWOMail_SaveGame
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
2016-05-04 15:46:23 +00:00
|
|
|
callba InsertPokemonIntoBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3316
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CopyFromParty: ; e3316
|
|
|
|
ld a, [wBillsPC_BackupCursorPosition]
|
|
|
|
ld hl, wBillsPC_BackupScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld hl, PartySpecies
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopySpeciesToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMonNicknames
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyNicknameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMonOT
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyOTNameToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, PartyMon1Species
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-18 04:29:14 +00:00
|
|
|
call CopyMonToTemp
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-14 01:33:56 +00:00
|
|
|
callba RemoveMonFromPartyOrBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3346
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.CopyToParty: ; e3346
|
|
|
|
ld a, [wBillsPC_CursorPosition]
|
|
|
|
ld hl, wBillsPC_ScrollPosition
|
2015-11-12 04:38:57 +00:00
|
|
|
add [hl]
|
|
|
|
ld [CurPartyMon], a
|
2016-05-04 15:46:23 +00:00
|
|
|
callba InsertPokemonIntoParty
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
; e3357
|
|
|
|
|
2015-11-18 04:29:14 +00:00
|
|
|
CopySpeciesToTemp: ; e3357 (38:7357)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ret
|
|
|
|
|
2015-11-18 04:29:14 +00:00
|
|
|
CopyNicknameToTemp: ; e3363 (38:7363)
|
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, wBufferMonNick
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2015-11-18 04:29:14 +00:00
|
|
|
CopyOTNameToTemp: ; e3376 (38:7376)
|
|
|
|
ld bc, NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, wBufferMonOT
|
2015-11-18 04:29:14 +00:00
|
|
|
ld bc, NAME_LENGTH
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2015-11-18 04:29:14 +00:00
|
|
|
CopyMonToTemp: ; e3389 (38:7389)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, wBufferMon
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2015-11-18 04:29:14 +00:00
|
|
|
GetBoxPointer: ; e3396 (38:7396)
|
2015-11-12 04:38:57 +00:00
|
|
|
dec b
|
|
|
|
ld c, b
|
|
|
|
ld b, 0
|
2015-11-18 04:29:14 +00:00
|
|
|
ld hl, .boxes
|
2015-11-12 04:38:57 +00:00
|
|
|
add hl, bc
|
2016-05-08 18:11:24 +00:00
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ret
|
|
|
|
; e33a6 (38:73a6)
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.boxes ; e33a6
|
2015-11-12 04:38:57 +00:00
|
|
|
; bank, address
|
|
|
|
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
|
|
|
|
; e33d0
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_ApplyPalettes: ; e33d0 (38:73d0)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld b, a
|
|
|
|
call GetSGBLayout
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, %11100100
|
2015-11-12 04:38:57 +00:00
|
|
|
call DmgToCgbBGPals
|
2015-12-16 17:32:08 +00:00
|
|
|
ld a, %11111100
|
2015-12-09 16:38:40 +00:00
|
|
|
call DmgToCgbObjPal0
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_Jumptable: ; e33df (38:73df)
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_InitGFX: ; e33e8 (38:73e8)
|
2015-11-12 04:38:57 +00:00
|
|
|
call DisableLCD
|
|
|
|
ld hl, VTiles2 tile $00
|
2015-12-16 17:32:08 +00:00
|
|
|
ld bc, $31 tiles
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
call LoadStandardFont
|
|
|
|
call LoadFontsBattleExtra
|
|
|
|
ld hl, PCMailGFX
|
|
|
|
ld de, VTiles2 tile $5c
|
2015-12-16 17:32:08 +00:00
|
|
|
ld bc, 4 tiles
|
2015-11-12 04:38:57 +00:00
|
|
|
call CopyBytes
|
|
|
|
ld hl, PCSelectLZ
|
|
|
|
ld de, VTiles0 tile $00
|
|
|
|
call Decompress
|
|
|
|
ld a, 6
|
|
|
|
call SkipMusic
|
|
|
|
call EnableLCD
|
|
|
|
ret
|
|
|
|
; e3419 (38:7419)
|
|
|
|
|
|
|
|
PCSelectLZ: INCBIN "gfx/pc.2bpp.lz"
|
|
|
|
PCMailGFX: INCBIN "gfx/pc_mail.2bpp"
|
|
|
|
; e34dd
|
|
|
|
|
|
|
|
PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
|
|
|
|
PCString_WhatsUp: db "What's up?@"
|
|
|
|
PCString_ReleasePKMN: db "Release <PK><MN>?@"
|
|
|
|
PCString_MoveToWhere: db "Move to where?@"
|
|
|
|
PCString_ItsYourLastPKMN: db "It's your last <PK><MN>!@"
|
|
|
|
PCString_TheresNoRoom: db "There's no room!@"
|
|
|
|
PCString_NoMoreUsablePKMN: db "No more usable <PK><MN>!@"
|
|
|
|
PCString_RemoveMail: db "Remove MAIL.@"
|
|
|
|
PCString_ReleasedPKMN: db "Released <PK><MN>.@"
|
|
|
|
PCString_Bye: db "Bye,@"
|
|
|
|
PCString_Stored: db "Stored @"
|
|
|
|
PCString_Got: db "Got @"
|
|
|
|
PCString_Non: db "Non.@"
|
|
|
|
PCString_BoxFull: db "The BOX is full.@"
|
|
|
|
PCString_PartyFull: db "The party's full!@"
|
|
|
|
PCString_NoReleasingEGGS: db "No releasing EGGS!@"
|
|
|
|
; e35aa
|
|
|
|
|
|
|
|
|
|
|
|
_ChangeBox: ; e35aa (38:75aa)
|
|
|
|
call LoadStandardMenuDataHeader
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ClearTilemap
|
2015-11-12 04:38:57 +00:00
|
|
|
.loop
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PrintBoxName
|
|
|
|
call BillsPC_PlaceChooseABoxString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld hl, _ChangeBox_menudataheader
|
|
|
|
call CopyMenuDataHeader
|
|
|
|
xor a
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wMenuScrollPosition], a
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 0, 4
|
|
|
|
lb bc, 8, 9
|
|
|
|
call TextBox
|
2015-12-18 03:31:16 +00:00
|
|
|
call ScrollingMenu
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuJoypad]
|
2015-12-16 17:32:08 +00:00
|
|
|
cp B_BUTTON
|
2015-11-12 04:38:57 +00:00
|
|
|
jr z, .done
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceWhatsUpString
|
|
|
|
call BillsPC_ChangeBoxSubmenu
|
2015-11-12 04:38:57 +00:00
|
|
|
jr .loop
|
|
|
|
.done
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_ClearTilemap: ; e35e2 (38:75e2)
|
2015-11-12 04:38:57 +00:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
; e35f1 (38:75f1)
|
|
|
|
|
|
|
|
_ChangeBox_menudataheader: ; 0xe35f1
|
|
|
|
db $40 ; flags
|
|
|
|
db 05, 01 ; start coords
|
|
|
|
db 12, 09 ; end coords
|
|
|
|
dw .menudata2
|
|
|
|
db 1 ; default option
|
|
|
|
; 0xe35f9
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.menudata2 ; 0xe35f9
|
2015-11-12 04:38:57 +00:00
|
|
|
db $22 ; flags
|
|
|
|
db 4, 0
|
|
|
|
db 1
|
|
|
|
dba .boxes
|
|
|
|
dba .boxnames
|
|
|
|
dba NULL
|
2015-12-16 17:32:08 +00:00
|
|
|
dba BillsPC_PrintBoxCountAndCapacity
|
2015-11-12 04:38:57 +00:00
|
|
|
; e3609
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.boxes ; e3609
|
2015-11-12 04:38:57 +00:00
|
|
|
db NUM_BOXES
|
|
|
|
x = 1
|
|
|
|
rept NUM_BOXES
|
|
|
|
db x
|
|
|
|
x = x + 1
|
|
|
|
endr
|
|
|
|
db -1
|
|
|
|
; e3619
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.boxnames ; e3619
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
call GetBoxName
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e3626
|
|
|
|
|
|
|
|
GetBoxName: ; e3626 (38:7626)
|
|
|
|
ld bc, BOX_NAME_LENGTH
|
|
|
|
ld hl, wBoxNames
|
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ret
|
|
|
|
; e3632 (38:7632)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PrintBoxCountAndCapacity: ; e3632
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 11, 7
|
|
|
|
lb bc, 5, 7
|
|
|
|
call TextBox
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
cp -1
|
|
|
|
ret z
|
|
|
|
hlcoord 12, 9
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, .Pokemon
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
call GetBoxCount
|
|
|
|
ld [wd265], a
|
|
|
|
hlcoord 13, 11
|
|
|
|
ld de, wd265
|
|
|
|
lb bc, 1, 2
|
|
|
|
call PrintNum
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, .out_of_20
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e3663
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Pokemon: ; e3663
|
2015-11-12 04:38:57 +00:00
|
|
|
db "#MON@"
|
|
|
|
; e3668
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.out_of_20 ; e3668
|
2015-11-12 04:38:57 +00:00
|
|
|
; db "/20@"
|
|
|
|
db "/"
|
|
|
|
db "0" + MONS_PER_BOX / 10 ; "2"
|
|
|
|
db "0" + MONS_PER_BOX % 10 ; "0"
|
|
|
|
db "@"
|
|
|
|
; e366c
|
|
|
|
|
|
|
|
GetBoxCount: ; e366c (38:766c)
|
|
|
|
ld a, [wCurBox]
|
|
|
|
ld c, a
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
cp c
|
|
|
|
jr z, .activebox
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, .boxbanks
|
|
|
|
add hl, bc
|
2016-05-08 18:11:24 +00:00
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
call GetSRAMBank
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [hl]
|
|
|
|
call CloseSRAM
|
|
|
|
ld c, a
|
|
|
|
ld a, [wSavedAtLeastOnce]
|
|
|
|
and a
|
|
|
|
jr z, .newfile
|
|
|
|
ld a, c
|
|
|
|
ret
|
|
|
|
|
|
|
|
.newfile
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.activebox
|
|
|
|
ld a, BANK(sBoxCount)
|
|
|
|
ld b, a
|
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sBoxCount
|
|
|
|
ld a, [hl]
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
; e36a5 (38:76a5)
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.boxbanks ; e36a5
|
2015-11-12 04:38:57 +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
|
|
|
|
; e36cf
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PrintBoxName: ; e36cf (38:76cf)
|
2015-11-12 04:38:57 +00:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld b, 2
|
|
|
|
ld c, 18
|
|
|
|
call TextBox
|
|
|
|
hlcoord 1, 2
|
2015-12-16 17:32:08 +00:00
|
|
|
ld de, .Current
|
2015-11-12 04:38:57 +00:00
|
|
|
call PlaceString
|
|
|
|
ld a, [wCurBox]
|
|
|
|
and $f
|
|
|
|
call GetBoxName
|
|
|
|
hlcoord 11, 2
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; e36f1 (38:76f1)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.Current: ; e36f1
|
2015-11-12 04:38:57 +00:00
|
|
|
db "CURRENT@"
|
|
|
|
; e36f9
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9)
|
2015-11-23 05:21:21 +00:00
|
|
|
ld hl, .MenuDataHeader
|
2015-11-12 04:38:57 +00:00
|
|
|
call LoadMenuDataHeader
|
2015-12-15 23:59:49 +00:00
|
|
|
call VerticalMenu
|
2015-11-12 04:38:57 +00:00
|
|
|
call ExitMenu
|
|
|
|
ret c
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $1
|
2015-11-23 05:21:21 +00:00
|
|
|
jr z, .Switch
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $2
|
2015-11-23 05:21:21 +00:00
|
|
|
jr z, .Name
|
2015-11-12 04:38:57 +00:00
|
|
|
cp $3
|
2015-11-23 05:21:21 +00:00
|
|
|
jr z, .Print
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Print:
|
2015-11-12 04:38:57 +00:00
|
|
|
call GetBoxCount
|
|
|
|
and a
|
2015-11-23 05:21:21 +00:00
|
|
|
jr z, .EmptyBox
|
2015-11-12 04:38:57 +00:00
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
2015-11-23 05:21:21 +00:00
|
|
|
callba PrintPCBox
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_ClearTilemap
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.EmptyBox:
|
2015-12-16 17:32:08 +00:00
|
|
|
call BillsPC_PlaceEmptyBoxString_SFX
|
2015-11-12 04:38:57 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Switch:
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
ld e, a
|
|
|
|
ld a, [wCurBox]
|
|
|
|
cp e
|
|
|
|
ret z
|
2015-11-18 04:29:14 +00:00
|
|
|
callba ChangeBoxSaveGame
|
2015-11-12 04:38:57 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Name:
|
2015-11-23 05:21:21 +00:00
|
|
|
ld b, $4 ; box
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, wd002
|
|
|
|
callba NamingScreen
|
|
|
|
call ClearTileMap
|
|
|
|
call LoadStandardFont
|
|
|
|
call LoadFontsBattleExtra
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
call GetBoxName
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld hl, wd002
|
2015-12-16 17:32:08 +00:00
|
|
|
ld c, BOX_NAME_LENGTH - 1
|
2015-11-12 04:38:57 +00:00
|
|
|
call InitString
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
dec a
|
|
|
|
call GetBoxName
|
|
|
|
ld de, wd002
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
; e3778 (38:7778)
|
|
|
|
|
|
|
|
hlcoord 11, 7 ; XXX
|
|
|
|
|
2015-11-23 05:21:21 +00:00
|
|
|
.MenuDataHeader: ; 0xe377b
|
2015-11-12 04:38:57 +00:00
|
|
|
db $40 ; flags
|
|
|
|
db 04, 11 ; start coords
|
|
|
|
db 13, 19 ; end coords
|
2015-11-23 05:21:21 +00:00
|
|
|
dw .MenuData2
|
2015-11-12 04:38:57 +00:00
|
|
|
db 1 ; default option
|
|
|
|
; 0xe3783
|
|
|
|
|
2015-11-23 05:21:21 +00:00
|
|
|
.MenuData2: ; 0xe3783
|
2015-11-12 04:38:57 +00:00
|
|
|
db $80 ; flags
|
|
|
|
db 4 ; items
|
|
|
|
db "SWITCH@"
|
|
|
|
db "NAME@"
|
|
|
|
db "PRINT@"
|
|
|
|
db "QUIT@"
|
|
|
|
; 0xe379c
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PlaceChooseABoxString: ; e379c (38:779c)
|
|
|
|
ld de, .ChooseABox
|
|
|
|
jr BillsPC_PlaceChangeBoxString
|
2015-11-12 04:38:57 +00:00
|
|
|
; e37a1 (38:77a1)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.ChooseABox: ; e37a1
|
2015-11-12 04:38:57 +00:00
|
|
|
db "Choose a BOX.@"
|
|
|
|
; e37af
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PlaceWhatsUpString: ; e37af (38:77af)
|
|
|
|
ld de, .WhatsUp
|
|
|
|
jr BillsPC_PlaceChangeBoxString
|
2015-11-12 04:38:57 +00:00
|
|
|
; e37b4 (38:77b4)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.WhatsUp: ; e37b4
|
2015-11-12 04:38:57 +00:00
|
|
|
db "What's up?@"
|
|
|
|
; e37be
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be)
|
|
|
|
ld de, .NoMonString
|
|
|
|
call BillsPC_PlaceChangeBoxString
|
2015-11-12 04:38:57 +00:00
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
; e37d3 (38:77d3)
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
.NoMonString: ; e37d3
|
2015-11-12 04:38:57 +00:00
|
|
|
db "There's no #MON.@"
|
|
|
|
; e37e3
|
|
|
|
|
2015-12-16 17:32:08 +00:00
|
|
|
BillsPC_PlaceChangeBoxString: ; e37e3 (38:77e3)
|
2015-11-12 04:38:57 +00:00
|
|
|
push de
|
|
|
|
hlcoord 0, 14
|
|
|
|
lb bc, 2, 18
|
|
|
|
call TextBox
|
|
|
|
pop de
|
|
|
|
hlcoord 1, 16
|
|
|
|
call PlaceString
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ret
|