pokered/engine/evolution.asm

161 lines
2.7 KiB
NASM
Raw Normal View History

EvolveMon: ; 7bde9 (1e:7de9)
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
2015-08-09 05:32:44 +00:00
ld [wChannelSoundIDs + CH4], a
2014-05-22 22:13:20 +00:00
dec a
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-22 22:13:20 +00:00
call PlaySound
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], 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
ld [H_AUTOBGTRANSFERENABLED], a
2014-09-14 18:29:18 +00:00
ld [hTilesetType], a
2015-07-19 03:49:52 +00:00
ld a, [wEvoOldSpecies]
ld [wcf1d], a
2014-05-22 22:13:20 +00:00
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
ld [H_AUTOBGTRANSFERENABLED], 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
ld c, $1
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
ld [wcf1d], a
2014-05-22 22:13:20 +00:00
ld a, $ff
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-22 22:13:20 +00:00
call PlaySound
ld a, [wcf1d]
2014-05-22 22:13:20 +00:00
call PlayCry
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
EvolutionSetWholeScreenPalette: ; 7beb4 (1e:7eb4)
2014-05-22 22:13:20 +00:00
ld b, $b
jp GoPAL_SET
Evolution_LoadPic: ; 7beb9 (1e:7eb9)
2014-05-22 22:13:20 +00:00
call GetMonHeader
2015-07-18 20:52:03 +00:00
coord hl, 7, 2
2014-05-22 22:13:20 +00:00
jp LoadFlippedFrontSpriteByMonIndex
2015-07-19 03:49:52 +00:00
Evolution_BackAndForthAnim: ; 7bec2 (1e:7ec2)
; 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
2015-07-19 03:49:52 +00:00
Evolution_ChangeMonPic: ; 7bed6 (1e:7ed6)
2014-05-22 22:13:20 +00:00
push bc
xor a
ld [H_AUTOBGTRANSFERENABLED], a
2015-07-18 20:52:03 +00:00
coord hl, 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
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
call Delay3
pop bc
ret
Evolution_CheckForCancel: ; 7befa (1e:7efa)
2014-05-22 22:13:20 +00:00
call DelayFrame
push bc
2014-05-25 18:21:48 +00:00
call JoypadLowSensitivity
ld 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