pokered/engine/overworld/healing_machine.asm

105 lines
2 KiB
NASM
Raw Normal View History

2014-05-22 22:13:20 +00:00
AnimateHealingMachine: ; 70433 (1c:4433)
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
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
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
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
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
PokeCenterFlashingMonitorAndHealBall: ; 704b7 (1c:44b7)
INCBIN "gfx/pokecenter_ball.2bpp"
PokeCenterOAMData: ; 704d7 (1c:44d7)
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
FlashSprite8Times: ; 704f3 (1c:44f3)
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
2015-07-19 05:34:11 +00:00
CopyHealingMachineOAM: ; 70503 (1c:4503)
; copy one OAM entry and advance the pointers
2014-05-22 22:13:20 +00:00
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ret