summaryrefslogtreecommitdiff
path: root/engine/overworld/healing_machine.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld/healing_machine.asm')
-rwxr-xr-xengine/overworld/healing_machine.asm77
1 files changed, 39 insertions, 38 deletions
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index 90d306c3..38a44cfb 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,71 +1,71 @@
-AnimateHealingMachine: ; 70433 (1c:4433)
- ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7
+AnimateHealingMachine:
+ ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
- ld bc, (BANK(PokeCenterFlashingMonitorAndHealBall) << 8) + $03
+ lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]
push af
ld [hl], $ff
push hl
- ld a, [rOBP1] ; $ff49
+ ld a, [rOBP1]
push af
ld a, $e0
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
ld hl, wOAMBuffer + $84
- ld de, PokeCenterOAMData ; $44d7
- call Func_70503
- ld a, $4
- ld [wMusicHeaderPointer], a
+ ld de, PokeCenterOAMData
+ call CopyHealingMachineOAM
+ ld a, 4
+ ld [wAudioFadeOutControl], a
ld a, $ff
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
-.asm_70464
- ld a, [wMusicHeaderPointer]
- and a
- jr nz, .asm_70464
- ld a, [wPartyCount] ; wPartyCount
+.waitLoop
+ ld a, [wAudioFadeOutControl]
+ and a ; is fade-out finished?
+ jr nz, .waitLoop ; if not, check again
+ ld a, [wPartyCount]
ld b, a
-.asm_7046e
- call Func_70503
- ld a, (SFX_02_4a - SFX_Headers_02) / 3
+.partyLoop
+ call CopyHealingMachineOAM
+ ld a, SFX_HEALING_MACHINE
call PlaySound
- ld c, $1e
+ ld c, 30
call DelayFrames
dec b
- jr nz, .asm_7046e
- ld a, [wc0ef]
- cp $1f
- ld [wc0f0], a
- jr nz, .asm_70495
+ jr nz, .partyLoop
+ ld a, [wAudioROMBank]
+ cp BANK(Audio3_UpdateMusic)
+ ld [wAudioSavedROMBank], a
+ jr nz, .next
ld a, $ff
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld a, BANK(Music_PkmnHealed)
- ld [wc0ef], a
-.asm_70495
+ ld [wAudioROMBank], a
+.next
ld a, MUSIC_PKMN_HEALED
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld d, $28
call FlashSprite8Times
-.asm_704a2
- ld a, [wc026]
- cp MUSIC_PKMN_HEALED
- jr z, .asm_704a2
- ld c, $20
+.waitLoop2
+ ld a, [wChannelSoundIDs]
+ cp MUSIC_PKMN_HEALED ; is the healed music still playing?
+ jr z, .waitLoop2 ; if so, check gain
+ ld c, 32
call DelayFrames
pop af
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
pop hl
pop af
ld [hl], a
jp UpdateSprites
-PokeCenterFlashingMonitorAndHealBall: ; 704b7 (1c:44b7)
+PokeCenterFlashingMonitorAndHealBall:
INCBIN "gfx/pokecenter_ball.2bpp"
-PokeCenterOAMData: ; 704d7 (1c:44d7)
+PokeCenterOAMData:
db $24,$34,$7C,$10 ; heal machine monitor
db $2B,$30,$7D,$10 ; pokeballs 1-6
db $2B,$38,$7D,$30
@@ -75,7 +75,7 @@ PokeCenterOAMData: ; 704d7 (1c:44d7)
db $35,$38,$7D,$30
; d = value to xor with palette
-FlashSprite8Times: ; 704f3 (1c:44f3)
+FlashSprite8Times:
ld b, 8
.loop
ld a, [rOBP1]
@@ -87,7 +87,8 @@ FlashSprite8Times: ; 704f3 (1c:44f3)
jr nz, .loop
ret
-Func_70503: ; 70503 (1c:4503)
+CopyHealingMachineOAM:
+; copy one OAM entry and advance the pointers
ld a, [de]
inc de
ld [hli], a