2018-06-24 07:09:41 -07:00
|
|
|
CheckBreedmonCompatibility:
|
2015-12-09 15:25:44 -08:00
|
|
|
call .CheckBreedingGroupCompatibility
|
2015-11-10 13:53:37 -08:00
|
|
|
ld c, $0
|
2015-12-09 15:25:44 -08:00
|
|
|
jp nc, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1DVs]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1DVs + 1]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs + 1], a
|
2016-05-11 14:16:03 -07:00
|
|
|
ld a, TEMPMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetGender
|
2015-12-09 15:25:44 -08:00
|
|
|
jr c, .genderless
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, $1
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .breedmon2
|
2015-11-10 13:53:37 -08:00
|
|
|
inc b
|
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.breedmon2
|
2015-11-10 13:53:37 -08:00
|
|
|
push bc
|
|
|
|
ld a, [wBreedMon2Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2DVs]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2DVs + 1]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs + 1], a
|
2018-05-05 00:19:04 -07:00
|
|
|
ld a, TEMPMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetGender
|
2015-11-10 13:53:37 -08:00
|
|
|
pop bc
|
2015-12-09 15:25:44 -08:00
|
|
|
jr c, .genderless
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, $1
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .compare_gender
|
2015-11-10 13:53:37 -08:00
|
|
|
inc a
|
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.compare_gender
|
2015-11-10 13:53:37 -08:00
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .compute
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.genderless
|
2015-11-10 13:53:37 -08:00
|
|
|
ld c, $0
|
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
cp DITTO
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .ditto1
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
cp DITTO
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .done
|
|
|
|
jr .compute
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.ditto1
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
cp DITTO
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.compute
|
|
|
|
call .CheckDVs
|
|
|
|
ld c, 255
|
|
|
|
jp z, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
ld b, a
|
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
ld c, 254
|
|
|
|
jr z, .compare_ids
|
|
|
|
ld c, 128
|
|
|
|
.compare_ids
|
|
|
|
; Speed up
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1ID]
|
|
|
|
ld b, a
|
|
|
|
ld a, [wBreedMon2ID]
|
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1ID + 1]
|
|
|
|
ld b, a
|
|
|
|
ld a, [wBreedMon2ID + 1]
|
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
jr nz, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, c
|
2015-12-09 15:25:44 -08:00
|
|
|
sub 77
|
2015-11-10 13:53:37 -08:00
|
|
|
ld c, a
|
|
|
|
|
2015-12-09 15:25:44 -08:00
|
|
|
.done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, c
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wBreedingCompatibility], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckDVs:
|
2015-12-09 15:25:44 -08:00
|
|
|
; If Defense DVs match and the lower 3 bits of the Special DVs match,
|
2016-10-28 16:52:13 -07:00
|
|
|
; avoid breeding
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1DVs]
|
2015-12-09 15:25:44 -08:00
|
|
|
and %1111
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [wBreedMon2DVs]
|
2015-12-09 15:25:44 -08:00
|
|
|
and %1111
|
2015-11-10 13:53:37 -08:00
|
|
|
cp b
|
|
|
|
ret nz
|
|
|
|
ld a, [wBreedMon1DVs + 1]
|
2015-12-09 15:25:44 -08:00
|
|
|
and %111
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [wBreedMon2DVs + 1]
|
2015-12-09 15:25:44 -08:00
|
|
|
and %111
|
2015-11-10 13:53:37 -08:00
|
|
|
cp b
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CheckBreedingGroupCompatibility:
|
2015-12-09 15:25:44 -08:00
|
|
|
; If either mon is in the No Eggs group,
|
|
|
|
; they are not compatible.
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBaseEggGroups]
|
2018-02-25 16:23:01 -08:00
|
|
|
cp EGG_NONE * $11
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Incompatible
|
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBaseEggGroups]
|
2018-02-25 16:23:01 -08:00
|
|
|
cp EGG_NONE * $11
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Incompatible
|
|
|
|
|
|
|
|
; Ditto is automatically compatible with everything.
|
|
|
|
; If not Ditto, load the breeding groups into b/c and d/e.
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
cp DITTO
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBaseEggGroups]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
and $f
|
|
|
|
ld b, a
|
|
|
|
pop af
|
|
|
|
and $f0
|
|
|
|
swap a
|
|
|
|
ld c, a
|
2015-12-09 15:25:44 -08:00
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
cp DITTO
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
push bc
|
|
|
|
call GetBaseData
|
|
|
|
pop bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBaseEggGroups]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
and $f
|
|
|
|
ld d, a
|
|
|
|
pop af
|
|
|
|
and $f0
|
|
|
|
swap a
|
|
|
|
ld e, a
|
2015-12-09 15:25:44 -08:00
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, d
|
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
2015-11-10 13:53:37 -08:00
|
|
|
cp c
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, e
|
|
|
|
cp b
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
2015-11-10 13:53:37 -08:00
|
|
|
cp c
|
2015-12-09 15:25:44 -08:00
|
|
|
jr z, .Compatible
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Incompatible:
|
2015-11-10 13:53:37 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Compatible:
|
2015-11-10 13:53:37 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DoEggStep::
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPartySpecies
|
|
|
|
ld hl, wPartyMon1Happiness
|
2015-11-10 13:53:37 -08:00
|
|
|
ld c, 0
|
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp -1
|
|
|
|
ret z
|
|
|
|
cp EGG
|
|
|
|
jr nz, .next
|
|
|
|
dec [hl]
|
|
|
|
jr nz, .next
|
|
|
|
ld a, 1
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.next
|
|
|
|
push de
|
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
jr .loop
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
OverworldHatchEgg::
|
2015-12-24 19:58:42 -08:00
|
|
|
call RefreshScreen
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2015-12-02 10:24:18 -08:00
|
|
|
call HatchEggs
|
2015-11-17 14:56:49 -08:00
|
|
|
call ExitAllMenus
|
2015-11-10 13:53:37 -08:00
|
|
|
call RestartMapMusic
|
2015-11-25 07:16:29 -08:00
|
|
|
jp CloseText
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HatchEggs:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPartySpecies
|
|
|
|
ld hl, wPartyMon1Happiness
|
2015-11-10 13:53:37 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.loop
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp -1
|
2015-12-02 10:24:18 -08:00
|
|
|
jp z, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
cp EGG
|
2015-12-02 10:24:18 -08:00
|
|
|
jp nz, .next
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-02 10:24:18 -08:00
|
|
|
jp nz, .next
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hl], $78
|
|
|
|
|
|
|
|
push de
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SetEggMonCaughtData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1Species
|
2015-11-10 13:53:37 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
dec a
|
|
|
|
call SetSeenAndCaughtMon
|
|
|
|
|
|
|
|
pop de
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-10 13:53:37 -08:00
|
|
|
dec de
|
|
|
|
ld [de], a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetPokemonName
|
|
|
|
xor a
|
2019-04-19 08:35:27 -07:00
|
|
|
ld [wUnusedEggHatchFlag], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1
|
2015-11-10 13:53:37 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
push hl
|
|
|
|
ld bc, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
push hl
|
|
|
|
ld bc, MON_LEVEL
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2015-11-10 13:53:37 -08:00
|
|
|
pop hl
|
|
|
|
push hl
|
|
|
|
ld bc, MON_STATUS
|
|
|
|
add hl, bc
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
push hl
|
2015-12-21 11:10:16 -08:00
|
|
|
ld bc, MON_STAT_EXP - 1
|
2015-11-10 13:53:37 -08:00
|
|
|
add hl, bc
|
2018-01-22 10:18:23 -08:00
|
|
|
ld b, FALSE
|
2018-02-22 08:13:29 -08:00
|
|
|
predef CalcMonStats
|
2015-11-10 13:53:37 -08:00
|
|
|
pop bc
|
|
|
|
ld hl, MON_MAXHP
|
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, MON_HP
|
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [de]
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, MON_ID
|
|
|
|
add hl, bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPlayerID]
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hli], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPlayerID + 1]
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2021-03-17 13:16:02 -07:00
|
|
|
ld hl, wPartyMonOTs
|
2015-11-10 13:53:37 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
2015-11-10 13:53:37 -08:00
|
|
|
call CopyBytes
|
2015-12-02 10:24:18 -08:00
|
|
|
ld hl, .Text_HatchEgg
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-11-10 13:53:37 -08:00
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
push de
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedAskNicknameText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
call YesNoBox
|
|
|
|
pop de
|
|
|
|
jr c, .nonickname
|
2015-12-02 10:24:18 -08:00
|
|
|
|
2019-04-19 08:35:27 -07:00
|
|
|
ld a, TRUE
|
|
|
|
ld [wUnusedEggHatchFlag], a
|
2015-11-10 13:53:37 -08:00
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2015-11-10 13:53:37 -08:00
|
|
|
push de
|
2018-09-16 13:02:58 -07:00
|
|
|
ld b, NAME_MON
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall NamingScreen
|
2015-11-10 13:53:37 -08:00
|
|
|
pop hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2015-11-10 13:53:37 -08:00
|
|
|
call InitName
|
2015-12-02 10:24:18 -08:00
|
|
|
jr .next
|
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
.nonickname
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer1
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-11-10 13:53:37 -08:00
|
|
|
call CopyBytes
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.next
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wCurPartyMon
|
2015-11-10 13:53:37 -08:00
|
|
|
inc [hl]
|
|
|
|
pop hl
|
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, de
|
|
|
|
pop de
|
2015-12-02 10:24:18 -08:00
|
|
|
jp .loop
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.done
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.Text_HatchEgg:
|
2015-11-10 13:53:37 -08:00
|
|
|
; Huh? @ @
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far Text_BreedHuh
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2024-02-10 15:34:46 -08:00
|
|
|
ld hl, wStateFlags
|
2015-11-10 13:53:37 -08:00
|
|
|
res 0, [hl]
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
2015-12-02 10:24:18 -08:00
|
|
|
call EggHatch_AnimationSequence
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedClearboxText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedEggHatchText
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedClearboxText:
|
|
|
|
text_far _BreedClearboxText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedEggHatchText:
|
|
|
|
text_far _BreedEggHatchText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedAskNicknameText:
|
|
|
|
text_far _BreedAskNicknameText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitEggMoves:
|
2015-12-02 10:24:18 -08:00
|
|
|
call GetHeritableMoves
|
2015-11-10 13:53:37 -08:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld b, NUM_MOVES
|
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
ld hl, wEggMonMoves
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.next
|
|
|
|
ld a, [de]
|
|
|
|
cp [hl]
|
|
|
|
jr z, .skip
|
|
|
|
inc hl
|
|
|
|
dec c
|
|
|
|
jr nz, .next
|
2015-12-02 10:24:18 -08:00
|
|
|
call GetEggMove
|
2015-11-10 13:53:37 -08:00
|
|
|
jr nc, .skip
|
2015-12-02 10:24:18 -08:00
|
|
|
call LoadEggMove
|
2015-11-10 13:53:37 -08:00
|
|
|
|
|
|
|
.skip
|
|
|
|
inc de
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetEggMove:
|
2015-11-10 13:53:37 -08:00
|
|
|
push bc
|
|
|
|
ld a, [wEggMonSpecies]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, EggMovePointers
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, BANK(EggMovePointers)
|
2021-01-09 12:16:05 -08:00
|
|
|
call GetFarWord
|
2015-11-10 13:53:37 -08:00
|
|
|
.loop
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Egg Moves")
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetFarByte
|
|
|
|
cp -1
|
2015-12-02 10:24:18 -08:00
|
|
|
jr z, .reached_end
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
cp b
|
|
|
|
jr z, .done_carry
|
|
|
|
inc hl
|
|
|
|
jr .loop
|
|
|
|
|
2015-12-02 10:24:18 -08:00
|
|
|
.reached_end
|
2015-12-09 15:25:44 -08:00
|
|
|
call GetBreedmonMovePointer
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, NUM_MOVES
|
|
|
|
.loop2
|
|
|
|
ld a, [de]
|
|
|
|
cp [hl]
|
|
|
|
jr z, .found_eggmove
|
|
|
|
inc hl
|
|
|
|
dec b
|
|
|
|
jr z, .inherit_tmhm
|
|
|
|
jr .loop2
|
|
|
|
|
|
|
|
.found_eggmove
|
|
|
|
ld a, [wEggMonSpecies]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, EvosAttacksPointers
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, BANK(EvosAttacksPointers)
|
2021-01-09 12:16:05 -08:00
|
|
|
call GetFarWord
|
2015-11-10 13:53:37 -08:00
|
|
|
.loop3
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Evolutions and Attacks")
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
and a
|
|
|
|
jr nz, .loop3
|
|
|
|
.loop4
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Evolutions and Attacks")
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetFarByte
|
|
|
|
and a
|
|
|
|
jr z, .inherit_tmhm
|
|
|
|
inc hl
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Evolutions and Attacks")
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
cp b
|
|
|
|
jr z, .done_carry
|
|
|
|
inc hl
|
|
|
|
jr .loop4
|
|
|
|
|
|
|
|
.inherit_tmhm
|
|
|
|
ld hl, TMHMMoves
|
|
|
|
.loop5
|
|
|
|
ld a, BANK(TMHMMoves)
|
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
ld b, a
|
|
|
|
ld a, [de]
|
|
|
|
cp b
|
|
|
|
jr nz, .loop5
|
2015-12-02 10:24:18 -08:00
|
|
|
ld [wPutativeTMHMMove], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef CanLearnTMHMMove
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
.done_carry
|
|
|
|
pop bc
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop bc
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadEggMove:
|
2015-11-10 13:53:37 -08:00
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld a, [de]
|
|
|
|
ld b, a
|
|
|
|
ld hl, wEggMonMoves
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ld de, wEggMonMoves
|
|
|
|
ld hl, wEggMonMoves + 1
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
|
|
|
|
.done
|
|
|
|
dec hl
|
|
|
|
ld [hl], b
|
|
|
|
ld hl, wEggMonMoves
|
|
|
|
ld de, wEggMonPP
|
2018-01-16 11:30:10 -08:00
|
|
|
predef FillPP
|
2015-11-10 13:53:37 -08:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetHeritableMoves:
|
2015-11-10 13:53:37 -08:00
|
|
|
ld hl, wBreedMon2Moves
|
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
cp DITTO
|
|
|
|
jr z, .ditto1
|
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
cp DITTO
|
|
|
|
jr z, .ditto2
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, [wBreedMotherOrNonDitto]
|
2015-11-10 13:53:37 -08:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld hl, wBreedMon1Moves
|
|
|
|
ret
|
|
|
|
|
|
|
|
.ditto1
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
ld a, [wBreedMon2Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2DVs]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2DVs + 1]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs + 1], a
|
2016-05-11 14:16:03 -07:00
|
|
|
ld a, TEMPMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetGender
|
2015-11-10 13:53:37 -08:00
|
|
|
jr c, .inherit_mon2_moves
|
|
|
|
jr nz, .inherit_mon2_moves
|
|
|
|
jr .inherit_mon1_moves
|
|
|
|
|
|
|
|
.ditto2
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
ld a, [wBreedMon1Species]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1DVs]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1DVs + 1]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs + 1], a
|
2016-05-11 14:16:03 -07:00
|
|
|
ld a, TEMPMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetGender
|
2015-11-10 13:53:37 -08:00
|
|
|
jr c, .inherit_mon1_moves
|
|
|
|
jr nz, .inherit_mon1_moves
|
|
|
|
|
|
|
|
.inherit_mon2_moves
|
|
|
|
ld hl, wBreedMon2Moves
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.inherit_mon1_moves
|
|
|
|
ld hl, wBreedMon1Moves
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetBreedmonMovePointer:
|
2015-11-10 13:53:37 -08:00
|
|
|
ld hl, wBreedMon1Moves
|
|
|
|
ld a, [wBreedMon1Species]
|
|
|
|
cp DITTO
|
|
|
|
ret z
|
|
|
|
ld a, [wBreedMon2Species]
|
|
|
|
cp DITTO
|
|
|
|
jr z, .ditto
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, [wBreedMotherOrNonDitto]
|
2015-11-10 13:53:37 -08:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
.ditto
|
|
|
|
ld hl, wBreedMon2Moves
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetEggFrontpic:
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: A hatching Unown egg would not show the right letter (see docs/bugs_and_glitches.md)
|
2015-11-10 13:53:37 -08:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2015-11-10 13:53:37 -08:00
|
|
|
pop de
|
2018-01-16 11:30:10 -08:00
|
|
|
predef_jump GetMonFrontpic
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetHatchlingFrontpic:
|
2015-11-10 13:53:37 -08:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleMonDVs
|
2018-01-16 11:30:10 -08:00
|
|
|
predef GetUnownLetter
|
2015-11-10 13:53:37 -08:00
|
|
|
pop de
|
2018-01-16 11:30:10 -08:00
|
|
|
predef_jump GetAnimatedFrontpic
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Hatch_UpdateFrontpicBGMapCenter:
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
call WaitTop
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ld a, b
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapAddress + 1], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, c
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hGraphicStartTile], a
|
2015-11-10 13:53:37 -08:00
|
|
|
lb bc, 7, 7
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlaceGraphic
|
2015-11-10 13:53:37 -08:00
|
|
|
pop af
|
2015-12-10 19:26:31 -08:00
|
|
|
call Hatch_LoadFrontpicPal
|
2024-02-10 15:16:00 -08:00
|
|
|
call SetDefaultBGPAndOBP
|
2015-11-10 13:53:37 -08:00
|
|
|
jp WaitBGMap
|
|
|
|
|
2023-09-24 06:06:19 -07:00
|
|
|
EggHatch_DoSpriteAnimFrame:
|
2015-11-10 13:53:37 -08:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar PlaySpriteAnimations
|
2015-11-10 13:53:37 -08:00
|
|
|
call DelayFrame
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EggHatch_AnimationSequence:
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wNamedObjectIndex]
|
2015-11-10 13:53:37 -08:00
|
|
|
ld [wJumptableIndex], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurSpecies]
|
2015-11-10 13:53:37 -08:00
|
|
|
push af
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BlankScreen
|
2015-11-10 13:53:37 -08:00
|
|
|
call DisableLCD
|
|
|
|
ld hl, EggHatchGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2018-01-22 10:18:23 -08:00
|
|
|
ld bc, 2 tiles
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, BANK(EggHatchGFX)
|
|
|
|
call FarCopyBytes
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ClearSpriteAnims
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $00
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wJumptableIndex]
|
2015-12-09 15:25:44 -08:00
|
|
|
call GetHatchlingFrontpic
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $31
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, EGG
|
2015-12-09 15:25:44 -08:00
|
|
|
call GetEggFrontpic
|
2015-11-10 13:53:37 -08:00
|
|
|
ld de, MUSIC_EVOLUTION
|
|
|
|
call PlayMusic
|
|
|
|
call EnableLCD
|
|
|
|
hlcoord 7, 4
|
2017-12-28 04:32:33 -08:00
|
|
|
ld b, HIGH(vBGMap0)
|
2015-12-10 19:26:31 -08:00
|
|
|
ld c, $31 ; Egg tiles start here
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, EGG
|
2015-12-10 19:26:31 -08:00
|
|
|
call Hatch_UpdateFrontpicBGMapCenter
|
2015-12-02 10:24:18 -08:00
|
|
|
ld c, 80
|
2015-11-10 13:53:37 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
2018-01-11 12:36:11 -08:00
|
|
|
ld [wFrameCounter], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hSCX]
|
2015-11-10 13:53:37 -08:00
|
|
|
ld b, a
|
2015-12-02 10:24:18 -08:00
|
|
|
.outerloop
|
2018-01-11 12:36:11 -08:00
|
|
|
ld hl, wFrameCounter
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
2015-12-02 10:24:18 -08:00
|
|
|
cp 8
|
|
|
|
jr nc, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld e, [hl]
|
2015-12-02 10:24:18 -08:00
|
|
|
.loop
|
|
|
|
; wobble e times
|
|
|
|
ld a, 2
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
2015-12-02 10:24:18 -08:00
|
|
|
ld a, -2
|
2015-12-02 14:59:05 -08:00
|
|
|
ld [wGlobalAnimXOffset], a
|
2023-09-24 06:06:19 -07:00
|
|
|
call EggHatch_DoSpriteAnimFrame
|
2015-12-02 10:24:18 -08:00
|
|
|
ld c, 2
|
2015-11-10 13:53:37 -08:00
|
|
|
call DelayFrames
|
2015-12-02 10:24:18 -08:00
|
|
|
ld a, -2
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
2015-12-02 10:24:18 -08:00
|
|
|
ld a, 2
|
2015-12-02 14:59:05 -08:00
|
|
|
ld [wGlobalAnimXOffset], a
|
2023-09-24 06:06:19 -07:00
|
|
|
call EggHatch_DoSpriteAnimFrame
|
2015-12-02 10:24:18 -08:00
|
|
|
ld c, 2
|
2015-11-10 13:53:37 -08:00
|
|
|
call DelayFrames
|
|
|
|
dec e
|
2015-12-02 10:24:18 -08:00
|
|
|
jr nz, .loop
|
|
|
|
ld c, 16
|
2015-11-10 13:53:37 -08:00
|
|
|
call DelayFrames
|
2015-12-02 10:24:18 -08:00
|
|
|
call EggHatch_CrackShell
|
|
|
|
jr .outerloop
|
|
|
|
|
|
|
|
.done
|
2015-11-10 13:53:37 -08:00
|
|
|
ld de, SFX_EGG_HATCH
|
|
|
|
call PlaySFX
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hSCX], a
|
2015-12-02 14:59:05 -08:00
|
|
|
ld [wGlobalAnimXOffset], a
|
2015-11-10 13:53:37 -08:00
|
|
|
call ClearSprites
|
2015-12-10 19:26:31 -08:00
|
|
|
call Hatch_InitShellFragments
|
2015-11-10 13:53:37 -08:00
|
|
|
hlcoord 6, 3
|
2017-12-28 04:32:33 -08:00
|
|
|
ld b, HIGH(vBGMap0)
|
2015-12-10 19:26:31 -08:00
|
|
|
ld c, $00 ; Hatchling tiles start here
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wJumptableIndex]
|
2015-12-10 19:26:31 -08:00
|
|
|
call Hatch_UpdateFrontpicBGMapCenter
|
|
|
|
call Hatch_ShellFragmentLoop
|
2015-11-10 13:53:37 -08:00
|
|
|
call WaitSFX
|
|
|
|
ld a, [wJumptableIndex]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
hlcoord 6, 3
|
|
|
|
ld d, $0
|
|
|
|
ld e, ANIM_MON_HATCH
|
2018-01-16 11:30:10 -08:00
|
|
|
predef AnimateFrontpic
|
2015-11-10 13:53:37 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Hatch_LoadFrontpicPal:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPlayerHPPal], a
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_EVOLUTION
|
2015-11-10 13:53:37 -08:00
|
|
|
ld c, $0
|
2023-07-26 08:01:20 -07:00
|
|
|
jp GetCGBLayout
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EggHatch_CrackShell:
|
2018-01-11 12:36:11 -08:00
|
|
|
ld a, [wFrameCounter]
|
2015-11-10 13:53:37 -08:00
|
|
|
dec a
|
|
|
|
and $7
|
|
|
|
cp $7
|
|
|
|
ret z
|
|
|
|
srl a
|
|
|
|
ret nc
|
|
|
|
swap a
|
|
|
|
srl a
|
2023-07-26 17:50:16 -07:00
|
|
|
add 9 * TILE_WIDTH + 4
|
2015-11-10 13:53:37 -08:00
|
|
|
ld d, a
|
2023-07-26 17:50:16 -07:00
|
|
|
ld e, 11 * TILE_WIDTH
|
2023-09-24 06:06:19 -07:00
|
|
|
ld a, SPRITE_ANIM_OBJ_EGG_CRACK
|
2020-02-11 04:42:36 -08:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-02 10:24:18 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-10 13:53:37 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
ld de, SFX_EGG_CRACK
|
|
|
|
jp PlaySFX
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EggHatchGFX:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/evo/egg_hatch.2bpp"
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Hatch_InitShellFragments:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ClearSpriteAnims
|
2015-11-28 12:13:40 -08:00
|
|
|
ld hl, .SpriteData
|
2015-11-10 13:53:37 -08:00
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
2015-11-28 12:13:40 -08:00
|
|
|
cp -1
|
2015-11-10 13:53:37 -08:00
|
|
|
jr z, .done
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld c, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
push hl
|
|
|
|
push bc
|
2015-12-10 19:26:31 -08:00
|
|
|
|
2023-09-24 06:06:19 -07:00
|
|
|
ld a, SPRITE_ANIM_OBJ_EGG_HATCH
|
2020-02-11 04:42:36 -08:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-10 19:26:31 -08:00
|
|
|
|
2015-12-01 12:35:28 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-10 13:53:37 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
2015-12-10 19:26:31 -08:00
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
pop de
|
|
|
|
ld a, e
|
2015-12-05 12:38:25 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
2015-11-10 13:53:37 -08:00
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
2015-12-10 19:26:31 -08:00
|
|
|
|
2016-05-13 22:11:01 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-10 13:53:37 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], d
|
2015-12-10 19:26:31 -08:00
|
|
|
|
2015-11-10 13:53:37 -08:00
|
|
|
pop hl
|
|
|
|
jr .loop
|
|
|
|
.done
|
|
|
|
ld de, SFX_EGG_HATCH
|
|
|
|
call PlaySFX
|
2023-09-24 06:06:19 -07:00
|
|
|
call EggHatch_DoSpriteAnimFrame
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO shell_fragment
|
2018-01-02 11:50:04 -08:00
|
|
|
; y tile, y pxl, x tile, x pxl, frameset offset, ???
|
2023-07-26 17:50:16 -07:00
|
|
|
db (\1 * TILE_WIDTH) % $100 + \2, (\3 * TILE_WIDTH) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6
|
2018-01-02 11:48:24 -08:00
|
|
|
ENDM
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SpriteData:
|
2018-01-02 11:48:24 -08:00
|
|
|
shell_fragment 10, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $3c
|
|
|
|
shell_fragment 11, 4, 9, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $04
|
|
|
|
shell_fragment 10, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $30
|
|
|
|
shell_fragment 11, 4, 10, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $10
|
|
|
|
shell_fragment 10, 4, 11, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $24
|
|
|
|
shell_fragment 11, 4, 11, 0, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $1c
|
|
|
|
shell_fragment 10, 0, 9, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_1, $36
|
|
|
|
shell_fragment 12, 0, 9, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_2, $0a
|
|
|
|
shell_fragment 10, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_3, $2a
|
|
|
|
shell_fragment 12, 0, 10, 4, SPRITE_ANIM_FRAMESET_EGG_HATCH_4, $16
|
2015-11-28 12:13:40 -08:00
|
|
|
db -1
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Hatch_ShellFragmentLoop:
|
2015-12-10 19:26:31 -08:00
|
|
|
ld c, 129
|
|
|
|
.loop
|
2023-09-24 06:06:19 -07:00
|
|
|
call EggHatch_DoSpriteAnimFrame
|
2015-11-10 13:53:37 -08:00
|
|
|
dec c
|
2015-12-10 19:26:31 -08:00
|
|
|
jr nz, .loop
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DayCareMon1:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, LeftWithDayCareManText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon1Species]
|
2018-01-16 20:47:45 -08:00
|
|
|
call PlayMonCry
|
2017-12-10 10:37:15 -08:00
|
|
|
ld a, [wDayCareLady]
|
2018-01-22 10:18:23 -08:00
|
|
|
bit DAYCARELADY_HAS_MON_F, a
|
2015-12-10 19:26:31 -08:00
|
|
|
jr z, DayCareMonCursor
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2021-03-17 13:16:02 -07:00
|
|
|
ld hl, wBreedMon2Nickname
|
2015-12-10 19:26:31 -08:00
|
|
|
call DayCareMonCompatibilityText
|
2023-08-11 03:28:14 -07:00
|
|
|
jp PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DayCareMon2:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, LeftWithDayCareLadyText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
ld a, [wBreedMon2Species]
|
2018-01-16 20:47:45 -08:00
|
|
|
call PlayMonCry
|
2017-12-10 10:37:15 -08:00
|
|
|
ld a, [wDayCareMan]
|
2018-01-22 10:18:23 -08:00
|
|
|
bit DAYCAREMAN_HAS_MON_F, a
|
2015-12-10 19:26:31 -08:00
|
|
|
jr z, DayCareMonCursor
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2021-03-17 13:16:02 -07:00
|
|
|
ld hl, wBreedMon1Nickname
|
2015-12-10 19:26:31 -08:00
|
|
|
call DayCareMonCompatibilityText
|
2023-08-11 03:28:14 -07:00
|
|
|
jp PrintText1bpp
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DayCareMonCursor:
|
2015-11-10 20:23:28 -08:00
|
|
|
jp WaitPressAorB_BlinkCursor
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
LeftWithDayCareLadyText:
|
|
|
|
text_far _LeftWithDayCareLadyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
LeftWithDayCareManText:
|
|
|
|
text_far _LeftWithDayCareManText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DayCareMonCompatibilityText:
|
2015-11-10 13:53:37 -08:00
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2015-11-10 13:53:37 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2015-12-09 15:25:44 -08:00
|
|
|
call CheckBreedmonCompatibility
|
2015-11-10 13:53:37 -08:00
|
|
|
pop bc
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wBreedingCompatibility]
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedBrimmingWithEnergyText
|
2015-12-10 19:26:31 -08:00
|
|
|
cp -1
|
|
|
|
jr z, .done
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedNoInterestText
|
2015-11-10 13:53:37 -08:00
|
|
|
and a
|
2015-12-10 19:26:31 -08:00
|
|
|
jr z, .done
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedAppearsToCareForText
|
2015-11-10 13:53:37 -08:00
|
|
|
cp 230
|
2015-12-10 19:26:31 -08:00
|
|
|
jr nc, .done
|
2015-11-10 13:53:37 -08:00
|
|
|
cp 70
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedFriendlyText
|
2015-12-10 19:26:31 -08:00
|
|
|
jr nc, .done
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BreedShowsInterestText
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2015-12-10 19:26:31 -08:00
|
|
|
.done
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedBrimmingWithEnergyText:
|
|
|
|
text_far _BreedBrimmingWithEnergyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedNoInterestText:
|
|
|
|
text_far _BreedNoInterestText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedAppearsToCareForText:
|
|
|
|
text_far _BreedAppearsToCareForText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedFriendlyText:
|
|
|
|
text_far _BreedFriendlyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BreedShowsInterestText:
|
|
|
|
text_far _BreedShowsInterestText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-10 13:53:37 -08:00
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
DayCareMonPrintEmptyString: ; unreferenced
|
2015-12-10 19:26:31 -08:00
|
|
|
ld hl, .string
|
2015-11-10 13:53:37 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.string
|
2015-11-10 13:53:37 -08:00
|
|
|
db "@"
|