pokecrystal-board/engine/movie/evolution_animation.asm

361 lines
4.9 KiB
NASM
Raw Normal View History

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