pokecrystal-board/engine/pokemon/move_mon_wo_mail.asm

134 lines
2.0 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
InsertPokemonIntoBox:
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
call InsertSpeciesIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonNicknames
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wd265], a
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ld hl, wBufferMonMoves
2018-01-23 14:39:09 -08:00
ld de, wTempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, wBufferMonPP
2018-01-23 14:39:09 -08:00
ld de, wTempMonPP
ld bc, NUM_MOVES
call CopyBytes
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld b, a
2017-12-24 09:47:30 -08:00
farcall RestorePPofDepositedPokemon
jp CloseSRAM
2018-06-24 07:09:41 -07:00
InsertPokemonIntoParty:
2018-01-23 14:39:09 -08:00
ld hl, wPartyCount
call InsertSpeciesIntoBoxOrParty
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
dec a
ld [wd265], a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonNicknames
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
dec a
ld [wd265], a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
2018-01-23 14:39:09 -08:00
ld a, [wPartyCount]
dec a
ld [wd265], a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMons
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ret
2018-06-24 07:09:41 -07:00
InsertSpeciesIntoBoxOrParty:
inc [hl]
inc hl
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld c, a
ld b, 0
add hl, bc
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
ld c, a
.loop
ld a, [hl]
ld [hl], c
inc hl
inc c
ld c, a
jr nz, .loop
ret
2018-06-24 07:09:41 -07:00
InsertDataIntoBoxOrParty:
push de
push hl
push bc
ld a, [wd265]
dec a
call AddNTimes
push hl
add hl, bc
ld d, h
ld e, l
pop hl
.loop
push bc
ld a, [wd265]
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
cp b
pop bc
jr z, .insert
push hl
push de
push bc
call CopyBytes
pop bc
pop de
pop hl
push hl
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
pop de
ld a, [wd265]
dec a
ld [wd265], a
jr .loop
.insert
pop bc
pop hl
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
call AddNTimes
ld d, h
ld e, l
pop hl
call CopyBytes
ret