mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
11d67567d2
Added a bunch of constants for the bitflags of each kind of menu. Some are slightly vague or too long, but I'm not sure how to else name them.
389 lines
5.6 KiB
NASM
Executable File
389 lines
5.6 KiB
NASM
Executable File
_BillsPC: ; e3fd
|
|
call .CheckCanUsePC
|
|
ret c
|
|
call .LogIn
|
|
call .UseBillsPC
|
|
jp .LogOut
|
|
|
|
.CheckCanUsePC: ; e40a (3:640a)
|
|
ld a, [PartyCount]
|
|
and a
|
|
ret nz
|
|
ld hl, .Text_GottaHavePokemon
|
|
call MenuTextBoxBackup
|
|
scf
|
|
ret
|
|
|
|
.Text_GottaHavePokemon: ; 0xe417
|
|
; You gotta have #MON to call!
|
|
text_jump UnknownText_0x1c1006
|
|
db "@"
|
|
|
|
.LogIn: ; e41c (3:641c)
|
|
xor a
|
|
ld [hBGMapMode], a
|
|
call LoadStandardMenuDataHeader
|
|
call ClearPCItemScreen
|
|
ld hl, Options
|
|
ld a, [hl]
|
|
push af
|
|
set NO_TEXT_SCROLL, [hl]
|
|
ld hl, .Text_What
|
|
call PrintText
|
|
pop af
|
|
ld [Options], a
|
|
call LoadFontsBattleExtra
|
|
ret
|
|
|
|
.Text_What: ; 0xe43a
|
|
; What?
|
|
text_jump UnknownText_0x1c1024
|
|
db "@"
|
|
|
|
.LogOut: ; e43f (3:643f)
|
|
call CloseSubmenu
|
|
ret
|
|
|
|
.UseBillsPC: ; e443 (3:6443)
|
|
ld hl, .MenuDataHeader
|
|
call LoadMenuDataHeader
|
|
ld a, $1
|
|
.loop
|
|
ld [wMenuCursorBuffer], a
|
|
call SetPalettes
|
|
xor a
|
|
ld [wWhichIndexSet], a
|
|
ld [hBGMapMode], a
|
|
call DoNthMenu
|
|
jr c, .cancel
|
|
ld a, [wMenuCursorBuffer]
|
|
push af
|
|
ld a, [MenuSelection]
|
|
ld hl, .Jumptable
|
|
rst JumpTable
|
|
pop bc
|
|
ld a, b
|
|
jr nc, .loop
|
|
.cancel
|
|
call CloseWindow
|
|
ret
|
|
|
|
.MenuDataHeader: ; 0xe46f
|
|
db MENU_BACKUP_TILES ; flags
|
|
db 00, 00 ; start coords
|
|
db 17, 19 ; end coords
|
|
dw .MenuData2
|
|
db 1 ; default option
|
|
|
|
.MenuData2: ; 0xe477
|
|
db STATICMENU_CURSOR ; flags
|
|
db 0 ; items
|
|
dw .items
|
|
dw PlaceMenuStrings
|
|
dw .strings
|
|
|
|
.strings ; e47f
|
|
db "WITHDRAW <PK><MN>@"
|
|
db "DEPOSIT <PK><MN>@"
|
|
db "CHANGE BOX@"
|
|
db "MOVE <PK><MN> W/O MAIL@"
|
|
db "SEE YA!@"
|
|
|
|
.Jumptable: ; e4ba (3:64ba)
|
|
dw BillsPC_WithdrawMenu
|
|
dw BillsPC_DepositMenu
|
|
dw BillsPC_ChangeBoxMenu
|
|
dw BillsPC_MovePKMNMenu
|
|
dw BillsPC_SeeYa
|
|
|
|
.items ; e4c4
|
|
db 5
|
|
db 0 ; WITHDRAW
|
|
db 1; DEPOSIT
|
|
db 2 ; CHANGE BOX
|
|
db 3 ; MOVE PKMN
|
|
db 4 ; SEE YA!
|
|
db -1
|
|
|
|
BillsPC_SeeYa: ; e4cb
|
|
scf
|
|
ret
|
|
|
|
BillsPC_MovePKMNMenu: ; e4cd
|
|
call LoadStandardMenuDataHeader
|
|
farcall IsAnyMonHoldingMail
|
|
jr nc, .no_mail
|
|
ld hl, .Text_MonHoldingMail
|
|
call PrintText
|
|
jr .quit
|
|
|
|
.no_mail
|
|
farcall StartMovePkmnWOMail_SaveGame
|
|
jr c, .quit
|
|
farcall _MovePKMNWithoutMail
|
|
call ReturnToMapFromSubmenu
|
|
call ClearPCItemScreen
|
|
|
|
.quit
|
|
call CloseWindow
|
|
and a
|
|
ret
|
|
|
|
.Text_MonHoldingMail: ; 0xe4f9
|
|
; There is a #MON holding MAIL. Please remove the MAIL.
|
|
text_jump UnknownText_0x1c102b
|
|
db "@"
|
|
|
|
BillsPC_DepositMenu: ; e4fe (3:64fe)
|
|
call LoadStandardMenuDataHeader
|
|
farcall _DepositPKMN
|
|
call ReturnToMapFromSubmenu
|
|
call ClearPCItemScreen
|
|
call CloseWindow
|
|
and a
|
|
ret
|
|
|
|
Functione512: ; unused
|
|
ld a, [PartyCount]
|
|
and a
|
|
jr z, .no_pkmn
|
|
cp 2
|
|
jr c, .only_one_pkmn
|
|
and a
|
|
ret
|
|
|
|
.no_pkmn
|
|
ld hl, .Text_NoPKMN
|
|
call MenuTextBoxBackup
|
|
scf
|
|
ret
|
|
|
|
.only_one_pkmn
|
|
ld hl, .Text_ItsYourLastPKMN
|
|
call MenuTextBoxBackup
|
|
scf
|
|
ret
|
|
|
|
.Text_NoPKMN: ; 0xe52e
|
|
; You don't have a single #MON!
|
|
text_jump UnknownText_0x1c1062
|
|
db "@"
|
|
|
|
.Text_ItsYourLastPKMN: ; 0xe533
|
|
; You can't deposit your last #MON!
|
|
text_jump UnknownText_0x1c1080
|
|
db "@"
|
|
|
|
CheckCurPartyMonFainted: ; e538
|
|
ld hl, PartyMon1HP
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
|
ld b, $0
|
|
.loop
|
|
ld a, [CurPartyMon]
|
|
cp b
|
|
jr z, .skip
|
|
ld a, [hli]
|
|
or [hl]
|
|
jr nz, .notfainted
|
|
dec hl
|
|
|
|
.skip
|
|
inc b
|
|
ld a, [PartyCount]
|
|
cp b
|
|
jr z, .done
|
|
add hl, de
|
|
jr .loop
|
|
|
|
.done
|
|
scf
|
|
ret
|
|
|
|
.notfainted
|
|
and a
|
|
ret
|
|
|
|
BillsPC_WithdrawMenu: ; e559 (3:6559)
|
|
call LoadStandardMenuDataHeader
|
|
farcall _WithdrawPKMN
|
|
call ReturnToMapFromSubmenu
|
|
call ClearPCItemScreen
|
|
call CloseWindow
|
|
and a
|
|
ret
|
|
|
|
Functione56d: ; unused
|
|
ld a, [PartyCount]
|
|
cp PARTY_LENGTH
|
|
jr nc, .asm_e576
|
|
and a
|
|
ret
|
|
|
|
.asm_e576
|
|
ld hl, UnknownText_0xe57e
|
|
call MenuTextBoxBackup
|
|
scf
|
|
ret
|
|
|
|
UnknownText_0xe57e: ; 0xe57e
|
|
; You can't take any more #MON.
|
|
text_jump UnknownText_0x1c10a2
|
|
db "@"
|
|
|
|
BillsPC_ChangeBoxMenu: ; e583 (3:6583)
|
|
farcall _ChangeBox
|
|
and a
|
|
ret
|
|
|
|
ClearPCItemScreen: ; e58b
|
|
call DisableSpriteUpdates
|
|
xor a
|
|
ld [hBGMapMode], a
|
|
call ClearBGPalettes
|
|
call ClearSprites
|
|
hlcoord 0, 0
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
ld a, " "
|
|
call ByteFill
|
|
hlcoord 0, 0
|
|
lb bc, 10, 18
|
|
call TextBox
|
|
hlcoord 0, 12
|
|
lb bc, 4, 18
|
|
call TextBox
|
|
call WaitBGMap2
|
|
call SetPalettes ; load regular palettes?
|
|
ret
|
|
|
|
CopyBoxmonToTempMon: ; e5bb
|
|
ld a, [CurPartyMon]
|
|
ld hl, sBoxMon1Species
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
call AddNTimes
|
|
ld de, TempMonSpecies
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
ld a, BANK(sBoxMon1Species)
|
|
call GetSRAMBank
|
|
call CopyBytes
|
|
call CloseSRAM
|
|
ret
|
|
|
|
Functione5d9: ; unreferenced
|
|
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
|
|
call GetSRAMBank
|
|
ld a, [hl]
|
|
ld bc, 1 + MONS_PER_BOX + 1
|
|
add hl, bc
|
|
ld b, a
|
|
ld c, $0
|
|
ld de, wc608
|
|
ld a, b
|
|
and a
|
|
jr z, .empty_box
|
|
.loop
|
|
push hl
|
|
push bc
|
|
ld a, c
|
|
ld bc, 0
|
|
add hl, bc
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
call AddNTimes
|
|
ld a, [hl]
|
|
ld [de], a
|
|
inc de
|
|
ld [CurSpecies], a
|
|
call GetBaseData
|
|
pop bc
|
|
pop hl
|
|
|
|
push hl
|
|
push bc
|
|
ld a, c
|
|
ld bc, MONS_PER_BOX * (BOXMON_STRUCT_LENGTH + NAME_LENGTH)
|
|
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
|
|
ld a, [BaseGender]
|
|
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
|
|
|
|
.BoxAddrs: ; e66e
|
|
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
|