pokered/engine/overworld/healing_machine.asm

100 lines
2 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
2020-07-07 19:09:54 +00:00
ld hl, vChars0 tile $7c
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), 3 ; should be 2
2014-05-22 22:13:20 +00:00
call CopyVideoData
2014-09-13 07:50:56 +00:00
ld hl, wUpdateSpritesEnabled
2014-05-22 22:13:20 +00:00
ld a, [hl]
push af
ld [hl], $ff
push hl
ldh a, [rOBP1]
2014-05-22 22:13:20 +00:00
push af
ld a, $e0
ldh [rOBP1], a
2022-07-09 21:18:18 +00:00
ld hl, wShadowOAMSprite33
ld de, PokeCenterOAMData
2015-07-19 05:34:11 +00:00
call CopyHealingMachineOAM
2015-08-09 05:32:44 +00:00
ld a, 4
ld [wAudioFadeOutControl], 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-09 05:32:44 +00:00
.waitLoop
ld a, [wAudioFadeOutControl]
and a ; is fade-out finished?
jr nz, .waitLoop ; if not, check again
ld a, [wPartyCount]
2014-05-22 22:13:20 +00:00
ld b, a
2015-08-09 05:32:44 +00:00
.partyLoop
2015-07-19 05:34:11 +00:00
call CopyHealingMachineOAM
2015-07-19 08:46:12 +00:00
ld a, SFX_HEALING_MACHINE
2014-05-22 22:13:20 +00:00
call PlaySound
ld c, 30
2014-05-22 22:13:20 +00:00
call DelayFrames
dec b
2015-08-09 05:32:44 +00:00
jr nz, .partyLoop
ld a, [wAudioROMBank]
2020-11-06 15:33:58 +00:00
cp BANK("Audio Engine 3")
2015-08-09 05:32:44 +00:00
ld [wAudioSavedROMBank], a
jr nz, .next
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
2014-06-09 20:18:29 +00:00
ld a, BANK(Music_PkmnHealed)
2015-08-09 05:32:44 +00:00
ld [wAudioROMBank], a
.next
2014-05-22 22:13:20 +00:00
ld a, MUSIC_PKMN_HEALED
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-22 22:13:20 +00:00
call PlaySound
ld d, $28
2015-02-08 00:24:16 +00:00
call FlashSprite8Times
2015-08-09 05:32:44 +00:00
.waitLoop2
ld a, [wChannelSoundIDs]
cp MUSIC_PKMN_HEALED ; is the healed music still playing?
jr z, .waitLoop2 ; if so, check gain
ld c, 32
2014-05-22 22:13:20 +00:00
call DelayFrames
pop af
ldh [rOBP1], a
2014-05-22 22:13:20 +00:00
pop hl
pop af
ld [hl], a
jp UpdateSprites
2016-06-12 00:24:04 +00:00
PokeCenterFlashingMonitorAndHealBall:
2020-06-27 20:27:30 +00:00
INCBIN "gfx/overworld/heal_machine.2bpp"
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
PokeCenterOAMData:
; heal machine monitor
dbsprite 6, 4, 4, 4, $7c, OAM_OBP1
; poke balls 1-6
dbsprite 6, 5, 0, 3, $7d, OAM_OBP1
dbsprite 7, 5, 0, 3, $7d, OAM_OBP1 | OAM_HFLIP
dbsprite 6, 6, 0, 0, $7d, OAM_OBP1
dbsprite 7, 6, 0, 0, $7d, OAM_OBP1 | OAM_HFLIP
dbsprite 6, 6, 0, 5, $7d, OAM_OBP1
dbsprite 7, 6, 0, 5, $7d, OAM_OBP1 | OAM_HFLIP
2014-05-22 22:13:20 +00:00
2015-02-08 00:24:16 +00:00
; d = value to xor with palette
2016-06-12 00:24:04 +00:00
FlashSprite8Times:
2015-02-08 00:24:16 +00:00
ld b, 8
.loop
ldh a, [rOBP1]
2014-05-22 22:13:20 +00:00
xor d
ldh [rOBP1], a
2015-02-08 00:24:16 +00:00
ld c, 10
2014-05-22 22:13:20 +00:00
call DelayFrames
dec b
2015-02-08 00:24:16 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
CopyHealingMachineOAM:
2015-07-19 05:34:11 +00:00
; copy one OAM entry and advance the pointers
REPT 4
2014-05-22 22:13:20 +00:00
ld a, [de]
inc de
ld [hli], a
ENDR
2014-05-22 22:13:20 +00:00
ret