2018-06-24 14:09:41 +00:00
|
|
|
EvolutionAnimation:
|
2015-11-09 22:00:25 +00:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurSpecies]
|
2015-11-09 22:00:25 +00:00
|
|
|
push af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rOBP0]
|
2015-11-09 22:00:25 +00:00
|
|
|
push af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBaseDexNo]
|
2015-11-09 22:00:25 +00:00
|
|
|
push af
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
call .EvolutionAnimation
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBaseDexNo], a
|
2015-11-09 22:00:25 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBP0], a
|
2015-11-09 22:00:25 +00:00
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurSpecies], a
|
2015-11-09 22:00:25 +00:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionCanceled]
|
2015-11-09 22:00:25 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.EvolutionAnimation:
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, %11100100
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBP0], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClearSpriteAnims
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
ld de, .GFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles0
|
2015-12-15 01:06:41 +00:00
|
|
|
lb bc, BANK(.GFX), 8
|
2015-11-09 22:00:25 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wLowHealthAlarm], a
|
2015-11-09 22:00:25 +00:00
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPlayerHPPal], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .PlaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2
|
|
|
|
ld hl, vTiles2 tile $31
|
2016-05-16 19:46:13 +00:00
|
|
|
ld bc, 7 * 7
|
2015-11-09 22:00:25 +00:00
|
|
|
call Request2bpp
|
|
|
|
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, 7 * 7
|
|
|
|
ld [wEvolutionPicOffset], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionNewSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .LoadFrontpic
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld [wCurSpecies], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-15 01:06:41 +00:00
|
|
|
call .check_statused
|
2015-11-09 22:00:25 +00:00
|
|
|
jr c, .skip_cry
|
|
|
|
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2018-01-17 04:47:45 +00:00
|
|
|
call PlayMonCry
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
.skip_cry
|
|
|
|
ld de, MUSIC_EVOLUTION
|
|
|
|
call PlayMusic
|
|
|
|
|
|
|
|
ld c, 80
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
ld c, $1
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
|
|
|
call .AnimationSequence
|
|
|
|
jr c, .cancel_evo
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
ld a, -7 * 7
|
2016-05-16 19:46:13 +00:00
|
|
|
ld [wEvolutionPicOffset], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
xor a
|
2016-05-16 19:46:13 +00:00
|
|
|
ld [wEvolutionCanceled], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionNewSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPlayerHPPal], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2015-12-15 01:06:41 +00:00
|
|
|
call .PlayEvolvedSFX
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClearSpriteAnims
|
2015-12-15 01:06:41 +00:00
|
|
|
call .check_statused
|
|
|
|
jr c, .no_anim
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-12-19 19:48:30 +00:00
|
|
|
ld a, [wBoxAlignment]
|
2015-11-09 22:00:25 +00:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [wBoxAlignment], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-09 22:00:25 +00:00
|
|
|
push af
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerHPPal]
|
|
|
|
ld [wCurPartySpecies], a
|
2015-11-09 22:00:25 +00:00
|
|
|
hlcoord 7, 2
|
|
|
|
ld d, $0
|
|
|
|
ld e, ANIM_MON_EVOLVE
|
2018-01-16 19:30:10 +00:00
|
|
|
predef AnimateFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-09 22:00:25 +00:00
|
|
|
pop af
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [wBoxAlignment], a
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.no_anim
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.cancel_evo
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, $1
|
2016-05-16 19:46:13 +00:00
|
|
|
ld [wEvolutionCanceled], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionOldSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wPlayerHPPal], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2015-12-15 01:06:41 +00:00
|
|
|
call .PlayEvolvedSFX
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClearSpriteAnims
|
2015-12-15 01:06:41 +00:00
|
|
|
call .check_statused
|
2015-11-09 22:00:25 +00:00
|
|
|
ret c
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerHPPal]
|
2018-01-17 04:47:45 +00:00
|
|
|
call PlayMonCry
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetSGBLayout:
|
2016-06-06 22:23:00 +00:00
|
|
|
ld b, SCGB_EVOLUTION
|
2015-11-09 22:00:25 +00:00
|
|
|
jp GetSGBLayout
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PlaceFrontpic:
|
2015-11-09 22:00:25 +00:00
|
|
|
call GetBaseData
|
|
|
|
hlcoord 7, 2
|
2015-11-11 21:11:08 +00:00
|
|
|
jp PrepMonFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LoadFrontpic:
|
2015-11-09 22:00:25 +00:00
|
|
|
call GetBaseData
|
|
|
|
ld a, $1
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [wBoxAlignment], a
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2
|
2018-01-16 19:30:10 +00:00
|
|
|
predef GetAnimatedFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
xor a
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [wBoxAlignment], a
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.AnimationSequence:
|
2015-11-09 22:00:25 +00:00
|
|
|
call ClearJoypad
|
2015-11-20 20:15:32 +00:00
|
|
|
lb bc, 1, 2 * 7 ; flash b times, wait c frames in between
|
2015-11-09 22:00:25 +00:00
|
|
|
.loop
|
|
|
|
push bc
|
2015-11-20 20:15:32 +00:00
|
|
|
call .WaitFrames_CheckPressedB
|
2015-11-09 22:00:25 +00:00
|
|
|
pop bc
|
2015-11-20 20:15:32 +00:00
|
|
|
jr c, .exit_sequence
|
2015-11-09 22:00:25 +00:00
|
|
|
push bc
|
2015-11-20 20:15:32 +00:00
|
|
|
call .Flash
|
2015-11-09 22:00:25 +00:00
|
|
|
pop bc
|
|
|
|
inc b
|
|
|
|
dec c
|
2016-05-04 15:46:23 +00:00
|
|
|
dec c
|
2015-11-09 22:00:25 +00:00
|
|
|
jr nz, .loop
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.exit_sequence
|
2015-11-09 22:00:25 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Flash:
|
2015-11-20 20:15:32 +00:00
|
|
|
ld a, -7 * 7 ; new stage
|
2016-05-16 19:46:13 +00:00
|
|
|
ld [wEvolutionPicOffset], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
|
|
|
ld a, 7 * 7 ; previous stage
|
2016-05-16 19:46:13 +00:00
|
|
|
ld [wEvolutionPicOffset], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
dec b
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nz, .Flash
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ReplaceFrontpic:
|
2015-11-09 22:00:25 +00:00
|
|
|
push bc
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-09 22:00:25 +00:00
|
|
|
hlcoord 7, 2
|
|
|
|
lb bc, 7, 7
|
2015-11-20 20:15:32 +00:00
|
|
|
ld de, SCREEN_WIDTH - 7
|
2015-11-09 22:00:25 +00:00
|
|
|
.loop1
|
|
|
|
push bc
|
|
|
|
.loop2
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionPicOffset]
|
2015-11-09 22:00:25 +00:00
|
|
|
add [hl]
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop2
|
|
|
|
pop bc
|
|
|
|
add hl, de
|
|
|
|
dec b
|
|
|
|
jr nz, .loop1
|
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-09 22:00:25 +00:00
|
|
|
call WaitBGMap
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.WaitFrames_CheckPressedB:
|
2015-11-09 22:00:25 +00:00
|
|
|
call DelayFrame
|
|
|
|
push bc
|
|
|
|
call JoyTextDelay
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoyDown]
|
2015-11-09 22:00:25 +00:00
|
|
|
pop bc
|
|
|
|
and B_BUTTON
|
|
|
|
jr nz, .pressed_b
|
2015-11-20 20:15:32 +00:00
|
|
|
.loop3
|
2015-11-09 22:00:25 +00:00
|
|
|
dec c
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nz, .WaitFrames_CheckPressedB
|
2015-11-09 22:00:25 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.pressed_b
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, [wForceEvolution]
|
2015-11-09 22:00:25 +00:00
|
|
|
and a
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nz, .loop3
|
2015-11-09 22:00:25 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.check_statused
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1Species
|
2015-11-09 22:00:25 +00:00
|
|
|
call GetPartyLocation
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckFaintedFrzSlp
|
2015-11-09 22:00:25 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PlayEvolvedSFX:
|
2016-05-16 19:46:13 +00:00
|
|
|
ld a, [wEvolutionCanceled]
|
2015-11-09 22:00:25 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld de, SFX_EVOLVED
|
|
|
|
call PlaySFX
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
ld [hl], $0
|
2015-12-15 01:06:41 +00:00
|
|
|
.loop4
|
|
|
|
call .balls_of_light
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nc, .done
|
2015-12-15 01:06:41 +00:00
|
|
|
call .AnimateBallsOfLight
|
|
|
|
jr .loop4
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.done
|
2015-11-28 20:13:40 +00:00
|
|
|
ld c, 32
|
2015-12-15 01:06:41 +00:00
|
|
|
.loop5
|
|
|
|
call .AnimateBallsOfLight
|
2015-11-09 22:00:25 +00:00
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .loop5
|
2015-11-09 22:00:25 +00:00
|
|
|
pop af
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.balls_of_light
|
2015-11-09 22:00:25 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
ld a, [hl]
|
2015-11-28 20:13:40 +00:00
|
|
|
cp 32
|
2015-11-09 22:00:25 +00:00
|
|
|
ret nc
|
|
|
|
ld d, a
|
|
|
|
inc [hl]
|
|
|
|
and $1
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .done_balls
|
2015-11-09 22:00:25 +00:00
|
|
|
ld e, $0
|
2015-12-15 01:06:41 +00:00
|
|
|
call .GenerateBallOfLight
|
2015-11-09 22:00:25 +00:00
|
|
|
ld e, $10
|
2015-12-15 01:06:41 +00:00
|
|
|
call .GenerateBallOfLight
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.done_balls
|
2015-11-09 22:00:25 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GenerateBallOfLight:
|
2015-11-09 22:00:25 +00:00
|
|
|
push de
|
2015-11-28 20:13:40 +00:00
|
|
|
depixel 9, 11
|
2017-12-09 05:50:59 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_EVOLUTION_BALL_OF_LIGHT
|
2020-02-11 12:42:36 +00:00
|
|
|
call InitSpriteAnimStruct
|
2016-05-14 05:11:01 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
2015-11-09 22:00:25 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [wJumptableIndex]
|
2015-12-15 01:06:41 +00:00
|
|
|
and %1110
|
2015-11-09 22:00:25 +00:00
|
|
|
sla a
|
|
|
|
pop de
|
|
|
|
add e
|
|
|
|
ld [hl], a
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-09 22:00:25 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-09 22:00:25 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $10
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.AnimateBallsOfLight:
|
2015-11-09 22:00:25 +00:00
|
|
|
push bc
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar PlaySpriteAnimations
|
2015-11-20 20:15:32 +00:00
|
|
|
; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hVBlankCounter]
|
2015-12-15 01:06:41 +00:00
|
|
|
and %1110
|
2015-11-09 22:00:25 +00:00
|
|
|
srl a
|
|
|
|
inc a
|
2016-05-04 15:46:23 +00:00
|
|
|
inc a
|
2015-11-09 22:00:25 +00:00
|
|
|
and $7
|
|
|
|
ld b, a
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00Attributes
|
2018-01-10 18:47:57 +00:00
|
|
|
ld c, NUM_SPRITE_OAM_STRUCTS
|
2015-12-15 01:06:41 +00:00
|
|
|
.loop6
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [hl]
|
|
|
|
or b
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; attributes
|
2018-02-03 03:55:38 +00:00
|
|
|
rept SPRITEOAMSTRUCT_LENGTH + -1
|
2016-05-10 16:31:49 +00:00
|
|
|
inc hl
|
2018-01-10 18:47:57 +00:00
|
|
|
endr
|
2015-11-09 22:00:25 +00:00
|
|
|
dec c
|
2015-12-15 01:06:41 +00:00
|
|
|
jr nz, .loop6
|
2015-11-09 22:00:25 +00:00
|
|
|
pop bc
|
|
|
|
call DelayFrame
|
|
|
|
ret
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.GFX:
|
2015-11-09 22:00:25 +00:00
|
|
|
INCBIN "gfx/evo/bubble_large.2bpp"
|
|
|
|
INCBIN "gfx/evo/bubble.2bpp"
|