2017-12-15 18:22:26 -08:00
|
|
|
_SwitchPartyMons:
|
|
|
|
ld a, [wd0e3]
|
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer3], a
|
2017-12-15 18:22:26 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer2], a
|
2017-12-15 18:22:26 -08:00
|
|
|
cp b
|
|
|
|
jr z, .skip
|
|
|
|
call .SwapMonAndMail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
2017-12-15 18:22:26 -08:00
|
|
|
call .ClearSprite
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
2017-12-15 18:22:26 -08:00
|
|
|
call .ClearSprite
|
|
|
|
.skip
|
|
|
|
ret
|
|
|
|
|
|
|
|
.ClearSprite: ; 50f34 (14:4f34)
|
|
|
|
push af
|
|
|
|
hlcoord 0, 1
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
call AddNTimes
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
|
|
|
pop af
|
2018-01-30 11:52:46 -08:00
|
|
|
ld hl, wVirtualOAMSprite00
|
2018-01-10 10:47:57 -08:00
|
|
|
ld bc, 4 * SPRITEOAMSTRUCT_LENGTH
|
2017-12-15 18:22:26 -08:00
|
|
|
call AddNTimes
|
2018-01-10 10:47:57 -08:00
|
|
|
ld de, SPRITEOAMSTRUCT_LENGTH
|
|
|
|
ld c, 4
|
2017-12-15 18:22:26 -08:00
|
|
|
.gfx_loop
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hl], SCREEN_WIDTH_PX ; y (off-screen)
|
2017-12-15 18:22:26 -08:00
|
|
|
add hl, de
|
|
|
|
dec c
|
|
|
|
jr nz, .gfx_loop
|
|
|
|
ld de, SFX_SWITCH_POKEMON
|
|
|
|
call WaitPlaySFX
|
|
|
|
ret
|
|
|
|
|
|
|
|
.SwapMonAndMail: ; 50f62 (14:4f62)
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wPartySpecies
|
|
|
|
ld a, [wBuffer2]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld l, a
|
|
|
|
ld h, $0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
ld a, [de]
|
|
|
|
ld [hl], a
|
|
|
|
pop af
|
|
|
|
ld [de], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
|
|
|
ld hl, wPartyMon1Species
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
push hl
|
|
|
|
ld de, wd002
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
|
|
|
ld hl, wPartyMon1
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
pop de
|
|
|
|
push hl
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
pop de
|
|
|
|
ld hl, wd002
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
|
|
|
ld hl, wPartyMonOT
|
2017-12-15 18:22:26 -08:00
|
|
|
call SkipNames
|
|
|
|
push hl
|
|
|
|
call .CopyNameTowd002
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
|
|
|
ld hl, wPartyMonOT
|
2017-12-15 18:22:26 -08:00
|
|
|
call SkipNames
|
|
|
|
pop de
|
|
|
|
push hl
|
|
|
|
call .CopyName
|
|
|
|
pop de
|
|
|
|
ld hl, wd002
|
|
|
|
call .CopyName
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMonNicknames
|
|
|
|
ld a, [wBuffer2]
|
2017-12-15 18:22:26 -08:00
|
|
|
call SkipNames
|
|
|
|
push hl
|
|
|
|
call .CopyNameTowd002
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMonNicknames
|
|
|
|
ld a, [wBuffer3]
|
2017-12-15 18:22:26 -08:00
|
|
|
call SkipNames
|
|
|
|
pop de
|
|
|
|
push hl
|
|
|
|
call .CopyName
|
|
|
|
pop de
|
|
|
|
ld hl, wd002
|
|
|
|
call .CopyName
|
|
|
|
ld hl, sPartyMail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
push hl
|
|
|
|
ld de, wd002
|
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
ld a, BANK(sPartyMail)
|
|
|
|
call GetSRAMBank
|
|
|
|
call CopyBytes
|
|
|
|
ld hl, sPartyMail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
pop de
|
|
|
|
push hl
|
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
pop de
|
|
|
|
ld hl, wd002
|
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.CopyNameTowd002: ; 51036 (14:5036)
|
|
|
|
ld de, wd002
|
|
|
|
|
|
|
|
.CopyName: ; 51039 (14:5039)
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ret
|