summaryrefslogtreecommitdiff
path: root/scripts/PewterPokecenter2.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-05-20 19:40:33 -0500
committerdannye <33dannye@gmail.com>2020-05-20 20:02:53 -0500
commit10f9559eab8c93b94abb8ae8d1083704ad4e169a (patch)
tree7dbe7b152dde8a6e9b56664b5b8cdfc0d6be1253 /scripts/PewterPokecenter2.asm
parentb8954732a3eaa3a784a6e3eaaa68977a9ccd9816 (diff)
Sync with pokered
Diffstat (limited to 'scripts/PewterPokecenter2.asm')
-rwxr-xr-xscripts/PewterPokecenter2.asm78
1 files changed, 78 insertions, 0 deletions
diff --git a/scripts/PewterPokecenter2.asm b/scripts/PewterPokecenter2.asm
new file mode 100755
index 00000000..3d4de3f7
--- /dev/null
+++ b/scripts/PewterPokecenter2.asm
@@ -0,0 +1,78 @@
+Func_f1d98:
+ ld hl, PewterPokecenterText_f1d9f
+ call PrintText
+ ret
+
+PewterPokecenterText_f1d9f:
+ TX_FAR _PewterPokecenterText3
+ db "@"
+
+PewterJigglypuff:
+ ld a, $1
+ ld [wDoNotWaitForButtonPressAfterDisplayingText], a
+ ld hl, .Text
+ call PrintText
+ call StopAllMusic
+ ld c, 32
+ call DelayFrames
+ ld hl, JigglypuffFacingDirections
+ ld de, wJigglypuffFacingDirections
+ ld bc, JigglypuffFacingDirectionsEnd - JigglypuffFacingDirections
+ call CopyData
+
+ ld a, [wSprite03StateData1ImageIndex]
+ ld hl, wJigglypuffFacingDirections
+.findMatchingFacingDirectionLoop
+ cp [hl]
+ inc hl
+ jr nz, .findMatchingFacingDirectionLoop
+ dec hl
+ push hl
+ ld c, BANK(Music_JigglypuffSong)
+ ld a, MUSIC_JIGGLYPUFF_SONG
+ call PlayMusic
+ pop hl
+.loop
+ ld a, [hl]
+ ld [wSprite03StateData1ImageIndex], a
+
+; rotate the array
+ push hl
+ ld hl, wJigglypuffFacingDirections
+ ld de, wJigglypuffFacingDirections - 1
+ ld bc, JigglypuffFacingDirectionsEnd - JigglypuffFacingDirections
+ call CopyData
+ ld a, [wJigglypuffFacingDirections - 1]
+ ld [wJigglypuffFacingDirections + 3], a
+ pop hl
+
+ ld c, 24
+ call DelayFrames
+
+ ld a, [wChannelSoundIDs]
+ ld b, a
+ ld a, [wChannelSoundIDs + Ch2]
+ or b
+ jr nz, .loop
+
+ ld c, 48
+ call DelayFrames
+ call PlayDefaultMusic
+ ld a, [wd472]
+ bit 7, a
+ ret z
+ callab CheckPikachuFaintedOrStatused
+ ret c
+ call DisablePikachuFollowingPlayer
+ ret
+
+.Text
+ TX_FAR _PewterJigglypuffText
+ db "@"
+
+JigglypuffFacingDirections:
+ db $40 | SPRITE_FACING_DOWN
+ db $40 | SPRITE_FACING_LEFT
+ db $40 | SPRITE_FACING_UP
+ db $40 | SPRITE_FACING_RIGHT
+JigglypuffFacingDirectionsEnd: