2015-11-09 22:00:25 +00:00
|
|
|
EvolutionAnimation: ; 4e5e1
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld a, [CurSpecies]
|
|
|
|
push af
|
|
|
|
ld a, [rOBP0]
|
|
|
|
push af
|
|
|
|
ld a, [BaseDexNo]
|
|
|
|
push af
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
call .EvolutionAnimation
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [BaseDexNo], a
|
|
|
|
pop af
|
|
|
|
ld [rOBP0], a
|
|
|
|
pop af
|
|
|
|
ld [CurSpecies], a
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, [Buffer4]
|
2015-11-09 22:00:25 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 4e607
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.EvolutionAnimation: ; 4e607
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, $e4
|
|
|
|
ld [rOBP0], a
|
|
|
|
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
|
2015-12-02 02:54:11 +00:00
|
|
|
callba ClearSpriteAnims
|
2015-11-09 22:00:25 +00:00
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
ld de, .GFX
|
2015-11-09 22:00:25 +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
|
|
|
|
ld [Danger], a
|
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, [Buffer1]
|
|
|
|
ld [PlayerHPPal], a
|
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [Buffer1]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld [CurSpecies], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .PlaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld de, VTiles2
|
|
|
|
ld hl, VTiles2 tile $31
|
|
|
|
ld bc, $31
|
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
ld a, $31
|
|
|
|
ld [wd1ec], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [Buffer2]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld [CurSpecies], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .LoadFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [Buffer1]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld [CurSpecies], a
|
|
|
|
|
|
|
|
ld a, $1
|
|
|
|
ld [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
|
|
|
|
|
|
|
|
ld a, [Buffer1]
|
|
|
|
call PlayCry
|
|
|
|
|
|
|
|
.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
|
2015-11-09 22:00:25 +00:00
|
|
|
ld [wd1ec], a
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
2015-11-09 22:00:25 +00:00
|
|
|
xor a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [Buffer4], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld a, [Buffer2]
|
|
|
|
ld [PlayerHPPal], a
|
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2015-12-15 01:06:41 +00:00
|
|
|
call .PlayEvolvedSFX
|
2015-12-02 02:54:11 +00:00
|
|
|
callba 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
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [PlayerHPPal]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
hlcoord 7, 2
|
|
|
|
ld d, $0
|
|
|
|
ld e, ANIM_MON_EVOLVE
|
|
|
|
predef AnimateFrontpic
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
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
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [Buffer4], a
|
2015-11-09 22:00:25 +00:00
|
|
|
|
|
|
|
ld a, [Buffer1]
|
|
|
|
ld [PlayerHPPal], a
|
|
|
|
|
|
|
|
ld c, $0
|
2015-11-20 20:15:32 +00:00
|
|
|
call .GetSGBLayout
|
2015-12-15 01:06:41 +00:00
|
|
|
call .PlayEvolvedSFX
|
2015-12-02 02:54:11 +00:00
|
|
|
callba ClearSpriteAnims
|
2015-12-15 01:06:41 +00:00
|
|
|
call .check_statused
|
2015-11-09 22:00:25 +00:00
|
|
|
ret c
|
|
|
|
|
|
|
|
ld a, [PlayerHPPal]
|
|
|
|
call PlayCry
|
|
|
|
ret
|
|
|
|
; 4e703
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.GetSGBLayout: ; 4e703
|
|
|
|
ld b, SCGB_0B
|
2015-11-09 22:00:25 +00:00
|
|
|
jp GetSGBLayout
|
|
|
|
; 4e708
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.PlaceFrontpic: ; 4e708
|
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
|
|
|
; 4e711
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.LoadFrontpic: ; 4e711
|
2015-11-09 22:00:25 +00:00
|
|
|
call GetBaseData
|
|
|
|
ld a, $1
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [wBoxAlignment], a
|
2015-11-09 22:00:25 +00:00
|
|
|
ld de, VTiles2
|
2015-11-20 20:15:32 +00:00
|
|
|
predef FrontpicPredef
|
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
|
|
|
|
; 4e726
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.AnimationSequence: ; 4e726
|
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
|
|
|
|
rept 2
|
|
|
|
dec c
|
|
|
|
endr
|
|
|
|
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
|
|
|
|
; 4e741
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.Flash: ; 4e741
|
|
|
|
ld a, -7 * 7 ; new stage
|
2015-11-09 22:00:25 +00:00
|
|
|
ld [wd1ec], a
|
2015-11-20 20:15:32 +00:00
|
|
|
call .ReplaceFrontpic
|
|
|
|
ld a, 7 * 7 ; previous stage
|
2015-11-09 22:00:25 +00:00
|
|
|
ld [wd1ec], 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
|
|
|
|
; 4e755
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.ReplaceFrontpic: ; 4e755
|
2015-11-09 22:00:25 +00:00
|
|
|
push bc
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
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
|
|
|
|
ld a, [wd1ec]
|
|
|
|
add [hl]
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop2
|
|
|
|
pop bc
|
|
|
|
add hl, de
|
|
|
|
dec b
|
|
|
|
jr nz, .loop1
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call WaitBGMap
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 4e779
|
|
|
|
|
2015-11-20 20:15:32 +00:00
|
|
|
.WaitFrames_CheckPressedB: ; 4e779
|
2015-11-09 22:00:25 +00:00
|
|
|
call DelayFrame
|
|
|
|
push bc
|
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [hJoyDown]
|
|
|
|
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
|
|
|
|
; 4e794
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.check_statused: ; 4e794
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
ld hl, PartyMon1Species
|
|
|
|
call GetPartyLocation
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
callba CheckFaintedFrzSlp
|
|
|
|
ret
|
|
|
|
; 4e7a6
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.PlayEvolvedSFX: ; 4e7a6
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, [Buffer4]
|
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
|
|
|
|
; 4e7cf
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.balls_of_light: ; 4e7cf
|
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
|
|
|
|
; 4e7e8
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.GenerateBallOfLight: ; 4e7e8
|
2015-11-09 22:00:25 +00:00
|
|
|
push de
|
2015-11-28 20:13:40 +00:00
|
|
|
depixel 9, 11
|
|
|
|
ld a, SPRITE_ANIM_INDEX_13
|
2015-11-13 15:48:49 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-12-15 01:06:41 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0B
|
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
|
|
|
|
; 4e80c
|
|
|
|
|
2015-12-15 01:06:41 +00:00
|
|
|
.AnimateBallsOfLight: ; 4e80c
|
2015-11-09 22:00:25 +00:00
|
|
|
push bc
|
2015-11-28 20:13:40 +00:00
|
|
|
callab PlaySpriteAnimations
|
2015-11-20 20:15:32 +00:00
|
|
|
; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES
|
2015-11-10 04:01:45 +00:00
|
|
|
ld a, [hVBlankCounter]
|
2015-12-15 01:06:41 +00:00
|
|
|
and %1110
|
2015-11-09 22:00:25 +00:00
|
|
|
srl a
|
|
|
|
rept 2
|
|
|
|
inc a
|
|
|
|
endr
|
|
|
|
and $7
|
|
|
|
ld b, a
|
2015-11-20 20:15:32 +00:00
|
|
|
ld hl, Sprites + 3 ; attributes
|
|
|
|
ld c, 40
|
2015-12-15 01:06:41 +00:00
|
|
|
.loop6
|
2015-11-09 22:00:25 +00:00
|
|
|
ld a, [hl]
|
|
|
|
or b
|
|
|
|
ld [hli], a
|
|
|
|
rept 3
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
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
|
|
|
|
; 4e831
|
|
|
|
|
|
|
|
|
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"
|