pokered/engine/movie/evolution.asm

161 lines
2.8 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
EvolveMon:
2014-05-22 22:13:20 +00:00
push hl
push de
push bc
ld a, [wcf91]
2014-05-22 22:13:20 +00:00
push af
ld a, [wd0b5]
2014-05-22 22:13:20 +00:00
push af
xor a
ld [wLowHealthAlarm], a
ld [wChannelSoundIDs + Ch5], a
dec a ; SFX_STOP_ALL_MUSIC
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-22 22:13:20 +00:00
call PlaySound
ld a, $1
ldh [hAutoBGTransferEnabled], a
2015-07-19 08:46:12 +00:00
ld a, SFX_TINK
2014-05-22 22:13:20 +00:00
call PlaySound
call Delay3
xor a
ldh [hAutoBGTransferEnabled], a
ldh [hTileAnimations], a
2015-07-19 03:49:52 +00:00
ld a, [wEvoOldSpecies]
2015-08-12 09:16:56 +00:00
ld [wWholeScreenPaletteMonSpecies], a
ld c, 0
call EvolutionSetWholeScreenPalette
2015-07-19 03:49:52 +00:00
ld a, [wEvoNewSpecies]
ld [wcf91], a
ld [wd0b5], a
call Evolution_LoadPic
2014-05-29 08:31:46 +00:00
ld de, vFrontPic
ld hl, vBackPic
ld bc, 7 * 7
2014-05-22 22:13:20 +00:00
call CopyVideoData
2015-07-19 03:49:52 +00:00
ld a, [wEvoOldSpecies]
ld [wcf91], a
ld [wd0b5], a
call Evolution_LoadPic
2014-05-22 22:13:20 +00:00
ld a, $1
ldh [hAutoBGTransferEnabled], a
2015-07-19 03:49:52 +00:00
ld a, [wEvoOldSpecies]
2014-05-22 22:13:20 +00:00
call PlayCry
call WaitForSoundToFinish
ld c, BANK(Music_SafariZone)
ld a, MUSIC_SAFARI_ZONE
call PlayMusic
ld c, 80
2014-05-22 22:13:20 +00:00
call DelayFrames
2015-08-12 09:16:56 +00:00
ld c, 1 ; set PAL_BLACK instead of mon palette
call EvolutionSetWholeScreenPalette
2015-08-05 21:20:29 +00:00
lb bc, $1, $10
2015-07-19 03:49:52 +00:00
.animLoop
2014-05-22 22:13:20 +00:00
push bc
call Evolution_CheckForCancel
jr c, .evolutionCancelled
2015-07-19 03:49:52 +00:00
call Evolution_BackAndForthAnim
2014-05-22 22:13:20 +00:00
pop bc
inc b
dec c
dec c
2015-07-19 03:49:52 +00:00
jr nz, .animLoop
2014-05-22 22:13:20 +00:00
xor a
2015-07-19 03:49:52 +00:00
ld [wEvoCancelled], a
2014-05-22 22:13:20 +00:00
ld a, $31
2015-07-19 03:49:52 +00:00
ld [wEvoMonTileOffset], a
call Evolution_ChangeMonPic ; show the new species pic
ld a, [wEvoNewSpecies]
.done
2015-08-12 09:16:56 +00:00
ld [wWholeScreenPaletteMonSpecies], a
ld a, SFX_STOP_ALL_MUSIC
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-22 22:13:20 +00:00
call PlaySound
2015-08-12 09:16:56 +00:00
ld a, [wWholeScreenPaletteMonSpecies]
2014-05-22 22:13:20 +00:00
call PlayCry
2015-08-12 09:16:56 +00:00
ld c, 0
call EvolutionSetWholeScreenPalette
2014-05-22 22:13:20 +00:00
pop af
ld [wd0b5], a
2014-05-22 22:13:20 +00:00
pop af
ld [wcf91], a
2014-05-22 22:13:20 +00:00
pop bc
pop de
pop hl
2015-07-19 03:49:52 +00:00
ld a, [wEvoCancelled]
2014-05-22 22:13:20 +00:00
and a
ret z
scf
ret
.evolutionCancelled
2014-05-22 22:13:20 +00:00
pop bc
2015-07-19 03:49:52 +00:00
ld a, 1
ld [wEvoCancelled], a
ld a, [wEvoOldSpecies]
jr .done
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
EvolutionSetWholeScreenPalette:
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_POKEMON_WHOLE_SCREEN
jp RunPaletteCommand
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
Evolution_LoadPic:
2014-05-22 22:13:20 +00:00
call GetMonHeader
hlcoord 7, 2
2014-05-22 22:13:20 +00:00
jp LoadFlippedFrontSpriteByMonIndex
2016-06-12 00:24:04 +00:00
Evolution_BackAndForthAnim:
2015-07-19 03:49:52 +00:00
; show the mon change back and forth between the new and old species b times
2014-05-22 22:13:20 +00:00
ld a, $31
2015-07-19 03:49:52 +00:00
ld [wEvoMonTileOffset], a
call Evolution_ChangeMonPic
ld a, -$31
ld [wEvoMonTileOffset], a
call Evolution_ChangeMonPic
2014-05-22 22:13:20 +00:00
dec b
2015-07-19 03:49:52 +00:00
jr nz, Evolution_BackAndForthAnim
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
Evolution_ChangeMonPic:
2014-05-22 22:13:20 +00:00
push bc
xor a
ldh [hAutoBGTransferEnabled], a
hlcoord 7, 2
2015-07-19 03:49:52 +00:00
lb bc, 7, 7
ld de, SCREEN_WIDTH - 7
.loop
2014-05-22 22:13:20 +00:00
push bc
2015-07-19 03:49:52 +00:00
.innerLoop
ld a, [wEvoMonTileOffset]
2014-05-22 22:13:20 +00:00
add [hl]
ld [hli], a
dec c
2015-07-19 03:49:52 +00:00
jr nz, .innerLoop
2014-05-22 22:13:20 +00:00
pop bc
add hl, de
dec b
2015-07-19 03:49:52 +00:00
jr nz, .loop
ld a, 1
ldh [hAutoBGTransferEnabled], a
2014-05-22 22:13:20 +00:00
call Delay3
pop bc
ret
2016-06-12 00:24:04 +00:00
Evolution_CheckForCancel:
2014-05-22 22:13:20 +00:00
call DelayFrame
push bc
2014-05-25 18:21:48 +00:00
call JoypadLowSensitivity
ldh a, [hJoy5]
2014-05-22 22:13:20 +00:00
pop bc
and B_BUTTON
jr nz, .pressedB
.notAllowedToCancel
2014-05-22 22:13:20 +00:00
dec c
jr nz, Evolution_CheckForCancel
2014-05-22 22:13:20 +00:00
and a
ret
.pressedB
ld a, [wForceEvolution]
2014-05-22 22:13:20 +00:00
and a
jr nz, .notAllowedToCancel
2014-05-22 22:13:20 +00:00
scf
ret