aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/PewterPokecenter_2.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2023-11-20 00:33:27 -0600
committerdannye <33dannye@gmail.com>2023-11-20 20:23:27 -0600
commit298e99d3776580585c3f434e5d93137ae431bdd3 (patch)
treea808c4ffd0fd0f9bd28972bae5236e0d3345c8e5 /scripts/PewterPokecenter_2.asm
parentAdd sound bits documentation for wOptions (#110) (diff)
parentName 2 unnamed labels I missed in SeafoamIslandsB4F and PokemonMansion3F (#437) (diff)
downloadpokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.tar.gz
pokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.tar.xz
pokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'scripts/PewterPokecenter_2.asm')
-rw-r--r--scripts/PewterPokecenter_2.asm79
1 files changed, 79 insertions, 0 deletions
diff --git a/scripts/PewterPokecenter_2.asm b/scripts/PewterPokecenter_2.asm
new file mode 100644
index 00000000..cd0933f0
--- /dev/null
+++ b/scripts/PewterPokecenter_2.asm
@@ -0,0 +1,79 @@
+PewterPokecenterPrintCooltrainerFText::
+ ld hl, .text
+ call PrintText
+ ret
+
+.text
+ text_far _PewterPokecenterText3
+ text_end
+
+PewterJigglypuff::
+ ld a, TRUE
+ ld [wDoNotWaitForButtonPressAfterDisplayingText], a
+ ld hl, .Text
+ call PrintText
+
+ call StopAllMusic
+ ld c, 32
+ call DelayFrames
+
+ ld hl, .FacingDirections
+ ld de, wJigglypuffFacingDirections
+ ld bc, .FacingDirectionsEnd - .FacingDirections
+ 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
+
+.spinMovementLoop
+ ld a, [hl]
+ ld [wSprite03StateData1ImageIndex], a
+; rotate the array
+ push hl
+ ld hl, wJigglypuffFacingDirections
+ ld de, wJigglypuffFacingDirections - 1
+ ld bc, .FacingDirectionsEnd - .FacingDirections
+ 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 + CHAN2]
+ or b
+ jr nz, .spinMovementLoop
+
+ ld c, 48
+ call DelayFrames
+ call PlayDefaultMusic
+ ld a, [wd472]
+ bit 7, a
+ ret z
+ callfar CheckPikachuFaintedOrStatused
+ ret c
+ call DisablePikachuFollowingPlayer
+ ret
+
+.Text:
+ text_far _PewterPokecenterJigglypuffText
+ text_end
+
+.FacingDirections:
+ db $40 | SPRITE_FACING_DOWN
+ db $40 | SPRITE_FACING_LEFT
+ db $40 | SPRITE_FACING_UP
+ db $40 | SPRITE_FACING_RIGHT
+.FacingDirectionsEnd: