pokered/engine/overworld/healing_machine.asm

98 lines
1.8 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
2014-05-29 08:31:46 +00:00
ld hl, vChars0 + $7c0
2015-08-10 04:56:20 +00:00
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
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
ld a, [rOBP1]
2014-05-22 22:13:20 +00:00
push af
ld a, $e0
ld [rOBP1], a
ld hl, wOAMBuffer + $84
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]
cp BANK(Audio3_UpdateMusic)
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
ld [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:
2014-05-22 22:13:20 +00:00
db $24,$34,$7C,$10 ; heal machine monitor
db $2B,$30,$7D,$10 ; pokeballs 1-6
db $2B,$38,$7D,$30
db $30,$30,$7D,$10
db $30,$38,$7D,$30
db $35,$30,$7D,$10
db $35,$38,$7D,$30
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
ld a, [rOBP1]
2014-05-22 22:13:20 +00:00
xor d
2015-02-08 00:24:16 +00:00
ld [rOBP1], a
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