pokecrystal/engine/time_capsule.asm

148 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
2015-12-21 19:10:16 +00:00
ValidateOTTrademon: ; fb57e
2015-11-19 23:07:20 +00:00
ld a, [wd003]
ld hl, OTPartyMon1Species
call GetPartyLocation
push hl
ld a, [wd003]
inc a
ld c, a
ld b, 0
ld hl, OTPartyCount
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
2015-11-19 23:07:20 +00:00
ld hl, OTPartySpecies
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
ld [CurSpecies], a
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
2015-11-19 23:07:20 +00:00
ld a, [BaseType1]
cp [hl]
2015-12-21 19:10:16 +00:00
jr nz, .abnormal
2015-11-19 23:07:20 +00:00
inc hl
ld a, [BaseType2]
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
; fb5dd
Functionfb5dd: ; fb5dd
ld a, [wd002]
ld d, a
ld a, [PartyCount]
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
ld hl, PartyMon1HP
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]
ld hl, OTPartyMon1HP
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
; fb60d
2015-12-21 19:10:16 +00:00
PlaceTradePartnerNamesAndParty: ; fb60d
2015-11-19 23:07:20 +00:00
hlcoord 4, 0
ld de, PlayerName
call PlaceString
ld a, $14
ld [bc], a
hlcoord 4, 8
2015-12-21 19:10:16 +00:00
ld de, OTPlayerName
2015-11-19 23:07:20 +00:00
call PlaceString
ld a, $14
ld [bc], a
hlcoord 7, 1
ld de, PartySpecies
2015-12-21 19:10:16 +00:00
call .PlaceSpeciesNames
2015-11-19 23:07:20 +00:00
hlcoord 7, 9
ld de, OTPartySpecies
2015-12-21 19:10:16 +00:00
.PlaceSpeciesNames: ; fb634
2015-11-19 23:07:20 +00:00
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 [wd265], a
push bc
push hl
push de
push hl
ld a, c
ld [hProduct], a
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
; fb656
2018-01-03 07:23:54 +00:00
INCLUDE "data/pokemon/rby_base_special.asm"