2018-06-24 14:09:41 +00:00
|
|
|
MobileCheckOwnMonAnywhere:
|
2015-12-07 03:36:09 +00:00
|
|
|
; Like CheckOwnMonAnywhere, but only check for species.
|
|
|
|
; OT/ID don't matter.
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
ld d, a
|
|
|
|
ld e, 0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1Species
|
|
|
|
ld bc, wPartyMonOT
|
2015-12-07 03:36:09 +00:00
|
|
|
.asm_4a851
|
|
|
|
call .CheckMatch
|
|
|
|
ret c
|
|
|
|
push bc
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
call .CopyName
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_4a851
|
|
|
|
ld a, BANK(sBoxCount)
|
|
|
|
call GetSRAMBank
|
|
|
|
ld a, [sBoxCount]
|
|
|
|
and a
|
|
|
|
jr z, .asm_4a888
|
|
|
|
ld d, a
|
|
|
|
ld hl, sBoxMon1Species
|
|
|
|
ld bc, sBoxMonOT
|
|
|
|
.asm_4a873
|
|
|
|
call .CheckMatch
|
|
|
|
jr nc, .asm_4a87c
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4a87c
|
|
|
|
push bc
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
call .CopyName
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_4a873
|
|
|
|
|
|
|
|
.asm_4a888
|
|
|
|
call CloseSRAM
|
|
|
|
ld c, 0
|
|
|
|
.asm_4a88d
|
|
|
|
ld a, [wCurBox]
|
|
|
|
and $f
|
|
|
|
cp c
|
|
|
|
jr z, .asm_4a8d1
|
|
|
|
ld hl, .BoxAddrs
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [hli]
|
|
|
|
call GetSRAMBank
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_4a8d1
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
ld de, sBoxMons - sBoxCount
|
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
push de
|
|
|
|
ld de, sBoxMonOT - sBoxCount
|
|
|
|
add hl, de
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
ld d, a
|
|
|
|
.asm_4a8ba
|
|
|
|
call .CheckMatch
|
|
|
|
jr nc, .asm_4a8c4
|
|
|
|
pop bc
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4a8c4
|
|
|
|
push bc
|
|
|
|
ld bc, BOXMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
call .CopyName
|
|
|
|
dec d
|
|
|
|
jr nz, .asm_4a8ba
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
.asm_4a8d1
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp NUM_BOXES
|
|
|
|
jr c, .asm_4a88d
|
|
|
|
call CloseSRAM
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CheckMatch:
|
2015-12-07 03:36:09 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
ld d, b
|
|
|
|
ld e, c
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2015-12-07 03:36:09 +00:00
|
|
|
ld b, [hl]
|
|
|
|
cp b
|
|
|
|
jr nz, .no_match
|
|
|
|
jr .match
|
|
|
|
|
|
|
|
.no_match
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.match
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.BoxAddrs:
|
2015-12-07 03:36:09 +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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CopyName:
|
2015-12-07 03:36:09 +00:00
|
|
|
push hl
|
|
|
|
ld hl, NAME_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
UnusedFindItemInPCOrBag:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
|
|
|
ld [wCurItem], a
|
|
|
|
ld hl, wPCItems
|
2015-12-07 03:36:09 +00:00
|
|
|
call CheckItem
|
|
|
|
jr c, .found
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
|
|
|
ld [wCurItem], a
|
|
|
|
ld hl, wNumItems
|
2015-12-07 03:36:09 +00:00
|
|
|
call CheckItem
|
|
|
|
jr c, .found
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.found
|
|
|
|
ld a, 1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4a94e:
|
2015-12-07 03:36:09 +00:00
|
|
|
call FadeToMenu
|
|
|
|
ld a, -1
|
|
|
|
ld hl, wd002
|
|
|
|
ld bc, 3
|
|
|
|
call ByteFill
|
|
|
|
xor a
|
|
|
|
ld [wd018], a
|
|
|
|
ld [wd019], a
|
2015-12-22 23:03:00 +00:00
|
|
|
ld b, SCGB_PACKPALS
|
2015-12-07 03:36:09 +00:00
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
call Function4aa22
|
|
|
|
jr c, .asm_4a985
|
|
|
|
jr z, .asm_4a9a1
|
|
|
|
jr .asm_4a97b
|
|
|
|
|
|
|
|
.asm_4a974
|
|
|
|
call Function4aa25
|
|
|
|
jr c, .asm_4a985
|
|
|
|
jr z, .asm_4a9a1
|
|
|
|
|
|
|
|
.asm_4a97b
|
|
|
|
call Function4ac58
|
|
|
|
ld hl, wd019
|
|
|
|
res 1, [hl]
|
|
|
|
jr .asm_4a974
|
|
|
|
|
|
|
|
.asm_4a985
|
|
|
|
ld a, [wd018]
|
|
|
|
and a
|
|
|
|
jr nz, .asm_4a990
|
|
|
|
call Function4aba8
|
|
|
|
jr c, .asm_4a974
|
|
|
|
|
|
|
|
.asm_4a990
|
|
|
|
call CloseSubmenu
|
|
|
|
ld hl, wd002
|
|
|
|
ld a, -1
|
|
|
|
ld bc, 3
|
|
|
|
call ByteFill
|
|
|
|
scf
|
|
|
|
jr .asm_4a9af
|
|
|
|
|
|
|
|
.asm_4a9a1
|
|
|
|
call Function4a9c3
|
|
|
|
jr c, .asm_4a9b0
|
|
|
|
call Function4a9d7
|
|
|
|
jr c, .asm_4a974
|
|
|
|
call CloseSubmenu
|
|
|
|
and a
|
|
|
|
|
|
|
|
.asm_4a9af
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4a9b0
|
|
|
|
ld de, SFX_WRONG
|
|
|
|
call PlaySFX
|
|
|
|
ld hl, UnknownText_0x4a9be
|
|
|
|
call PrintText
|
|
|
|
jr .asm_4a974
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
UnknownText_0x4a9be:
|
2015-12-07 03:36:09 +00:00
|
|
|
; Pick three #MON for battle.
|
|
|
|
text_jump UnknownText_0x1c51d7
|
|
|
|
db "@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4a9c3:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd002
|
|
|
|
ld a, $ff
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4a9d5
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4a9d5
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4a9d5
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4a9d5
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4a9d7:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [wd002]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMonNicknames
|
2015-12-07 03:36:09 +00:00
|
|
|
call GetNick
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2018-07-29 05:13:25 +00:00
|
|
|
ld de, wd006
|
2015-12-07 03:36:09 +00:00
|
|
|
ld bc, 6
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wd003]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMonNicknames
|
2015-12-07 03:36:09 +00:00
|
|
|
call GetNick
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
ld de, wd00c
|
|
|
|
ld bc, 6
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wd004]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMonNicknames
|
2015-12-07 03:36:09 +00:00
|
|
|
call GetNick
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
ld de, wd012
|
|
|
|
ld bc, 6
|
|
|
|
call CopyBytes
|
|
|
|
ld hl, UnknownText_0x4aa1d
|
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
UnknownText_0x4aa1d:
|
2015-12-07 03:36:09 +00:00
|
|
|
; , @ and @ . Use these three?
|
|
|
|
text_jump UnknownText_0x1c51f4
|
|
|
|
db "@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aa22:
|
2015-12-07 03:36:09 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aa25:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
farcall InitPartyMenuWithCancel
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4aad3
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aa34:
|
2017-11-30 19:27:25 +00:00
|
|
|
ld a, PARTYMENUACTION_MOBILE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPartyMenuActionText], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall WritePartyMenuTilemap
|
2015-12-07 03:36:09 +00:00
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPartyMenuActionText], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall PrintPartyMenuText
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4aab6
|
|
|
|
call WaitBGMap
|
|
|
|
call SetPalettes
|
|
|
|
call DelayFrame
|
|
|
|
call Function4ab1a
|
|
|
|
jr z, .asm_4aa66
|
|
|
|
push af
|
|
|
|
call Function4aafb
|
|
|
|
jr c, .asm_4aa67
|
|
|
|
call Function4ab06
|
|
|
|
jr c, .asm_4aa67
|
|
|
|
pop af
|
|
|
|
|
|
|
|
.asm_4aa66
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4aa67
|
|
|
|
ld hl, wd019
|
|
|
|
set 1, [hl]
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aa6e:
|
2015-12-07 03:36:09 +00:00
|
|
|
pop af
|
|
|
|
ld de, SFX_WRONG
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
jr Function4aa34
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aa7a:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd002
|
|
|
|
ld d, $3
|
|
|
|
.loop
|
|
|
|
ld e, PARTY_LENGTH
|
|
|
|
ld a, [hli]
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
ld hl, wSpriteAnimationStructs
|
|
|
|
inc a
|
|
|
|
ld d, a
|
|
|
|
.inner_loop
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .next
|
|
|
|
cp d
|
|
|
|
jr z, .same_as_d
|
|
|
|
jr .next
|
|
|
|
|
|
|
|
ld a, $3
|
|
|
|
jr .proceed
|
|
|
|
|
|
|
|
.same_as_d
|
|
|
|
ld a, $2
|
|
|
|
|
|
|
|
.proceed
|
|
|
|
push hl
|
|
|
|
ld c, l
|
|
|
|
ld b, h
|
|
|
|
ld hl, $2
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
.next
|
|
|
|
ld bc, $10
|
|
|
|
add hl, bc
|
|
|
|
dec e
|
|
|
|
jr nz, .inner_loop
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
dec d
|
|
|
|
jr nz, .loop
|
|
|
|
jr .finished
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
|
|
|
|
.finished
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aab6:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd002
|
|
|
|
ld d, $3
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
hlcoord 0, 1
|
|
|
|
ld bc, $28
|
|
|
|
call AddNTimes
|
|
|
|
ld [hl], $ec
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
dec d
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aad3:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyCount
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
ret z ; Nothing in your party
|
|
|
|
|
|
|
|
ld c, a
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hObjectStructIndexBuffer], a
|
2015-12-07 03:36:09 +00:00
|
|
|
.loop
|
|
|
|
push bc
|
|
|
|
push hl
|
2018-07-28 23:27:34 +00:00
|
|
|
ld e, MONICON_PARTYMENU
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadMenuMonIcon
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hObjectStructIndexBuffer]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hObjectStructIndexBuffer], a
|
2015-12-07 03:36:09 +00:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
call Function4aa7a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall PlaySpriteAnimations
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aafb:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp EGG
|
|
|
|
jr z, .egg
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.egg
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ab06:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-12-07 03:36:09 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1HP
|
2015-12-07 03:36:09 +00:00
|
|
|
call AddNTimes
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
|
|
|
or b
|
|
|
|
jr nz, .NotFainted
|
|
|
|
scf
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.NotFainted:
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ab1a:
|
2015-12-07 03:36:09 +00:00
|
|
|
.asm_4ab1a
|
|
|
|
ld a, $fb
|
2015-12-20 17:54:08 +00:00
|
|
|
ld [wMenuJoypadFilter], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $26
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $2
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4adf7
|
2015-12-15 23:59:49 +00:00
|
|
|
call StaticMenuJoypad
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4abc3
|
|
|
|
jr c, .asm_4ab1a
|
|
|
|
push af
|
|
|
|
call Function4ab99
|
2015-12-18 03:31:16 +00:00
|
|
|
call nc, PlaceHollowCursor
|
2015-12-07 03:36:09 +00:00
|
|
|
pop af
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .asm_4ab6d
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
|
|
|
ld b, a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-23 19:00:29 +00:00
|
|
|
ld [wPartyMenuCursor], a
|
2015-12-07 03:36:09 +00:00
|
|
|
cp b
|
|
|
|
jr z, .asm_4ab7e
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
dec a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyMon], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartySpecies
|
2015-12-07 03:36:09 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld a, $1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4ab6d
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-23 19:00:29 +00:00
|
|
|
ld [wPartyMenuCursor], a
|
2015-12-07 03:36:09 +00:00
|
|
|
.asm_4ab73
|
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4ab7e
|
|
|
|
ld a, $1
|
|
|
|
ld [wd018], a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorX]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp $2
|
|
|
|
jr z, .asm_4ab73
|
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
xor a
|
|
|
|
ld [wd018], a
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ab99:
|
2015-12-07 03:36:09 +00:00
|
|
|
bit 1, a
|
|
|
|
jr z, .asm_4aba6
|
|
|
|
ld a, [wd002]
|
|
|
|
cp $ff
|
|
|
|
jr z, .asm_4aba6
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4aba6
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4aba8:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd004
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_4abbe
|
|
|
|
dec hl
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_4abbe
|
|
|
|
dec hl
|
|
|
|
ld a, [hl]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_4abbe
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4abbe
|
|
|
|
ld a, $ff
|
|
|
|
ld [hl], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4abc3:
|
2015-12-07 03:36:09 +00:00
|
|
|
bit 3, a
|
|
|
|
jr z, .asm_4abd5
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-07 03:36:09 +00:00
|
|
|
jr .asm_4ac29
|
|
|
|
|
|
|
|
.asm_4abd5
|
|
|
|
bit 6, a
|
|
|
|
jr z, .asm_4abeb
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
ld [wMenuCursorY], a
|
2015-12-07 03:36:09 +00:00
|
|
|
and a
|
|
|
|
jr nz, .asm_4ac29
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-07 03:36:09 +00:00
|
|
|
jr .asm_4ac29
|
|
|
|
|
|
|
|
.asm_4abeb
|
|
|
|
bit 7, a
|
|
|
|
jr z, .asm_4ac08
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
ld [wMenuCursorY], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
2016-05-04 15:46:23 +00:00
|
|
|
inc a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld b, a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp b
|
|
|
|
jr nz, .asm_4ac29
|
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-07 03:36:09 +00:00
|
|
|
jr .asm_4ac29
|
|
|
|
|
|
|
|
.asm_4ac08
|
|
|
|
bit 4, a
|
|
|
|
jr nz, .asm_4ac10
|
|
|
|
bit 5, a
|
|
|
|
jr z, .asm_4ac56
|
|
|
|
|
|
|
|
.asm_4ac10
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
|
|
|
cp b
|
|
|
|
jr nz, .asm_4ac29
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorX]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp $1
|
|
|
|
jr z, .asm_4ac26
|
|
|
|
ld a, $1
|
|
|
|
jr .asm_4ac29
|
|
|
|
|
|
|
|
.asm_4ac26
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-07 03:36:09 +00:00
|
|
|
|
|
|
|
.asm_4ac29
|
|
|
|
hlcoord 0, 1
|
|
|
|
lb bc, 13, 1
|
|
|
|
call ClearBox
|
|
|
|
call Function4aab6
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
hlcoord 6, 1
|
|
|
|
.asm_4ac3b
|
|
|
|
ld bc, $28
|
|
|
|
add hl, bc
|
|
|
|
dec a
|
|
|
|
jr nz, .asm_4ac3b
|
|
|
|
ld [hl], $7f
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
|
|
|
cp b
|
|
|
|
jr z, .asm_4ac54
|
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-07 03:36:09 +00:00
|
|
|
|
|
|
|
.asm_4ac54
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4ac56
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ac58:
|
2015-12-07 03:36:09 +00:00
|
|
|
lb bc, 2, 18
|
|
|
|
hlcoord 1, 15
|
|
|
|
call ClearBox
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall FreezeMonIcons
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, MenuHeader_0x4aca2
|
|
|
|
call LoadMenuHeader
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd019
|
|
|
|
bit 1, [hl]
|
|
|
|
jr z, .asm_4ac89
|
|
|
|
hlcoord 11, 13
|
|
|
|
ld b, $3
|
|
|
|
ld c, $7
|
|
|
|
call TextBox
|
|
|
|
hlcoord 13, 14
|
|
|
|
ld de, String_4ada7
|
|
|
|
call PlaceString
|
|
|
|
jr .asm_4ac96
|
|
|
|
|
|
|
|
.asm_4ac89
|
|
|
|
hlcoord 11, 9
|
|
|
|
ld b, $7
|
|
|
|
ld c, $7
|
|
|
|
call TextBox
|
|
|
|
call Function4ad68
|
|
|
|
|
|
|
|
.asm_4ac96
|
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4acaa
|
|
|
|
call ExitMenu
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
MenuHeader_0x4aca2:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 11, 9, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-12-07 03:36:09 +00:00
|
|
|
dw NULL
|
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4acaa:
|
2015-12-07 03:36:09 +00:00
|
|
|
.asm_4acaa
|
|
|
|
ld a, $a0
|
2018-01-23 21:08:43 +00:00
|
|
|
ld [wMenuDataFlags], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [wd019]
|
|
|
|
bit 1, a
|
|
|
|
jr z, .asm_4acc2
|
|
|
|
ld a, $2
|
2018-01-23 21:08:43 +00:00
|
|
|
ld [wMenuDataItems], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $c
|
|
|
|
ld [wMenuBorderTopCoord], a
|
|
|
|
jr .asm_4accc
|
|
|
|
|
|
|
|
.asm_4acc2
|
|
|
|
ld a, $4
|
2018-01-23 21:08:43 +00:00
|
|
|
ld [wMenuDataItems], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $8
|
|
|
|
ld [wMenuBorderTopCoord], a
|
|
|
|
|
|
|
|
.asm_4accc
|
|
|
|
ld a, $b
|
|
|
|
ld [wMenuBorderLeftCoord], a
|
|
|
|
ld a, $1
|
|
|
|
ld [wMenuCursorBuffer], a
|
2015-12-15 23:59:49 +00:00
|
|
|
call InitVerticalMenuCursor
|
2015-12-19 19:48:30 +00:00
|
|
|
ld hl, w2DMenuFlags1
|
2015-12-07 03:36:09 +00:00
|
|
|
set 6, [hl]
|
2015-12-15 23:59:49 +00:00
|
|
|
call StaticMenuJoypad
|
2015-12-07 03:36:09 +00:00
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
call PlaySFX
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoyPressed]
|
2015-12-07 03:36:09 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .asm_4acf4
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .asm_4acf3
|
|
|
|
jr .asm_4acaa
|
|
|
|
|
|
|
|
.asm_4acf3
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4acf4
|
|
|
|
ld a, [wd019]
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .asm_4ad0e
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp $1
|
|
|
|
jr z, Function4ad17
|
|
|
|
cp $2
|
|
|
|
jp z, Function4ad56
|
|
|
|
cp $3
|
|
|
|
jp z, Function4ad60
|
|
|
|
jr .asm_4acf3
|
|
|
|
|
|
|
|
.asm_4ad0e
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp $1
|
|
|
|
jr z, Function4ad56
|
|
|
|
jr .asm_4acf3
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ad17:
|
2015-12-07 03:36:09 +00:00
|
|
|
call Function4adb2
|
|
|
|
jr z, .asm_4ad4a
|
|
|
|
ld hl, wd002
|
|
|
|
ld a, $ff
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4ad39
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4ad39
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
jr z, .asm_4ad39
|
|
|
|
ld de, SFX_WRONG
|
|
|
|
call WaitPlaySFX
|
|
|
|
ld hl, UnknownText_0x4ad51
|
|
|
|
call PrintText
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4ad39
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-12-07 03:36:09 +00:00
|
|
|
ld [hl], a
|
|
|
|
call Function4a9c3
|
|
|
|
ret c
|
|
|
|
ld a, [wd019]
|
|
|
|
set 0, a
|
|
|
|
ld [wd019], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_4ad4a
|
|
|
|
ld a, $ff
|
|
|
|
ld [hl], a
|
|
|
|
call Function4adc2
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
UnknownText_0x4ad51:
|
2015-12-07 03:36:09 +00:00
|
|
|
; Only three #MON may enter.
|
|
|
|
text_jump UnknownText_0x1c521c
|
|
|
|
db "@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ad56:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall OpenPartyStats
|
2015-12-11 21:59:40 +00:00
|
|
|
call WaitBGMap2
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ad60:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ManagePokemonMoves
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ad67:
|
2015-12-07 03:36:09 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4ad68:
|
2015-12-07 03:36:09 +00:00
|
|
|
hlcoord 13, 12
|
|
|
|
ld de, String_4ad88
|
|
|
|
call PlaceString
|
|
|
|
call Function4adb2
|
|
|
|
jr c, .asm_4ad7e
|
|
|
|
hlcoord 13, 10
|
|
|
|
ld de, String_4ada0
|
|
|
|
jr .asm_4ad84
|
|
|
|
|
|
|
|
.asm_4ad7e
|
|
|
|
hlcoord 13, 10
|
|
|
|
ld de, String_4ad9a
|
|
|
|
|
|
|
|
.asm_4ad84
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
String_4ad88:
|
2015-12-07 03:36:09 +00:00
|
|
|
db "つよさをみる"
|
|
|
|
next "つかえるわざ"
|
|
|
|
next "もどる@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
String_4ad9a:
|
2015-12-07 03:36:09 +00:00
|
|
|
db "さんかする@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
String_4ada0:
|
2015-12-07 03:36:09 +00:00
|
|
|
db "さんかしない@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
String_4ada7:
|
2015-12-07 03:36:09 +00:00
|
|
|
db "つよさをみる"
|
|
|
|
next "もどる@" ; BACK
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4adb2:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld hl, wd002
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-12-07 03:36:09 +00:00
|
|
|
cp [hl]
|
|
|
|
ret z
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
ret z
|
|
|
|
inc hl
|
|
|
|
cp [hl]
|
|
|
|
ret z
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4adc2:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [wd002]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .skip
|
|
|
|
ld a, [wd003]
|
|
|
|
cp $ff
|
|
|
|
jr nz, .skip2
|
|
|
|
ld a, [wd004]
|
|
|
|
ld [wd002], a
|
|
|
|
ld a, $ff
|
|
|
|
ld [wd004], a
|
|
|
|
jr .skip
|
|
|
|
|
|
|
|
.skip2
|
|
|
|
ld [wd002], a
|
|
|
|
ld a, $ff
|
|
|
|
ld [wd003], a
|
|
|
|
|
|
|
|
.skip
|
|
|
|
ld a, [wd003]
|
|
|
|
cp $ff
|
|
|
|
ret nz
|
|
|
|
ld b, a
|
|
|
|
ld a, [wd004]
|
|
|
|
ld [wd003], a
|
|
|
|
ld a, b
|
|
|
|
ld [wd004], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function4adf7:
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [wd019]
|
|
|
|
bit 0, a
|
|
|
|
ret z
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPartyCount]
|
2015-12-07 03:36:09 +00:00
|
|
|
inc a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, $1
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-07 03:36:09 +00:00
|
|
|
ld a, [wd019]
|
|
|
|
res 0, a
|
|
|
|
ld [wd019], a
|
|
|
|
ret
|