intro stuff

This commit is contained in:
YamaArashi 2015-07-16 22:08:34 -07:00
parent fb559f1f4e
commit 9fbd9e9a1f
4 changed files with 169 additions and 139 deletions

View file

@ -28,67 +28,78 @@ AnimateShootingStar: ; 70044 (1c:4044)
call LoadShootingStarGraphics call LoadShootingStarGraphics
ld a, (SFX_1f_67 - SFX_Headers_1f) / 3 ld a, (SFX_1f_67 - SFX_Headers_1f) / 3
call PlaySound call PlaySound
; Move the big star down and left across the screen.
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld bc, $a004 ld bc, $a004
.asm_70052 .bigStarLoop
push hl push hl
push bc push bc
.asm_70054 .bigStarInnerLoop
ld a, [hl] ld a, [hl] ; Y
add $4 add 4
ld [hli], a ld [hli], a
ld a, [hl] ld a, [hl] ; X
add $fc add -4
ld [hli], a ld [hli], a
inc hl inc hl
inc hl inc hl
dec c dec c
jr nz, .asm_70054 jr nz, .bigStarInnerLoop
ld c, $1 ld c, 1
call CheckForUserInterruption call CheckForUserInterruption
pop bc pop bc
pop hl pop hl
ret c ret c
ld a, [hl] ld a, [hl]
cp $50 cp 80
jr nz, .asm_70070 jr nz, .next
jr .asm_70052 jr .bigStarLoop
.asm_70070 .next
cp b cp b
jr nz, .asm_70052 jr nz, .bigStarLoop
; Clear big star OAM.
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld c, $4 ld c, 4
ld de, $4 ld de, 4
.asm_7007b .clearOAMLoop
ld [hl], $a0 ld [hl], 160
add hl, de add hl, de
dec c dec c
jr nz, .asm_7007b jr nz, .clearOAMLoop
ld b, $3
.asm_70083 ; Make Gamefreak logo flash.
ld b, 3
.flashLogoLoop
ld hl, rOBP0 ld hl, rOBP0
rrc [hl] rrc [hl]
rrc [hl] rrc [hl]
ld c, $a ld c, 10
call CheckForUserInterruption call CheckForUserInterruption
ret c ret c
dec b dec b
jr nz, .asm_70083 jr nz, .flashLogoLoop
; Copy 24 instances of the small stars OAM data.
; Note that their coordinates put them off-screen.
ld de, wOAMBuffer ld de, wOAMBuffer
ld a, $18 ld a, 24
.asm_70098 .initSmallStarsOAMLoop
push af push af
ld hl, OAMData_700ee ld hl, SmallStarsOAM
ld bc, $4 ld bc, 4
call CopyData call CopyData
pop af pop af
dec a dec a
jr nz, .asm_70098 jr nz, .initSmallStarsOAMLoop
; Animate the small stars falling from the Gamefreak logo.
xor a xor a
ld [wWhichTrade], a ld [wMoveDownSmallStarsOAMCount], a
ld hl, PointerTable_700f2 ld hl, SmallStarsWaveCoordsPointerTable
ld c, $6 ld c, 6
.asm_700af .smallStarsLoop
ld a, [hli] ld a, [hli]
ld e, a ld e, a
ld a, [hli] ld a, [hli]
@ -96,100 +107,109 @@ AnimateShootingStar: ; 70044 (1c:4044)
push bc push bc
push hl push hl
ld hl, wOAMBuffer + $50 ld hl, wOAMBuffer + $50
ld c, $4 ld c, 4
.asm_700ba .smallStarsInnerLoop ; introduce new wave of 4 small stars OAM entries
ld a, [de] ld a, [de]
cp $ff cp $ff
jr z, .asm_700d5 jr z, .next2
ld [hli], a ld [hli], a ; Y
inc de inc de
ld a, [de] ld a, [de]
ld [hli], a ld [hli], a ; X
inc de inc de
inc hl inc hl
inc hl inc hl
dec c dec c
jr nz, .asm_700ba jr nz, .smallStarsInnerLoop
ld a, [wWhichTrade] ld a, [wMoveDownSmallStarsOAMCount]
cp $18 cp 24
jr z, .asm_700d5 jr z, .next2
add $6 add 6 ; should be 4, but the extra 2 aren't visible on screen
ld [wWhichTrade], a ld [wMoveDownSmallStarsOAMCount], a
.asm_700d5 .next2
call Func_7011f call MoveDownSmallStars
push af push af
; shift the existing OAM entries down to make room for the next wave
ld hl, wOAMBuffer + $10 ld hl, wOAMBuffer + $10
ld de, wOAMBuffer ld de, wOAMBuffer
ld bc, $50 ld bc, $50
call CopyData call CopyData
pop af pop af
pop hl pop hl
pop bc pop bc
ret c ret c
dec c dec c
jr nz, .asm_700af jr nz, .smallStarsLoop
and a and a
ret ret
OAMData_700ee: ; 700ee (1c:40ee) SmallStarsOAM: ; 700ee (1c:40ee)
db $00,$00,$A2,$90 db $00,$00,$A2,$90
PointerTable_700f2: ; 700f2 (1c:40f2) SmallStarsWaveCoordsPointerTable: ; 700f2 (1c:40f2)
dw OAMData_700fe dw SmallStarsWave1Coords
dw OAMData_70106 dw SmallStarsWave2Coords
dw OAMData_7010e dw SmallStarsWave3Coords
dw OAMData_70116 dw SmallStarsWave4Coords
dw OAMData_7011e dw SmallStarsEmptyWave
dw OAMData_7011e dw SmallStarsEmptyWave
; each entry is only half of an OAM tile ; The stars that fall from the Gamefreak logo come in 4 waves of 4 OAM entries.
OAMData_700fe: ; 700fe (1c:40fe) ; These arrays contain the Y and X coordinates of each OAM entry.
SmallStarsWave1Coords: ; 700fe (1c:40fe)
db $68,$30 db $68,$30
db $68,$40 db $68,$40
db $68,$58 db $68,$58
db $68,$78 db $68,$78
OAMData_70106: ; 70106 (1c:4106) SmallStarsWave2Coords: ; 70106 (1c:4106)
db $68,$38 db $68,$38
db $68,$48 db $68,$48
db $68,$60 db $68,$60
db $68,$70 db $68,$70
OAMData_7010e: ; 7010e (1c:410e) SmallStarsWave3Coords: ; 7010e (1c:410e)
db $68,$34 db $68,$34
db $68,$4C db $68,$4C
db $68,$54 db $68,$54
db $68,$64 db $68,$64
OAMData_70116: ; 70116 (1c:4116) SmallStarsWave4Coords: ; 70116 (1c:4116)
db $68,$3C db $68,$3C
db $68,$5C db $68,$5C
db $68,$6C db $68,$6C
db $68,$74 db $68,$74
OAMData_7011e: ; 7011e (1c:411e) SmallStarsEmptyWave: ; 7011e (1c:411e)
db $FF db $FF
Func_7011f: ; 7011f (1c:411f) MoveDownSmallStars: ; 7011f (1c:411f)
ld b, $8 ld b, 8
.asm_70121 .loop
ld hl, wOAMBuffer + $5c ld hl, wOAMBuffer + $5c
ld a, [wWhichTrade] ld a, [wMoveDownSmallStarsOAMCount]
ld de, $fffc ld de, -4
ld c, a ld c, a
.asm_7012b .innerLoop
inc [hl] inc [hl] ; Y
add hl, de add hl, de
dec c dec c
jr nz, .asm_7012b jr nz, .innerLoop
; Toggle the palette so that the lower star in the small stars tile blinks in
; and out.
ld a, [rOBP1] ld a, [rOBP1]
xor $a0 xor %10100000
ld [rOBP1], a ld [rOBP1], a
ld c, $3
ld c, 3
call CheckForUserInterruption call CheckForUserInterruption
ret c ret c
dec b dec b
jr nz, .asm_70121 jr nz, .loop
ret ret
GameFreakLogoOAMData: ; 70140 (1c:4140) GameFreakLogoOAMData: ; 70140 (1c:4140)

View file

@ -22,16 +22,16 @@ PlayIntroScene: ; 4169d (10:569d)
ld [rOBP1], a ld [rOBP1], a
xor a xor a
ld [hSCX], a ld [hSCX], a
ld b, $3 ld b, $3 ; Gengar tiles
call Func_4183f call IntroCopyTiles
ld a, 0 ld a, 0
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
ld a, 80 ld a, 80
ld [W_BASECOORDY], a ld [W_BASECOORDY], a
ld bc, $606 ld bc, $606
call Func_417c7 call InitIntroNidorinoOAM
ld de, $28ff ld de, $28ff ; move Nidorino right by 80 pixels
call Func_4180e call IntroMoveMon
ret c ret c
; hip ; hip
@ -66,22 +66,22 @@ PlayIntroScene: ; 4169d (10:569d)
; raise ; raise
ld b, $4 ld b, $4
call Func_4183f call IntroCopyTiles
ld a, (SFX_1f_61 - SFX_Headers_1f) / 3 ld a, (SFX_1f_61 - SFX_Headers_1f) / 3
call PlaySound call PlaySound
ld de, $401 ld de, $401 ; move Gengar left by 8 pixels
call Func_4180e call IntroMoveMon
ld c, $1e ld c, $1e
call CheckForUserInterruption call CheckForUserInterruption
ret c ret c
; slash ; slash
ld b, $5 ld b, $5
call Func_4183f call IntroCopyTiles
ld a, (SFX_1f_62 - SFX_Headers_1f) / 3 ld a, (SFX_1f_62 - SFX_Headers_1f) / 3
call PlaySound call PlaySound
ld de, $800 ld de, $800 ; move Gengar right by 16 pixels
call Func_4180e call IntroMoveMon
; hip ; hip
ld a, (SFX_1f_5f - SFX_Headers_1f) / 3 ld a, (SFX_1f_5f - SFX_Headers_1f) / 3
call PlaySound call PlaySound
@ -93,10 +93,10 @@ PlayIntroScene: ; 4169d (10:569d)
call CheckForUserInterruption call CheckForUserInterruption
ret c ret c
ld de, $401 ld de, $401 ; move Gengar left by 8 pixels
call Func_4180e call IntroMoveMon
ld b, $3 ld b, $3
call Func_4183f call IntroCopyTiles
ld c, $3c ld c, $3c
call CheckForUserInterruption call CheckForUserInterruption
ret c ret c
@ -142,19 +142,19 @@ AnimateIntroNidorino: ; 41793 (10:5793)
ld a, [de] ld a, [de]
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
push de push de
ld c, $24 ld c, 6 * 6
call Func_417ae call UpdateIntroNidorinoOAM
ld c, 5 ld c, 5
call DelayFrames call DelayFrames
pop de pop de
inc de inc de
jr AnimateIntroNidorino jr AnimateIntroNidorino
Func_417ae: ; 417ae (10:57ae) UpdateIntroNidorinoOAM: ; 417ae (10:57ae)
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld a, [wd09f] ld a, [wd09f]
ld d, a ld d, a
.asm_417b5 .loop
ld a, [W_BASECOORDY] ld a, [W_BASECOORDY]
add [hl] add [hl]
ld [hli], a ld [hli], a
@ -166,105 +166,111 @@ Func_417ae: ; 417ae (10:57ae)
inc hl inc hl
inc d inc d
dec c dec c
jr nz, .asm_417b5 jr nz, .loop
ret ret
Func_417c7: ; 417c7 (10:57c7) InitIntroNidorinoOAM: ; 417c7 (10:57c7)
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld d, $0 ld d, 0
.asm_417cc .loop
push bc push bc
ld a, [W_BASECOORDY] ld a, [W_BASECOORDY]
ld e, a ld e, a
.asm_417d1 .innerLoop
ld a, e ld a, e
add $8 add 8
ld e, a ld e, a
ld [hli], a ld [hli], a ; Y
ld a, [W_BASECOORDX] ld a, [W_BASECOORDX]
ld [hli], a ld [hli], a ; X
ld a, d ld a, d
ld [hli], a ld [hli], a ; tile
ld a, $80 ld a, $80
ld [hli], a ld [hli], a ; attributes
inc d inc d
dec c dec c
jr nz, .asm_417d1 jr nz, .innerLoop
ld a, [W_BASECOORDX] ld a, [W_BASECOORDX]
add $8 add 8
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
pop bc pop bc
dec b dec b
jr nz, .asm_417cc jr nz, .loop
ret ret
Func_417f0: ; 417f0 (10:57f0) IntroClearScreen: ; 417f0 (10:57f0)
ld hl, vBGMap1 ld hl, vBGMap1
ld bc, $240 ld bc, $240
jr asm_417fe jr IntroClearCommon
Func_417f8: ; 417f8 (10:57f8) IntroClearMiddleOfScreen: ; 417f8 (10:57f8)
; clear the area of the tile map between the black bars on the top and bottom
hlCoord 0, 4 hlCoord 0, 4
ld bc, $c8 ld bc, SCREEN_WIDTH * 10
asm_417fe: ; 417fe (10:57fe)
IntroClearCommon: ; 417fe (10:57fe)
ld [hl], $0 ld [hl], $0
inc hl inc hl
dec bc dec bc
ld a, b ld a, b
or c or c
jr nz, asm_417fe jr nz, IntroClearCommon
ret ret
Func_41807: ; 41807 (10:5807) IntroPlaceBlackTiles: ; 41807 (10:5807)
ld a, $1 ld a, $1
.asm_41809 .loop
ld [hli], a ld [hli], a
dec c dec c
jr nz, .asm_41809 jr nz, .loop
ret ret
Func_4180e: ; 4180e (10:580e) IntroMoveMon: ; 4180e (10:580e)
; d = number of times to move the mon (2 pixels each time)
; e: $00 = move Gengar right, $01 = move Gengar left, $ff = move Nidorino right
ld a, e ld a, e
cp $ff cp $ff
jr z, .asm_4181d jr z, .moveNidorinoRight
cp $1 cp $1
jr z, .asm_4182d jr z, .moveGengarLeft
; move Gengar right
ld a, [hSCX] ld a, [hSCX]
dec a dec a
dec a dec a
jr .asm_41831 jr .next
.asm_4181d .moveNidorinoRight
push de push de
ld a, $2 ld a, 2
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
xor a xor a
ld [W_BASECOORDY], a ld [W_BASECOORDY], a
ld c, $24 ld c, 6 * 6
call Func_417ae call UpdateIntroNidorinoOAM
pop de pop de
.asm_4182d .moveGengarLeft
ld a, [hSCX] ld a, [hSCX]
inc a inc a
inc a inc a
.asm_41831 .next
ld [hSCX], a ld [hSCX], a
push de push de
ld c, $2 ld c, 2
call CheckForUserInterruption call CheckForUserInterruption
pop de pop de
ret c ret c
dec d dec d
jr nz, Func_4180e jr nz, IntroMoveMon
ret ret
Func_4183f: ; 4183f (10:583f) IntroCopyTiles: ; 4183f (10:583f)
hlCoord 13, 7 hlCoord 13, 7
CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842) CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842)
ld c, $0 ld c, 0
predef_jump CopyTileIDsFromList predef_jump CopyTileIDsFromList
Func_41849: ; 41849 (10:5849) PlayMoveSoundB: ; 41849 (10:5849)
; unused
predef GetMoveSoundB predef GetMoveSoundB
ld a, b ld a, b
jp PlaySound jp PlaySound
@ -303,7 +309,7 @@ PlayShootingStar: ; 4188a (10:588a)
call DisableLCD call DisableLCD
xor a xor a
ld [W_CUROPPONENT], a ld [W_CUROPPONENT], a
call Func_418e9 call IntroDrawBlackBars
call LoadIntroGraphics call LoadIntroGraphics
call EnableLCD call EnableLCD
ld hl, rLCDC ld hl, rLCDC
@ -314,36 +320,37 @@ PlayShootingStar: ; 4188a (10:588a)
callba AnimateShootingStar callba AnimateShootingStar
push af push af
pop af pop af
jr c, .asm_418d0 jr c, .next ; skip the delay if the user interrupted the animation
ld c, 40 ld c, 40
call DelayFrames call DelayFrames
.asm_418d0 .next
ld a, BANK(Music_IntroBattle) ld a, BANK(Music_IntroBattle)
ld [wc0ef], a ld [wc0ef], a
ld [wc0f0], a ld [wc0f0], a
ld a, MUSIC_INTRO_BATTLE ld a, MUSIC_INTRO_BATTLE
ld [wc0ee], a ld [wc0ee], a
call PlaySound call PlaySound
call Func_417f8 call IntroClearMiddleOfScreen
call ClearSprites call ClearSprites
jp Delay3 jp Delay3
Func_418e9: ; 418e9 (10:58e9) IntroDrawBlackBars: ; 418e9 (10:58e9)
call Func_417f0 ; clear the screen and draw black bars on the top and bottom
call IntroClearScreen
hlCoord 0, 0 hlCoord 0, 0
ld c, $50 ld c, SCREEN_WIDTH * 4
call Func_41807 call IntroPlaceBlackTiles
hlCoord 0, 14 hlCoord 0, 14
ld c, $50 ld c, SCREEN_WIDTH * 4
call Func_41807 call IntroPlaceBlackTiles
ld hl, vBGMap1 ld hl, vBGMap1
ld c, $80 ld c, $80
call Func_41807 call IntroPlaceBlackTiles
ld hl, vBGMap1 + $1c0 ld hl, vBGMap1 + $1c0
ld c, $80 ld c, $80
jp Func_41807 jp IntroPlaceBlackTiles
Func_4190c: ; 4190c (10:590c) EmptyFunc4: ; 4190c (10:590c)
ret ret
IntroNidorinoAnimation0: ; 4190d (10:590d) IntroNidorinoAnimation0: ; 4190d (10:590d)

View file

@ -74,7 +74,7 @@ PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
jr .done jr .done
; The player is on the left tile of the northern path out of Pallet Town and ; The player is on the left tile of the northern path out of Pallet Town and
; Prof. Oak is below. ; Prof. Oak is below.
; Prof. Oak is already on the right tile. ; Prof. Oak is already where he needs to be.
.playerOnLeftTile .playerOnLeftTile
ld a, $3 ld a, $3
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a

View file

@ -634,6 +634,9 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b
ds 1 ds 1
wMoveDownSmallStarsOAMCount:: ; cd3d
; the number of small stars OAM entries to move down
wChargeMoveNum:: ; cd3d wChargeMoveNum:: ; cd3d
wCoordIndex:: ; cd3d wCoordIndex:: ; cd3d