pokecrystal-board/engine/crystal_intro.asm

2201 lines
35 KiB
NASM
Raw Normal View History

Copyright_GFPresents: ; e4579
2015-11-19 15:07:20 -08:00
ld de, MUSIC_NONE
call PlayMusic
call ClearBGPalettes
call ClearTileMap
2017-12-28 04:32:33 -08:00
ld a, HIGH(vBGMap0)
2015-11-19 15:07:20 -08:00
ld [hBGMapAddress + 1], a
2017-12-28 04:32:33 -08:00
xor a ; LOW(vBGMap0)
2015-11-19 15:07:20 -08:00
ld [hBGMapAddress], a
ld [hJoyDown], a
ld [hSCX], a
ld [hSCY], a
ld a, $90
ld [hWY], a
call WaitBGMap
ld b, SCGB_GAMEFREAK_LOGO
2015-11-19 15:07:20 -08:00
call GetSGBLayout
call SetPalettes
ld c, 10
call DelayFrames
2017-12-24 09:47:30 -08:00
callfar Copyright
2015-11-19 15:07:20 -08:00
call WaitBGMap
ld c, 100
call DelayFrames
call ClearTileMap
2017-12-24 09:47:30 -08:00
farcall GBCOnlyScreen
call .GetGFLogoGFX
2015-11-19 15:07:20 -08:00
.joy_loop
call JoyTextDelay
ld a, [hJoyLast]
and BUTTONS
jr nz, .pressed_button
ld a, [wJumptableIndex]
bit 7, a
jr nz, .finish
call PlaceGameFreakPresents
2017-12-24 09:47:30 -08:00
farcall PlaySpriteAnimations
2015-11-19 15:07:20 -08:00
call DelayFrame
jr .joy_loop
.pressed_button
call .StopGamefreakAnim
2015-11-19 15:07:20 -08:00
scf
ret
.finish
call .StopGamefreakAnim
2015-11-19 15:07:20 -08:00
and a
ret
; e45e8
.GetGFLogoGFX: ; e45e8
2015-11-19 15:07:20 -08:00
ld de, GameFreakLogo
2017-12-28 04:32:33 -08:00
ld hl, vTiles2
2018-01-14 16:43:35 -08:00
lb bc, BANK(GameFreakLogo), 28
2015-11-19 15:07:20 -08:00
call Get1bpp
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, IntroLogoGFX
ld de, wDecompressScratch
2015-11-19 15:07:20 -08:00
ld a, BANK(IntroLogoGFX)
call FarDecompress
2017-12-28 04:32:33 -08:00
ld hl, vTiles0
ld de, wDecompressScratch
2015-11-19 15:07:20 -08:00
lb bc, 1, 8 tiles
call Request2bpp
2017-12-28 04:32:33 -08:00
ld hl, vTiles1
ld de, wDecompressScratch + $80 tiles
2015-11-19 15:07:20 -08:00
lb bc, 1, 8 tiles
call Request2bpp
pop af
ld [rSVBK], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-11-19 15:07:20 -08:00
depixel 10, 11, 4, 0
2015-12-18 17:07:09 -08:00
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_YOFFSET
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $a0
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $60
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $30
xor a
ld [wJumptableIndex], a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld [hSCX], a
ld [hSCY], a
ld a, $1
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
lb de, %11100100, %11100100
2015-11-19 15:07:20 -08:00
call DmgToCgbObjPals
ret
; e465e
.StopGamefreakAnim: ; e465e
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-11-19 15:07:20 -08:00
call ClearTileMap
call ClearSprites
ld c, 16
call DelayFrames
ret
; e4670
PlaceGameFreakPresents: ; e4670
ld a, [wJumptableIndex]
ld e, a
ld d, 0
2015-12-26 18:59:03 -08:00
ld hl, .dw
2015-11-19 15:07:20 -08:00
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-11-19 15:07:20 -08:00
; e467f
.dw ; e467f
2015-11-19 15:07:20 -08:00
dw PlaceGameFreakPresents_0
dw PlaceGameFreakPresents_1
dw PlaceGameFreakPresents_2
dw PlaceGameFreakPresents_3
; e4687
PlaceGameFreakPresents_AdvanceIndex: ; e4687
ld hl, wJumptableIndex
inc [hl]
ret
; e468c
PlaceGameFreakPresents_0: ; e468c
ret
; e468d
PlaceGameFreakPresents_1: ; e468d
2018-01-11 12:36:11 -08:00
ld hl, wIntroSceneTimer
2015-11-19 15:07:20 -08:00
ld a, [hl]
cp $20
jr nc, .PlaceGameFreak
inc [hl]
ret
.PlaceGameFreak:
2015-11-19 15:07:20 -08:00
ld [hl], 0
ld hl, .GAME_FREAK
decoord 5, 10
ld bc, .end - .GAME_FREAK
call CopyBytes
call PlaceGameFreakPresents_AdvanceIndex
ld de, SFX_GAME_FREAK_PRESENTS
call PlaySFX
ret
; e46af
.GAME_FREAK:
2015-11-19 15:07:20 -08:00
; G A M E _ F R E A K
db 0, 1, 2, 3, 13, 4, 5, 3, 1, 6
.end
db "@"
; e46ba
PlaceGameFreakPresents_2: ; e46ba
2018-01-11 12:36:11 -08:00
ld hl, wIntroSceneTimer
2015-11-19 15:07:20 -08:00
ld a, [hl]
cp $40
jr nc, .place_presents
inc [hl]
ret
.place_presents
ld [hl], 0
ld hl, .presents
decoord 7, 11
2015-11-19 15:07:20 -08:00
ld bc, .end - .presents
call CopyBytes
call PlaceGameFreakPresents_AdvanceIndex
ret
; e46d6
.presents
db 7, 8, 9, 10, 11, 12
.end
db "@"
; e46dd
PlaceGameFreakPresents_3: ; e46dd
2018-01-11 12:36:11 -08:00
ld hl, wIntroSceneTimer
2015-11-19 15:07:20 -08:00
ld a, [hl]
cp $80
jr nc, .finish
inc [hl]
ret
.finish
ld hl, wJumptableIndex
set 7, [hl]
ret
; e46ed
GameFreakLogoJumper: ; e46ed (39:46ed)
2016-05-13 22:11:01 -07:00
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
2015-11-19 15:07:20 -08:00
add hl, bc
ld e, [hl]
ld d, 0
ld hl, GameFreakLogoScenes
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-11-19 15:07:20 -08:00
GameFreakLogoScenes: ; e46fd (39:46fd)
dw GameFreakLogoScene1
dw GameFreakLogoScene2
dw GameFreakLogoScene3
dw GameFreakLogoScene4
dw GameFreakLogoScene5
GameFreakLogoScene1: ; e4707 (39:4707)
2016-05-13 22:11:01 -07:00
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
2015-11-19 15:07:20 -08:00
add hl, bc
inc [hl]
ret
GameFreakLogoScene2: ; e470d (39:470d)
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
and a
jr z, .asm_e4747
ld d, a
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
2018-01-11 09:00:01 -08:00
and %111111
cp %100000
2015-11-19 15:07:20 -08:00
jr nc, .asm_e4723
2018-01-11 09:00:01 -08:00
add %100000
2015-11-19 15:07:20 -08:00
.asm_e4723
ld e, a
2017-12-24 09:47:30 -08:00
farcall BattleAnim_Sine_e
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_YOFFSET
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], e
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
dec [hl]
and $1f
ret nz
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
sub $30
ld [hl], a
ld de, SFX_DITTO_BOUNCE
call PlaySFX
ret
2015-12-04 05:46:11 -08:00
2015-11-19 15:07:20 -08:00
.asm_e4747
2016-05-13 22:11:01 -07:00
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
2015-11-19 15:07:20 -08:00
add hl, bc
inc [hl]
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $0
ld de, SFX_DITTO_POP_UP
call PlaySFX
ret
GameFreakLogoScene3: ; e4759 (39:4759)
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
cp $20
jr nc, .asm_e4764
inc [hl]
ret
2015-12-04 05:46:11 -08:00
2015-11-19 15:07:20 -08:00
.asm_e4764
2016-05-13 22:11:01 -07:00
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
2015-11-19 15:07:20 -08:00
add hl, bc
inc [hl]
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $0
ld de, SFX_DITTO_TRANSFORM
call PlaySFX
ret
GameFreakLogoScene4: ; e4776 (39:4776)
2015-12-04 05:46:11 -08:00
ld hl, SPRITEANIMSTRUCT_0D
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hl]
cp $40
jr z, .asm_e47a3
inc [hl]
srl a
srl a
ld e, a
ld d, $0
ld hl, GameFreakLogoPalettes
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wOBPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld a, [hli]
2018-01-01 06:08:21 -08:00
ld [wOBPals2 + 12], a
2015-11-19 15:07:20 -08:00
ld a, [hli]
2018-01-01 06:08:21 -08:00
ld [wOBPals2 + 13], a
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
2015-12-04 05:46:11 -08:00
2015-11-19 15:07:20 -08:00
.asm_e47a3
2016-05-13 22:11:01 -07:00
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
2015-11-19 15:07:20 -08:00
add hl, bc
inc [hl]
call PlaceGameFreakPresents_AdvanceIndex
GameFreakLogoScene5: ; e47ab (39:47ab)
ret
; e47ac (39:47ac)
GameFreakLogoPalettes: ; e47ac
INCLUDE "gfx/intro/gamefreak_logo.pal"
2015-12-02 14:59:05 -08:00
; e47cc
2015-11-19 15:07:20 -08:00
GameFreakLogo: ; e47cc
2017-06-20 21:13:09 -07:00
INCBIN "gfx/splash/logo1.1bpp"
INCBIN "gfx/splash/logo2.1bpp"
2015-11-19 15:07:20 -08:00
; e48ac
CrystalIntro: ; e48ac
ld a, [rSVBK]
push af
ld a, BANK(wGBCPalettes)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld a, [hInMenu]
push af
ld a, [hVBlank]
push af
call .InitRAMAddrs
.loop ; e48bc
2015-11-19 15:07:20 -08:00
call JoyTextDelay
ld a, [hJoyLast]
and BUTTONS
jr nz, .ShutOffMusic
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
call IntroSceneJumper
2017-12-24 09:47:30 -08:00
farcall PlaySpriteAnimations
2015-11-19 15:07:20 -08:00
call DelayFrame
jp .loop
.ShutOffMusic:
2015-11-19 15:07:20 -08:00
ld de, MUSIC_NONE
call PlayMusic
.done
call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
pop af
ld [hVBlank], a
pop af
ld [hInMenu], a
pop af
ld [rSVBK], a
ret
; e4901
.InitRAMAddrs: ; e4901
2015-11-19 15:07:20 -08:00
xor a
ld [hVBlank], a
ld a, $1
ld [hInMenu], a
xor a
ld [hMapAnims], a
ld [wJumptableIndex], a
ret
; e490f
IntroSceneJumper: ; e490f
ld a, [wJumptableIndex]
ld e, a
ld d, 0
ld hl, IntroScenes
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-11-19 15:07:20 -08:00
; e491e
IntroScenes: ; e491e (39:491e)
dw IntroScene1
dw IntroScene2
dw IntroScene3
dw IntroScene4
dw IntroScene5
dw IntroScene6
dw IntroScene7
dw IntroScene8
dw IntroScene9
dw IntroScene10
dw IntroScene11
dw IntroScene12
dw IntroScene13
dw IntroScene14
dw IntroScene15
dw IntroScene16
dw IntroScene17
dw IntroScene18
dw IntroScene19
dw IntroScene20
dw IntroScene21
dw IntroScene22
dw IntroScene23
dw IntroScene24
dw IntroScene25
dw IntroScene26
dw IntroScene27
dw IntroScene28
NextIntroScene: ; e4956 (39:4956)
ld hl, wJumptableIndex
inc [hl]
ret
IntroScene1: ; e495b (39:495b)
; Setup the next scene.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap001
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroUnownsGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroPulseGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap002
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene2: ; e49d6 (39:49d6)
; First Unown (A) fades in, pulses, then fades out.
ld hl, wIntroSceneFrameCounter
ld a, [hl]
inc [hl]
cp $80
jr nc, .endscene
cp $60
jr nz, .DontPlaySound
push af
2015-12-02 14:59:05 -08:00
depixel 11, 11
call CrystalIntro_InitUnownAnim
2015-11-19 15:07:20 -08:00
ld de, SFX_INTRO_UNOWN_1
call PlaySFX
pop af
.DontPlaySound:
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
call CrystalIntro_UnownFade
2015-11-19 15:07:20 -08:00
ret
.endscene
call NextIntroScene
ret
IntroScene3: ; e49fd (39:49fd)
; More setup. Transition to the outdoor scene.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap003
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroBackgroundGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap004
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2015-12-02 14:59:05 -08:00
call Intro_ResetLYOverrides
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
ld [wIntroSceneFrameCounter], a
call NextIntroScene
ret
IntroScene4: ; e4a69 (39:4a69)
; Scroll the outdoor panorama for a bit.
2015-12-02 14:59:05 -08:00
call Intro_PerspectiveScrollBG
2015-11-19 15:07:20 -08:00
ld hl, wIntroSceneFrameCounter
ld a, [hl]
cp $80
jr z, .endscene
inc [hl]
ret
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
.endscene
call NextIntroScene
ret
IntroScene5: ; e4a7a (39:4a7a)
; Go back to the Unown.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
2016-06-13 19:53:33 -07:00
ld [hLCDCPointer], a
2015-11-19 15:07:20 -08:00
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap005
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroUnownsGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroPulseGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap006
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene6: ; e4af7 (39:4af7)
; Two more Unown (I, H) fade in.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $80
jr nc, .endscene
cp $60
jr z, .SecondUnown
cp $40
jr nc, .StopUnown
cp $20
jr z, .FirstUnown
jr .NoUnown
2015-12-02 14:59:05 -08:00
.FirstUnown:
2015-11-19 15:07:20 -08:00
push af
2015-12-02 14:59:05 -08:00
depixel 7, 15
call CrystalIntro_InitUnownAnim
2015-11-19 15:07:20 -08:00
ld de, SFX_INTRO_UNOWN_2
call PlaySFX
pop af
.NoUnown:
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
call CrystalIntro_UnownFade
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.SecondUnown:
2015-11-19 15:07:20 -08:00
push af
2015-12-02 14:59:05 -08:00
depixel 14, 6
call CrystalIntro_InitUnownAnim
2015-11-19 15:07:20 -08:00
ld de, SFX_INTRO_UNOWN_1
call PlaySFX
pop af
.StopUnown:
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld a, $1
2015-12-02 14:59:05 -08:00
call CrystalIntro_UnownFade
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
.endscene
call NextIntroScene
ret
IntroScene7: ; e4b3f (39:4b3f)
; Back to the outdoor scene.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap003
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroPichuWooperGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroSuicuneRunGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_255Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroBackgroundGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap004
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2015-12-02 14:59:05 -08:00
call Intro_ResetLYOverrides
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-11-19 15:07:20 -08:00
depixel 13, 27, 4, 0
ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
ld a, $f0
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene8: ; e4bd3 (39:4bd3)
; Scroll the scene, then show Suicune running across the screen.
ld hl, wIntroSceneFrameCounter
ld a, [hl]
inc [hl]
cp $40
2015-12-02 14:59:05 -08:00
jr z, .suicune_sound
jr nc, .animate_suicune
call Intro_PerspectiveScrollBG
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.suicune_sound
2015-11-19 15:07:20 -08:00
ld de, SFX_INTRO_SUICUNE_3
call PlaySFX
2015-12-02 14:59:05 -08:00
.animate_suicune
ld a, [wGlobalAnimXOffset]
2015-11-19 15:07:20 -08:00
and a
2015-12-02 14:59:05 -08:00
jr z, .finish
2015-11-19 15:07:20 -08:00
sub $8
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.finish
2015-11-19 15:07:20 -08:00
ld de, SFX_INTRO_SUICUNE_2
call PlaySFX
2017-12-24 09:47:30 -08:00
farcall DeinitializeAllSprites
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
2016-06-13 19:53:33 -07:00
ld [hLCDCPointer], a
2015-11-19 15:07:20 -08:00
call ClearSprites
2018-01-23 14:39:09 -08:00
hlcoord 0, 0, wAttrMap
2015-12-02 14:59:05 -08:00
; first 12 rows have palette 1
ld bc, 12 * SCREEN_WIDTH
2015-11-19 15:07:20 -08:00
ld a, $1
call ByteFill
2015-12-02 14:59:05 -08:00
; middle 3 rows have palette 2
ld bc, 3 * SCREEN_WIDTH
2015-11-19 15:07:20 -08:00
ld a, $2
call ByteFill
2015-12-02 14:59:05 -08:00
; last three rows have palette 3
ld bc, 3 * SCREEN_WIDTH
2015-11-19 15:07:20 -08:00
ld a, $3
call ByteFill
ld a, $2
ld [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
2015-12-02 14:59:05 -08:00
ld a, $c ; $980c
2015-11-19 15:07:20 -08:00
ld [hBGMapAddress], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a
ld [hBGMapAddress], a
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene10: ; e4c4f (39:4c4f)
; Wooper and Pichu enter.
2015-12-02 14:59:05 -08:00
call Intro_RustleGrass
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $c0
jr z, .done
cp $20
jr z, .wooper
cp $40
jr z, .pichu
ret
.pichu
depixel 21, 16, 1, 0
ld a, SPRITE_ANIM_INDEX_INTRO_PICHU
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
call PlaySFX
ret
.wooper
depixel 22, 6
ld a, SPRITE_ANIM_INDEX_INTRO_WOOPER
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
call PlaySFX
ret
.done
call NextIntroScene
ret
IntroScene11: ; e4c86 (39:4c86)
; Back to Unown again.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
2016-06-13 19:53:33 -07:00
ld [hLCDCPointer], a
2015-11-19 15:07:20 -08:00
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap007
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroUnownsGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap008
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_365ad
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene12: ; e4cfa (39:4cfa)
; Even more Unown.
2015-12-02 14:59:05 -08:00
call .PlayUnownSound
2015-11-19 15:07:20 -08:00
ld hl, wIntroSceneFrameCounter
ld a, [hl]
inc [hl]
cp $c0
2015-12-02 14:59:05 -08:00
jr nc, .done
2015-11-19 15:07:20 -08:00
cp $80
2015-12-02 14:59:05 -08:00
jr nc, .second_half
; first half
2015-11-19 15:07:20 -08:00
ld c, a
and $1f
sla a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld a, c
and $e0
srl a
swap a
2015-12-02 14:59:05 -08:00
call CrystalIntro_UnownFade
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.second_half
; double speed
2015-11-19 15:07:20 -08:00
ld c, a
and $f
sla a
sla a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld a, c
and $70
or $40
swap a
2015-12-02 14:59:05 -08:00
call CrystalIntro_UnownFade
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.done
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
2015-12-02 14:59:05 -08:00
.PlayUnownSound: ; e4d36 (39:4d36)
2015-11-19 15:07:20 -08:00
ld a, [wIntroSceneFrameCounter]
ld c, a
ld hl, .UnownSounds
.loop
ld a, [hli]
cp -1
ret z
cp c
jr z, .playsound
inc hl
inc hl
2015-11-19 15:07:20 -08:00
jr .loop
.playsound
ld a, [hli]
ld d, [hl]
ld e, a
push de
call SFXChannelsOff
pop de
call PlaySFX
ret
; e4d54 (39:4d54)
.UnownSounds: ; e4d54
dbw $00, SFX_INTRO_UNOWN_3
dbw $20, SFX_INTRO_UNOWN_2
dbw $40, SFX_INTRO_UNOWN_1
dbw $60, SFX_INTRO_UNOWN_2
dbw $80, SFX_INTRO_UNOWN_3
dbw $90, SFX_INTRO_UNOWN_2
dbw $a0, SFX_INTRO_UNOWN_1
dbw $b0, SFX_INTRO_UNOWN_2
2015-12-02 14:59:05 -08:00
db -1 ; e4d6d
2015-11-19 15:07:20 -08:00
IntroScene13: ; e4d6d (39:4d6d)
; Switch scenes again.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap003
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroSuicuneRunGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_255Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroBackgroundGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap004
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e5edd
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-11-19 15:07:20 -08:00
depixel 13, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
ld de, MUSIC_CRYSTAL_OPENING
call PlayMusic
xor a
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene14: ; e4dfa (39:4dfa)
; Suicune runs then jumps.
ld a, [hSCX]
sub 10
ld [hSCX], a
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $80
jr z, .done
cp $60
jr z, .jump
jr nc, .asm_e4e1a
cp $40
jr nc, .asm_e4e33
ret
.jump
ld de, SFX_INTRO_SUICUNE_4
call PlaySFX
.asm_e4e1a
ld a, $1
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-12-02 14:59:05 -08:00
ld a, [wGlobalAnimXOffset]
2015-11-19 15:07:20 -08:00
cp $88
jr c, .asm_e4e2c
sub $8
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
2015-11-19 15:07:20 -08:00
ret
.asm_e4e2c
2017-12-24 09:47:30 -08:00
farcall DeinitializeAllSprites
2015-11-19 15:07:20 -08:00
ret
.asm_e4e33
2015-12-02 14:59:05 -08:00
ld a, [wGlobalAnimXOffset]
2015-11-19 15:07:20 -08:00
sub $2
2015-12-02 14:59:05 -08:00
ld [wGlobalAnimXOffset], a
2015-11-19 15:07:20 -08:00
ret
.done
call NextIntroScene
ret
IntroScene15: ; e4e40 (39:4e40)
; Transition to a new scene.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap009
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroSuicuneJumpGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroUnownBackGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
ld de, IntroGrass4GFX
2017-12-28 04:32:33 -08:00
ld hl, vTiles1 tile $00
2015-12-02 14:59:05 -08:00
lb bc, BANK(IntroGrass4GFX), 1
2015-11-19 15:07:20 -08:00
call Request2bpp
ld hl, IntroTilemap010
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
call Intro_LoadTilemap
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e77dd
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e77dd
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld a, $90
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
depixel 8, 5
ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN_F
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
depixel 12, 0
ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene16: ; e4edc (39:4edc)
; Suicune shows its face. An Unown appears in front.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $80
jr nc, .done
2015-12-02 14:59:05 -08:00
call Intro_Scene16_AnimateSuicune
2015-11-19 15:07:20 -08:00
ld a, [hSCY]
and a
ret z
add 8
ld [hSCY], a
ret
.done
call NextIntroScene
ret
IntroScene17: ; e4ef5 (39:4ef5)
; ...
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap011
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroSuicuneCloseGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles1 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_255Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap012
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e6d6d
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e6d6d
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene18: ; e4f67 (39:4f67)
; Suicune close up.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $60
jr nc, .done
ld a, [hSCX]
cp $60
ret z
add 8
ld [hSCX], a
ret
.done
call NextIntroScene
ret
IntroScene19: ; e4f7e (39:4f7e)
; More setup.
2015-12-02 14:59:05 -08:00
call Intro_ClearBGPals
2015-11-19 15:07:20 -08:00
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap013
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroSuicuneBackGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroUnownsGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles1 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
ld de, IntroGrass4GFX
2017-12-28 04:32:33 -08:00
ld hl, vTiles1 tile $7f
2015-12-02 14:59:05 -08:00
lb bc, BANK(IntroGrass4GFX), 1
2015-11-19 15:07:20 -08:00
call Request2bpp
ld hl, IntroTilemap014
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
call Intro_LoadTilemap
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e77dd
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e77dd
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld a, $d8
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-04 05:46:11 -08:00
ld hl, wSpriteAnimDict
2015-11-19 15:07:20 -08:00
xor a
ld [hli], a
ld [hl], $7f
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
depixel 12, 0
ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene20: ; e5019 (39:5019)
; Suicune running away. A bunch of Unown appear.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $98
2015-12-02 14:59:05 -08:00
jr nc, .finished
2015-11-19 15:07:20 -08:00
cp $58
ret nc
cp $40
2015-12-02 14:59:05 -08:00
jr nc, .AppearUnown
2015-11-19 15:07:20 -08:00
cp $28
ret nc
ld a, [hSCY]
inc a
ld [hSCY], a
ret
.AppearUnown:
2015-11-19 15:07:20 -08:00
sub $18
ld c, a
and $3
cp $3
ret nz
ld a, c
and $1c
srl a
srl a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
call Intro_Scene20_AppearUnown
2015-11-19 15:07:20 -08:00
ret
; e5049 (39:5049)
2015-12-02 14:59:05 -08:00
; unused
2015-11-19 15:07:20 -08:00
ld a, c
and $1c
srl a
srl a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld a, 1
2015-12-02 14:59:05 -08:00
call Intro_Scene20_AppearUnown
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.finished
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene21: ; e505d (39:505d)
; Suicune gets more distant and turns black.
2015-12-02 14:59:05 -08:00
call Intro_ColoredSuicuneFrameSwap
2015-11-19 15:07:20 -08:00
ld c, 3
call DelayFrames
xor a
ld [hBGMapMode], a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene22: ; e5072 (39:5072)
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $8
jr nc, .done
ret
.done
2017-12-24 09:47:30 -08:00
farcall DeinitializeAllSprites
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene23: ; e5086 (39:5086)
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene24: ; e508e (39:508e)
; Fade to white.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $20
jr nc, .done
ld c, a
and $3
ret nz
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld a, c
and $1c
sla a
2015-12-02 14:59:05 -08:00
call Intro_Scene24_ApplyPaletteFade
2015-11-19 15:07:20 -08:00
ret
.done
ld a, $40
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene25: ; e50ad (39:50ad)
; Wait around a bit.
2015-12-02 14:59:05 -08:00
ld a, [wIntroSceneFrameCounter]
2015-11-19 15:07:20 -08:00
dec a
jr z, .done
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
.done
call NextIntroScene
ret
IntroScene26: ; e50bb (39:50bb)
; Load the final scene.
call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap015
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, $0
ld [rVBK], a
ld hl, IntroCrystalUnownsGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $00
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_128Tiles
2015-11-19 15:07:20 -08:00
ld hl, IntroTilemap017
2015-11-20 08:47:52 -08:00
debgcoord 0, 0
2015-12-02 14:59:05 -08:00
call Intro_DecompressRequest2bpp_64Tiles
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals1)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
ld hl, Palette_e679d
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld hl, Palette_e679d
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ld [rSVBK], a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
2017-12-24 09:47:30 -08:00
farcall ClearSpriteAnims
2015-12-02 14:59:05 -08:00
call Intro_SetCGBPalUpdate
2015-11-19 15:07:20 -08:00
xor a
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
call NextIntroScene
ret
IntroScene27: ; e512d (39:512d)
; Spell out C R Y S T A L with Unown.
2018-01-11 12:36:11 -08:00
ld hl, wIntroSceneTimer
2015-11-19 15:07:20 -08:00
inc [hl]
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc [hl]
cp $80
jr nc, .done
ld c, a
and $f
2018-01-11 12:36:11 -08:00
ld [wIntroSceneTimer], a
2015-11-19 15:07:20 -08:00
ld a, c
and $70
swap a
2015-12-02 14:59:05 -08:00
call Intro_FadeUnownWordPals
2015-11-19 15:07:20 -08:00
ret
.done
call NextIntroScene
ld a, $80
2015-12-02 14:59:05 -08:00
ld [wIntroSceneFrameCounter], a
2015-11-19 15:07:20 -08:00
ret
IntroScene28: ; e5152 (39:5152)
; Cut out when the music ends, and lead into the title screen.
2015-12-02 14:59:05 -08:00
ld hl, wIntroSceneFrameCounter
2015-11-19 15:07:20 -08:00
ld a, [hl]
and a
jr z, .done
dec [hl]
cp $18
jr z, .clear
cp $8
ret nz
ld de, SFX_UNKNOWN_CB
call PlaySFX
ret
.clear
call ClearBGPalettes
ret
.done
ld hl, wJumptableIndex
set 7, [hl]
ret
2015-12-02 14:59:05 -08:00
Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172)
2018-01-01 06:08:21 -08:00
; load the (a)th palette from .FadePals to all wBGPals2
2015-12-02 14:59:05 -08:00
ld hl, .FadePals
2015-11-19 15:07:20 -08:00
add l
ld l, a
ld a, $0
adc h
ld h, a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2015-12-02 14:59:05 -08:00
ld b, 8 ; number of BG pals
.loop1
2015-11-19 15:07:20 -08:00
push hl
2018-01-01 05:47:16 -08:00
ld c, 1 palettes
2015-12-02 14:59:05 -08:00
.loop2
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld [de], a
inc de
dec c
2015-12-02 14:59:05 -08:00
jr nz, .loop2
2015-11-19 15:07:20 -08:00
pop hl
dec b
2015-12-02 14:59:05 -08:00
jr nz, .loop1
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; e519c (39:519c)
2015-12-02 14:59:05 -08:00
.FadePals: ; e519c
INCLUDE "gfx/intro/fade.pal"
2015-11-19 15:07:20 -08:00
; e51dc
2015-12-02 14:59:05 -08:00
CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
2015-11-19 15:07:20 -08:00
push de
ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
2015-12-02 14:59:05 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $8
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_4
2015-12-05 12:38:25 -08:00
call ReinitSpriteAnimFrame
2015-11-19 15:07:20 -08:00
pop de
push de
ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
2015-12-02 14:59:05 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $18
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_3
2015-12-05 12:38:25 -08:00
call ReinitSpriteAnimFrame
2015-11-19 15:07:20 -08:00
pop de
push de
ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
2015-12-02 14:59:05 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $28
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_1
2015-12-05 12:38:25 -08:00
call ReinitSpriteAnimFrame
2015-11-19 15:07:20 -08:00
pop de
ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
2015-11-19 15:07:20 -08:00
call _InitSpriteAnimStruct
2015-12-02 14:59:05 -08:00
ld hl, SPRITEANIMSTRUCT_0C
2015-11-19 15:07:20 -08:00
add hl, bc
ld [hl], $38
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_2
2015-12-05 12:38:25 -08:00
call ReinitSpriteAnimFrame
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
CrystalIntro_UnownFade: ; e5223 (39:5223)
2015-11-19 15:07:20 -08:00
add a
add a
add a
2015-11-19 15:07:20 -08:00
ld e, a
ld d, $0
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2015-11-19 15:07:20 -08:00
add hl, de
inc hl
inc hl
2018-01-11 12:36:11 -08:00
ld a, [wIntroSceneTimer]
2018-01-11 09:00:01 -08:00
and %111111
cp %011111
2015-12-02 14:59:05 -08:00
jr z, .okay
jr c, .okay
2015-11-19 15:07:20 -08:00
ld c, a
2018-01-11 09:00:01 -08:00
ld a, %111111
2015-11-19 15:07:20 -08:00
sub c
2015-12-02 14:59:05 -08:00
.okay
2015-11-19 15:07:20 -08:00
ld c, a
ld b, $0
ld a, [rSVBK]
push af
ld a, BANK(wBGPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
push bc
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 8 palettes
2015-11-19 15:07:20 -08:00
xor a
call ByteFill
pop bc
pop hl
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
2015-12-02 14:59:05 -08:00
ld hl, .BWFade
2015-11-19 15:07:20 -08:00
add hl, bc
add hl, bc
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
2015-12-02 14:59:05 -08:00
ld hl, .BlackLBlueFade
2015-11-19 15:07:20 -08:00
add hl, bc
add hl, bc
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
2015-12-02 14:59:05 -08:00
ld hl, .BlackBlueFade
2015-11-19 15:07:20 -08:00
add hl, bc
add hl, bc
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; e5288 (39:5288)
2015-12-02 14:59:05 -08:00
.BWFade: ; e5288
2015-11-19 15:07:20 -08:00
; Fade between black and white.
hue = 0
rept 32
RGB hue, hue, hue
hue = hue + 1
endr
; e52c8
2015-12-02 14:59:05 -08:00
.BlackLBlueFade: ; e52c8
2015-11-19 15:07:20 -08:00
; Fade between black and light blue.
hue = 0
rept 32
RGB 0, hue / 2, hue
hue = hue + 1
endr
; e5308
2015-12-02 14:59:05 -08:00
.BlackBlueFade: ; e5308
2015-11-19 15:07:20 -08:00
; Fade between black and blue.
hue = 0
rept 32
RGB 0, 0, hue
hue = hue + 1
endr
; e5348
2015-12-02 14:59:05 -08:00
Intro_Scene20_AppearUnown: ; e5348 (39:5348)
; Spawn the palette for the nth Unown
2015-11-19 15:07:20 -08:00
and a
2015-12-02 14:59:05 -08:00
jr nz, .load_pal_2
ld hl, .pal1
jr .got_pointer
.load_pal_2
ld hl, .pal2
.got_pointer
2018-01-11 12:36:11 -08:00
ld a, [wIntroSceneTimer]
2015-11-19 15:07:20 -08:00
and $7
add a
add a
add a
2015-11-19 15:07:20 -08:00
ld c, a
ld a, [rSVBK]
push af
ld a, BANK(wBGPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push bc
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld a, c
add e
ld e, a
ld a, $0
adc d
ld d, a
2015-12-02 14:59:05 -08:00
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop bc
2015-12-02 14:59:05 -08:00
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2015-11-19 15:07:20 -08:00
ld a, c
add e
ld e, a
ld a, $0
adc d
ld d, a
2015-12-02 14:59:05 -08:00
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; e538d (39:538d)
.pal1 ; e538d
2015-11-19 15:07:20 -08:00
RGB 24, 12, 09
RGB 31, 31, 31
RGB 12, 00, 31
RGB 00, 00, 00
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
; e5395
.pal2 ; e5395
2015-11-19 15:07:20 -08:00
RGB 24, 12, 09
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
; e539d
2015-12-02 14:59:05 -08:00
Intro_FadeUnownWordPals: ; e539d (39:539d)
2015-11-19 15:07:20 -08:00
add a
add a
add a
2015-11-19 15:07:20 -08:00
ld e, a
ld d, $0
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2015-11-19 15:07:20 -08:00
add hl, de
rept 4
inc hl
endr
2018-01-11 12:36:11 -08:00
ld a, [wIntroSceneTimer]
2015-11-19 15:07:20 -08:00
add a
ld c, a
ld b, $0
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
2015-12-02 14:59:05 -08:00
ld hl, .FastFadePalettes
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push hl
2015-12-02 14:59:05 -08:00
ld hl, .SlowFadePalettes
2015-11-19 15:07:20 -08:00
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; e53db (39:53db)
2015-12-02 14:59:05 -08:00
.FastFadePalettes: ; e53db
2015-11-19 15:07:20 -08:00
hue = 31
rept 8
RGB hue, hue, hue
hue = hue + -1
RGB hue, hue, hue
hue = hue + -2
endr
; e53fb
2015-12-02 14:59:05 -08:00
.SlowFadePalettes: ; e53fb
2015-11-19 15:07:20 -08:00
hue = 31
rept 16
RGB hue, hue, hue
hue = hue + -1
endr
; e541b
2015-12-02 14:59:05 -08:00
Intro_LoadTilemap: ; e541b (39:541b)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
ld hl, wDecompressScratch
2015-11-19 15:07:20 -08:00
decoord 0, 0
ld b, SCREEN_HEIGHT
2015-12-02 14:59:05 -08:00
.row
2015-11-19 15:07:20 -08:00
ld c, SCREEN_WIDTH
2015-12-02 14:59:05 -08:00
.col
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld [de], a
inc de
dec c
2015-12-02 14:59:05 -08:00
jr nz, .col
; add hl, $20 - SCREEN_WIDTH
ld a, $20 - SCREEN_WIDTH
2015-11-19 15:07:20 -08:00
add l
ld l, a
ld a, $0
adc h
ld h, a
dec b
2015-12-02 14:59:05 -08:00
jr nz, .row
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ret
2015-12-02 14:59:05 -08:00
Intro_Scene16_AnimateSuicune: ; e5441 (39:5441)
ld a, [wIntroSceneFrameCounter]
2015-11-19 15:07:20 -08:00
and $3
2015-12-02 14:59:05 -08:00
jr z, Intro_ColoredSuicuneFrameSwap
2015-11-19 15:07:20 -08:00
cp $3
2015-12-02 14:59:05 -08:00
jr z, .PrepareForSuicuneSwap
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
.PrepareForSuicuneSwap:
2015-11-19 15:07:20 -08:00
xor a
ld [hBGMapMode], a
ret
2015-12-02 14:59:05 -08:00
Intro_ColoredSuicuneFrameSwap: ; e5451 (39:5451)
2015-11-19 15:07:20 -08:00
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
2015-12-02 14:59:05 -08:00
.loop
2015-11-19 15:07:20 -08:00
ld a, [hl]
and a
2015-12-02 14:59:05 -08:00
jr z, .skip
2015-11-19 15:07:20 -08:00
cp $80
2015-12-02 14:59:05 -08:00
jr nc, .skip
2015-11-19 15:07:20 -08:00
xor $8
ld [hl], a
2015-12-02 14:59:05 -08:00
.skip
2015-11-19 15:07:20 -08:00
inc hl
dec bc
ld a, c
or b
2015-12-02 14:59:05 -08:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ld a, $1
ld [hBGMapMode], a
ret
2015-12-02 14:59:05 -08:00
Intro_RustleGrass: ; e546d (39:546d)
ld a, [wIntroSceneFrameCounter]
cp 36
2015-11-19 15:07:20 -08:00
ret nc
and $c
srl a
ld e, a
ld d, $0
2015-12-02 14:59:05 -08:00
ld hl, .RustlingGrassPointers
2015-11-19 15:07:20 -08:00
add hl, de
ld a, [hli]
2018-01-23 14:39:09 -08:00
ld [wRequested2bppSource], a
2015-11-19 15:07:20 -08:00
ld a, [hli]
2018-01-23 14:39:09 -08:00
ld [wRequested2bppSource + 1], a
2017-12-28 04:32:33 -08:00
ld a, LOW(vTiles2 tile $09)
2018-01-23 14:39:09 -08:00
ld [wRequested2bppDest], a
2017-12-28 04:32:33 -08:00
ld a, HIGH(vTiles2 tile $09)
2018-01-23 14:39:09 -08:00
ld [wRequested2bppDest + 1], a
2015-12-02 14:59:05 -08:00
ld a, 4
2018-01-23 14:39:09 -08:00
ld [wRequested2bppSize], a
2015-11-19 15:07:20 -08:00
ret
; e5496 (39:5496)
2015-12-02 14:59:05 -08:00
.RustlingGrassPointers: ; e5496
dw IntroGrass1GFX
dw IntroGrass2GFX
dw IntroGrass3GFX
dw IntroGrass2GFX
2015-11-19 15:07:20 -08:00
; e549e
2015-12-02 14:59:05 -08:00
Intro_SetCGBPalUpdate: ; e549e (39:549e)
2015-11-19 15:07:20 -08:00
ld a, $1
ld [hCGBPalUpdate], a
ret
2015-12-02 14:59:05 -08:00
Intro_ClearBGPals: ; e54a3 (39:54a3)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wBGPals2)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2018-01-01 05:47:16 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
xor a
call ByteFill
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
call DelayFrame
call DelayFrame
ret
2015-12-02 14:59:05 -08:00
Intro_DecompressRequest2bpp_128Tiles: ; e54c2 (39:54c2)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push de
ld de, wDecompressScratch
2015-11-19 15:07:20 -08:00
call Decompress
pop hl
2015-12-02 14:59:05 -08:00
ld de, wDecompressScratch
2015-12-02 14:59:05 -08:00
lb bc, $01, $80
2015-11-19 15:07:20 -08:00
call Request2bpp
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ret
2015-12-02 14:59:05 -08:00
Intro_DecompressRequest2bpp_255Tiles: ; e54de (39:54de)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push de
ld de, wDecompressScratch
2015-11-19 15:07:20 -08:00
call Decompress
pop hl
2015-12-02 14:59:05 -08:00
ld de, wDecompressScratch
2015-12-02 14:59:05 -08:00
lb bc, $01, $ff
2015-11-19 15:07:20 -08:00
call Request2bpp
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ret
2015-12-02 14:59:05 -08:00
Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
push de
ld de, wDecompressScratch
2015-11-19 15:07:20 -08:00
call Decompress
pop hl
2015-12-02 14:59:05 -08:00
ld de, wDecompressScratch
2015-12-02 14:59:05 -08:00
lb bc, $01, $40
2015-11-19 15:07:20 -08:00
call Request2bpp
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
ret
2015-12-02 14:59:05 -08:00
Intro_ResetLYOverrides: ; e5516 (39:5516)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
2018-01-23 14:39:09 -08:00
ld a, BANK(wLYOverrides)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
2018-01-23 14:39:09 -08:00
ld hl, wLYOverrides
ld bc, wLYOverridesEnd - wLYOverrides
2015-11-19 15:07:20 -08:00
xor a
call ByteFill
2015-12-02 14:59:05 -08:00
2015-11-19 15:07:20 -08:00
pop af
ld [rSVBK], a
2016-06-13 19:53:33 -07:00
ld a, rSCX - $ff00
ld [hLCDCPointer], a
2015-11-19 15:07:20 -08:00
ret
2015-12-02 14:59:05 -08:00
Intro_PerspectiveScrollBG: ; e552f (39:552f)
2015-11-19 15:07:20 -08:00
ld a, [rSVBK]
push af
2018-01-23 14:39:09 -08:00
ld a, BANK(wLYOverrides)
2015-11-19 15:07:20 -08:00
ld [rSVBK], a
2015-12-02 14:59:05 -08:00
; Scroll the grass every frame.
; Scroll the trees every other frame and at half speed.
; This creates an illusion of perspective.
ld a, [wIntroSceneFrameCounter]
2015-11-19 15:07:20 -08:00
and $1
2015-12-02 14:59:05 -08:00
jr z, .skip
; trees in the back
2018-01-23 14:39:09 -08:00
ld hl, wLYOverrides
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc a
ld bc, $5f
call ByteFill
2015-12-02 14:59:05 -08:00
.skip
; grass in the front
2018-01-23 14:39:09 -08:00
ld hl, wLYOverrides + $5f
2015-11-19 15:07:20 -08:00
ld a, [hl]
inc a
inc a
2015-11-19 15:07:20 -08:00
ld bc, $31
call ByteFill
2018-01-23 14:39:09 -08:00
ld a, [wLYOverrides + 0]
2015-11-19 15:07:20 -08:00
ld [hSCX], a
pop af
ld [rSVBK], a
ret
IntroSuicuneRunGFX: ; e555d
INCBIN "gfx/intro/suicune_run.2bpp.lz"
; e592d
IntroPichuWooperGFX: ; e592d
INCBIN "gfx/intro/pichu_wooper.2bpp.lz"
; e5c7d
IntroBackgroundGFX: ; e5c7d
INCBIN "gfx/intro/background.2bpp.lz"
; e5e6d
IntroTilemap004: ; e5e6d
INCBIN "gfx/intro/004.tilemap.lz"
; e5ecd
IntroTilemap003: ; e5ecd
INCBIN "gfx/intro/003.tilemap.lz"
; e5edd
Palette_e5edd: ; e5edd
INCLUDE "gfx/intro/intro_1.pal"
2017-12-15 19:36:33 -08:00
; e5f5d
2015-11-19 15:07:20 -08:00
IntroUnownsGFX: ; e5f5d
INCBIN "gfx/intro/unowns.2bpp.lz"
; e634d
IntroPulseGFX: ; e634d
INCBIN "gfx/intro/pulse.2bpp.lz"
; e63dd
IntroTilemap002: ; e63dd
INCBIN "gfx/intro/002.tilemap.lz"
; e641d
IntroTilemap001: ; e641d
INCBIN "gfx/intro/001.tilemap.lz"
; e642d
IntroTilemap006: ; e642d
INCBIN "gfx/intro/006.tilemap.lz"
; e647d
IntroTilemap005: ; e647d
INCBIN "gfx/intro/005.tilemap.lz"
; e649d
IntroTilemap008: ; e649d
INCBIN "gfx/intro/008.tilemap.lz"
; e655d
IntroTilemap007: ; e655d
INCBIN "gfx/intro/007.tilemap.lz"
; e65ad
Palette_365ad: ; e65ad
INCLUDE "gfx/intro/intro_2.pal"
2017-12-15 19:36:33 -08:00
; e662d
2015-11-19 15:07:20 -08:00
IntroCrystalUnownsGFX: ; e662d
INCBIN "gfx/intro/crystal_unowns.2bpp.lz"
; e672d
IntroTilemap017: ; e672d
INCBIN "gfx/intro/017.tilemap.lz"
; e676d
IntroTilemap015: ; e676d
INCBIN "gfx/intro/015.tilemap.lz"
; e679d
Palette_e679d: ; e679d
INCLUDE "gfx/intro/intro_3.pal"
2017-12-15 19:36:33 -08:00
; e681d
2015-11-19 15:07:20 -08:00
IntroSuicuneCloseGFX: ; e681d
INCBIN "gfx/intro/suicune_close.2bpp.lz"
; e6c3d
IntroTilemap012: ; e6c3d
INCBIN "gfx/intro/012.tilemap.lz"
; e6d0d
IntroTilemap011: ; e6d0d
INCBIN "gfx/intro/011.tilemap.lz"
; e6d6d
Palette_e6d6d: ; e6d6d
INCLUDE "gfx/intro/intro_4.pal"
2017-12-15 19:36:33 -08:00
; e6ded
2015-11-19 15:07:20 -08:00
IntroSuicuneJumpGFX: ; e6ded
INCBIN "gfx/intro/suicune_jump.2bpp.lz"
; e72ad
IntroSuicuneBackGFX: ; e72ad
INCBIN "gfx/intro/suicune_back.2bpp.lz"
; e764d
IntroTilemap010: ; e764d
INCBIN "gfx/intro/010.tilemap.lz"
; e76ad
IntroTilemap009: ; e76ad
INCBIN "gfx/intro/009.tilemap.lz"
; e76bd
IntroTilemap014: ; e76bd
INCBIN "gfx/intro/014.tilemap.lz"
; e778d
IntroTilemap013: ; e778d
INCBIN "gfx/intro/013.tilemap.lz"
; e77dd
Palette_e77dd: ; e77dd
INCLUDE "gfx/intro/intro_5.pal"
2015-11-19 15:07:20 -08:00
IntroUnownBackGFX: ; e785d
INCBIN "gfx/intro/unown_back.2bpp.lz"
; e799d
2015-12-02 14:59:05 -08:00
IntroGrass1GFX: ; e799d
INCBIN "gfx/intro/grass1.2bpp"
IntroGrass2GFX: ; e79dd
INCBIN "gfx/intro/grass2.2bpp"
IntroGrass3GFX: ; e7a1d
INCBIN "gfx/intro/grass3.2bpp"
IntroGrass4GFX: ; e7a5d
INCBIN "gfx/intro/grass4.2bpp"