278 lines
3.9 KiB
NASM
Raw Normal View History

2015-11-19 18:07:20 -05:00
; These functions seem to be related to backwards compatibility
2015-12-21 14:10:16 -05:00
ValidateOTTrademon: ; fb57e
2015-11-19 18:07:20 -05: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 14:10:16 -05:00
jr z, .matching_or_egg
2015-11-19 18:07:20 -05:00
cp [hl]
2015-12-21 14:10:16 -05:00
jr nz, .abnormal
2015-11-19 18:07:20 -05:00
2015-12-21 14:10:16 -05:00
.matching_or_egg
2015-11-19 18:07:20 -05:00
ld b, h
ld c, l
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
2015-12-21 14:10:16 -05:00
cp MAX_LEVEL + 1
jr nc, .abnormal
2015-11-19 18:07:20 -05:00
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
2015-12-21 14:10:16 -05:00
jr nz, .normal
2015-11-19 18:07:20 -05: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 14:10:16 -05:00
jr z, .normal
2015-11-19 18:07:20 -05:00
cp MAGNETON
2015-12-21 14:10:16 -05:00
jr z, .normal
2015-11-19 18:07:20 -05:00
ld [CurSpecies], a
call GetBaseData
2015-12-21 14:10:16 -05:00
ld hl, wLinkOTPartyMonTypes
2015-11-19 18:07:20 -05:00
add hl, bc
add hl, bc
2015-11-19 18:07:20 -05:00
ld a, [BaseType1]
cp [hl]
2015-12-21 14:10:16 -05:00
jr nz, .abnormal
2015-11-19 18:07:20 -05:00
inc hl
ld a, [BaseType2]
cp [hl]
2015-12-21 14:10:16 -05:00
jr nz, .abnormal
2015-11-19 18:07:20 -05:00
2015-12-21 14:10:16 -05:00
.normal
2015-11-19 18:07:20 -05:00
and a
ret
2015-12-21 14:10:16 -05:00
.abnormal
2015-11-19 18:07:20 -05:00
scf
ret
; fb5dd
Functionfb5dd: ; fb5dd
ld a, [wd002]
ld d, a
ld a, [PartyCount]
ld b, a
ld c, $0
2015-12-21 14:10:16 -05:00
.loop
2015-11-19 18:07:20 -05:00
ld a, c
cp d
2015-12-21 14:10:16 -05:00
jr z, .next
2015-11-19 18:07:20 -05:00
push bc
ld a, c
ld hl, PartyMon1HP
call GetPartyLocation
pop bc
ld a, [hli]
or [hl]
2015-12-21 14:10:16 -05:00
jr nz, .done
2015-11-19 18:07:20 -05:00
2015-12-21 14:10:16 -05:00
.next
2015-11-19 18:07:20 -05:00
inc c
dec b
2015-12-21 14:10:16 -05:00
jr nz, .loop
2015-11-19 18:07:20 -05:00
ld a, [wd003]
ld hl, OTPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
2015-12-21 14:10:16 -05:00
jr nz, .done
2015-11-19 18:07:20 -05:00
scf
ret
2015-12-21 14:10:16 -05:00
.done
2015-11-19 18:07:20 -05:00
and a
ret
; fb60d
2015-12-21 14:10:16 -05:00
PlaceTradePartnerNamesAndParty: ; fb60d
2015-11-19 18:07:20 -05:00
hlcoord 4, 0
ld de, PlayerName
call PlaceString
ld a, $14
ld [bc], a
hlcoord 4, 8
2015-12-21 14:10:16 -05:00
ld de, OTPlayerName
2015-11-19 18:07:20 -05:00
call PlaceString
ld a, $14
ld [bc], a
hlcoord 7, 1
ld de, PartySpecies
2015-12-21 14:10:16 -05:00
call .PlaceSpeciesNames
2015-11-19 18:07:20 -05:00
hlcoord 7, 9
ld de, OTPartySpecies
2015-12-21 14:10:16 -05:00
.PlaceSpeciesNames: ; fb634
2015-11-19 18:07:20 -05:00
ld c, $0
2015-12-21 14:10:16 -05:00
.loop
2015-11-19 18:07:20 -05:00
ld a, [de]
2015-12-21 14:10:16 -05:00
cp -1
2015-11-19 18:07:20 -05: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 14:10:16 -05:00
jr .loop
2015-11-19 18:07:20 -05:00
; fb656
2017-12-11 22:59:30 -05:00
INCLUDE "data/time_capsule/special_stats.asm"
2015-11-19 18:07:20 -05:00
INCLUDE "event/name_rater.asm"
PlaySlowCry: ; fb841
ld a, [ScriptVar]
call LoadCryHeader
jr c, .done
ld hl, CryPitch
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, -$140
add hl, bc
ld a, l
ld [CryPitch], a
ld a, h
ld [CryPitch + 1], a
ld hl, CryLength
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, $60
add hl, bc
ld a, l
ld [CryLength], a
ld a, h
ld [CryLength + 1], a
callba _PlayCryHeader
call WaitSFX
.done
ret
; fb877
NewPokedexEntry: ; fb877
ld a, [hMapAnims]
push af
xor a
ld [hMapAnims], a
call LowVolume
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
call ClearSprites
ld a, [wPokedexStatus]
push af
ld a, [hSCX]
add $5
ld [hSCX], a
xor a
ld [wPokedexStatus], a
2015-11-29 21:34:59 -05:00
callba _NewPokedexEntry
2015-11-19 18:07:20 -05:00
call WaitPressAorB_BlinkCursor
ld a, $1
ld [wPokedexStatus], a
callba DisplayDexEntry
2015-11-19 18:07:20 -05:00
call WaitPressAorB_BlinkCursor
pop af
ld [wPokedexStatus], a
call MaxVolume
2015-11-20 11:47:52 -05:00
call RotateThreePalettesRight
2015-11-19 18:07:20 -05:00
ld a, [hSCX]
2015-11-29 21:34:59 -05:00
add -5 ; 251 ; NUM_POKEMON
2015-11-19 18:07:20 -05:00
ld [hSCX], a
2016-01-18 00:39:01 -05:00
call .ReturnFromDexRegistration
2015-11-19 18:07:20 -05:00
pop af
ld [hMapAnims], a
ret
; fb8c8
2016-01-18 00:39:01 -05:00
.ReturnFromDexRegistration: ; fb8c8
2015-11-19 18:07:20 -05:00
call ClearTileMap
call LoadFontsExtra
call LoadStandardFont
2015-11-29 21:34:59 -05:00
callba Pokedex_PlaceFrontpicTopLeftCorner
2015-12-11 16:59:40 -05:00
call WaitBGMap2
2015-11-19 18:07:20 -05:00
callba GetEnemyMonDVs
ld a, [hli]
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
2015-11-19 18:07:20 -05:00
call GetSGBLayout
call SetPalettes
ret
; fb8f1
ConvertMon_2to1: ; fb8f1
; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265.
push bc
push hl
ld a, [wd265]
ld b, a
ld c, 0
ld hl, Pokered_MonIndices
.loop
inc c
ld a, [hli]
cp b
jr nz, .loop
ld a, c
ld [wd265], a
pop hl
pop bc
ret
; fb908
ConvertMon_1to2: ; fb908
; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265.
push bc
push hl
ld a, [wd265]
dec a
ld hl, Pokered_MonIndices
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd265], a
pop hl
pop bc
ret
; fb91c
2017-12-11 22:59:30 -05:00
INCLUDE "data/time_capsule/mon_order.asm"