pokecrystal/engine/link/time_capsule.asm

145 lines
1.9 KiB
NASM
Raw Normal View History

2015-11-19 23:07:20 +00:00
; These functions seem to be related to backwards compatibility
2018-06-24 14:09:41 +00:00
ValidateOTTrademon:
2015-11-19 23:07:20 +00:00
ld a, [wd003]
2018-01-23 22:39:09 +00:00
ld hl, wOTPartyMon1Species
2015-11-19 23:07:20 +00:00
call GetPartyLocation
push hl
ld a, [wd003]
inc a
ld c, a
ld b, 0
2018-01-23 22:39:09 +00:00
ld hl, wOTPartyCount
2015-11-19 23:07:20 +00:00
add hl, bc
ld a, [hl]
pop hl
cp EGG
2015-12-21 19:10:16 +00:00
jr z, .matching_or_egg
2015-11-19 23:07:20 +00:00
cp [hl]
2015-12-21 19:10:16 +00:00
jr nz, .abnormal
2015-11-19 23:07:20 +00:00
2015-12-21 19:10:16 +00:00
.matching_or_egg
2015-11-19 23:07:20 +00:00
ld b, h
ld c, l
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
2015-12-21 19:10:16 +00:00
cp MAX_LEVEL + 1
jr nc, .abnormal
2015-11-19 23:07:20 +00:00
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
2015-12-21 19:10:16 +00:00
jr nz, .normal
2018-01-23 22:39:09 +00:00
ld hl, wOTPartySpecies
2015-11-19 23:07:20 +00:00
ld a, [wd003]
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
; Magnemite and Magneton's types changed
; from Electric to Electric/Steel.
cp MAGNEMITE
2015-12-21 19:10:16 +00:00
jr z, .normal
2015-11-19 23:07:20 +00:00
cp MAGNETON
2015-12-21 19:10:16 +00:00
jr z, .normal
2015-11-19 23:07:20 +00:00
2018-01-23 22:39:09 +00:00
ld [wCurSpecies], a
2015-11-19 23:07:20 +00:00
call GetBaseData
2015-12-21 19:10:16 +00:00
ld hl, wLinkOTPartyMonTypes
2015-11-19 23:07:20 +00:00
add hl, bc
add hl, bc
2018-01-23 22:39:09 +00:00
ld a, [wBaseType1]
2015-11-19 23:07:20 +00:00
cp [hl]
2015-12-21 19:10:16 +00:00
jr nz, .abnormal
2015-11-19 23:07:20 +00:00
inc hl
2018-01-23 22:39:09 +00:00
ld a, [wBaseType2]
2015-11-19 23:07:20 +00:00
cp [hl]
2015-12-21 19:10:16 +00:00
jr nz, .abnormal
2015-11-19 23:07:20 +00:00
2015-12-21 19:10:16 +00:00
.normal
2015-11-19 23:07:20 +00:00
and a
ret
2015-12-21 19:10:16 +00:00
.abnormal
2015-11-19 23:07:20 +00:00
scf
ret
2018-06-24 14:09:41 +00:00
Functionfb5dd:
2015-11-19 23:07:20 +00:00
ld a, [wd002]
ld d, a
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2015-11-19 23:07:20 +00:00
ld b, a
ld c, $0
2015-12-21 19:10:16 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld a, c
cp d
2015-12-21 19:10:16 +00:00
jr z, .next
2015-11-19 23:07:20 +00:00
push bc
ld a, c
2018-01-23 22:39:09 +00:00
ld hl, wPartyMon1HP
2015-11-19 23:07:20 +00:00
call GetPartyLocation
pop bc
ld a, [hli]
or [hl]
2015-12-21 19:10:16 +00:00
jr nz, .done
2015-11-19 23:07:20 +00:00
2015-12-21 19:10:16 +00:00
.next
2015-11-19 23:07:20 +00:00
inc c
dec b
2015-12-21 19:10:16 +00:00
jr nz, .loop
2015-11-19 23:07:20 +00:00
ld a, [wd003]
2018-01-23 22:39:09 +00:00
ld hl, wOTPartyMon1HP
2015-11-19 23:07:20 +00:00
call GetPartyLocation
ld a, [hli]
or [hl]
2015-12-21 19:10:16 +00:00
jr nz, .done
2015-11-19 23:07:20 +00:00
scf
ret
2015-12-21 19:10:16 +00:00
.done
2015-11-19 23:07:20 +00:00
and a
ret
2018-06-24 14:09:41 +00:00
PlaceTradePartnerNamesAndParty:
2015-11-19 23:07:20 +00:00
hlcoord 4, 0
2018-01-23 22:39:09 +00:00
ld de, wPlayerName
2015-11-19 23:07:20 +00:00
call PlaceString
ld a, $14
ld [bc], a
hlcoord 4, 8
2018-01-23 22:39:09 +00:00
ld de, wOTPlayerName
2015-11-19 23:07:20 +00:00
call PlaceString
ld a, $14
ld [bc], a
hlcoord 7, 1
2018-01-23 22:39:09 +00:00
ld de, wPartySpecies
2015-12-21 19:10:16 +00:00
call .PlaceSpeciesNames
2015-11-19 23:07:20 +00:00
hlcoord 7, 9
2018-01-23 22:39:09 +00:00
ld de, wOTPartySpecies
2018-06-24 14:09:41 +00:00
.PlaceSpeciesNames:
ld c, 0
2015-12-21 19:10:16 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld a, [de]
2015-12-21 19:10:16 +00:00
cp -1
2015-11-19 23:07:20 +00:00
ret z
ld [wNamedObjectIndexBuffer], a
2015-11-19 23:07:20 +00:00
push bc
push hl
push de
push hl
ld a, c
ldh [hProduct], a
2015-11-19 23:07:20 +00:00
call GetPokemonName
pop hl
call PlaceString
pop de
inc de
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
inc c
2015-12-21 19:10:16 +00:00
jr .loop
2015-11-19 23:07:20 +00:00
2018-01-22 22:33:52 +00:00
INCLUDE "data/pokemon/gen1_base_special.asm"