2013-09-15 22:59:53 +00:00
|
|
|
_TitleScreen: ; 10ed67
|
|
|
|
|
|
|
|
call WhiteBGMap
|
|
|
|
call ClearSprites
|
|
|
|
call ClearTileMap
|
|
|
|
|
|
|
|
; Turn BG Map update off
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
|
|
|
|
; Reset timing variables
|
2015-10-24 23:49:19 +00:00
|
|
|
ld hl, wJumptableIndex
|
2013-09-15 22:59:53 +00:00
|
|
|
ld [hli], a ; cf63 ; Scene?
|
|
|
|
ld [hli], a ; cf64
|
|
|
|
ld [hli], a ; cf65 ; Timer lo
|
|
|
|
ld [hl], a ; cf66 ; Timer hi
|
|
|
|
|
|
|
|
; Turn LCD off
|
|
|
|
call DisableLCD
|
|
|
|
|
|
|
|
|
|
|
|
; VRAM bank 1
|
|
|
|
ld a, 1
|
|
|
|
ld [rVBK], a
|
|
|
|
|
|
|
|
|
|
|
|
; Decompress running Suicune gfx
|
|
|
|
ld hl, TitleSuicuneGFX
|
|
|
|
ld de, VTiles1
|
|
|
|
call Decompress
|
|
|
|
|
|
|
|
|
|
|
|
; Clear screen palettes
|
|
|
|
ld hl, VBGMap0
|
|
|
|
ld bc, $0280
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
|
|
|
|
; Fill tile palettes:
|
|
|
|
|
|
|
|
; BG Map 1:
|
|
|
|
|
|
|
|
; line 0 (copyright)
|
|
|
|
ld hl, VBGMap1
|
|
|
|
ld bc, $0020 ; one row
|
|
|
|
ld a, 7 ; palette
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
|
|
|
|
; BG Map 0:
|
|
|
|
|
|
|
|
; Apply logo gradient:
|
|
|
|
|
|
|
|
; lines 3-4
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $06 ; (0,3)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $0040 ; 2 rows
|
|
|
|
ld a, 2
|
|
|
|
call ByteFill
|
|
|
|
; line 5
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $0a ; (0,5)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $0020 ; 1 row
|
|
|
|
ld a, 3
|
|
|
|
call ByteFill
|
|
|
|
; line 6
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $0c ; (0,6)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $0020 ; 1 row
|
|
|
|
ld a, 4
|
|
|
|
call ByteFill
|
|
|
|
; line 7
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $0e ; (0,7)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $0020 ; 1 row
|
|
|
|
ld a, 5
|
|
|
|
call ByteFill
|
|
|
|
; lines 8-9
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $10 ; (0,8)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $0040 ; 2 rows
|
|
|
|
ld a, 6
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
|
|
|
|
; 'CRYSTAL VERSION'
|
|
|
|
ld hl, $9925 ; (5,9)
|
|
|
|
ld bc, $000b ; length of version text
|
|
|
|
ld a, 1
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
; Suicune gfx
|
2015-10-14 13:29:15 +00:00
|
|
|
ld hl, VBGMap0 tile $18 ; (0,12)
|
2013-09-15 22:59:53 +00:00
|
|
|
ld bc, $00c0 ; the rest of the screen
|
|
|
|
ld a, 8
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
|
|
|
|
; Back to VRAM bank 0
|
|
|
|
ld a, $0
|
|
|
|
ld [rVBK], a
|
|
|
|
|
|
|
|
|
|
|
|
; Decompress logo
|
|
|
|
ld hl, TitleLogoGFX
|
|
|
|
ld de, VTiles1
|
|
|
|
call Decompress
|
|
|
|
|
|
|
|
; Decompress background crystal
|
|
|
|
ld hl, TitleCrystalGFX
|
|
|
|
ld de, VTiles0
|
|
|
|
call Decompress
|
|
|
|
|
|
|
|
|
|
|
|
; Clear screen tiles
|
|
|
|
ld hl, VBGMap0
|
|
|
|
ld bc, $0800
|
|
|
|
ld a, $7f
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
; Draw Pokemon logo
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 0, 3
|
|
|
|
lb bc, 7, 20
|
2013-09-15 22:59:53 +00:00
|
|
|
ld d, $80
|
|
|
|
ld e, $14
|
2014-04-09 22:27:29 +00:00
|
|
|
call DrawTitleGraphic
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
; Draw copyright text
|
|
|
|
ld hl, $9c03 ; BGMap1(3,0)
|
2014-06-04 08:10:56 +00:00
|
|
|
lb bc, 1, 13
|
2013-09-15 22:59:53 +00:00
|
|
|
ld d, $c
|
|
|
|
ld e, $10
|
2014-04-09 22:27:29 +00:00
|
|
|
call DrawTitleGraphic
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
; Initialize running Suicune?
|
|
|
|
ld d, $0
|
2015-10-19 20:49:29 +00:00
|
|
|
call LoadSuicuneFrame
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
; Initialize background crystal
|
2015-10-19 20:49:29 +00:00
|
|
|
call InitializeBackground
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
; Save WRAM bank
|
|
|
|
ld a, [rSVBK]
|
|
|
|
push af
|
|
|
|
; WRAM bank 5
|
|
|
|
ld a, 5
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
|
|
|
; Update palette colors
|
|
|
|
ld hl, TitleScreenPalettes
|
2015-02-10 22:16:31 +00:00
|
|
|
ld de, Unkn1Pals
|
2015-10-19 20:49:29 +00:00
|
|
|
ld bc, 4 * 32
|
2013-09-15 22:59:53 +00:00
|
|
|
call CopyBytes
|
|
|
|
|
|
|
|
ld hl, TitleScreenPalettes
|
2015-02-10 22:16:31 +00:00
|
|
|
ld de, BGPals
|
2015-10-19 20:49:29 +00:00
|
|
|
ld bc, 4 * 32
|
2013-09-15 22:59:53 +00:00
|
|
|
call CopyBytes
|
|
|
|
|
|
|
|
; Restore WRAM bank
|
|
|
|
pop af
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
|
|
|
|
|
|
|
; LY/SCX trickery starts here
|
|
|
|
|
|
|
|
ld a, [rSVBK]
|
|
|
|
push af
|
|
|
|
ld a, 5 ; BANK(LYOverrides)
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
|
|
|
; Make alternating lines come in from opposite sides
|
|
|
|
|
|
|
|
; ( This part is actually totally pointless, you can't
|
|
|
|
; see anything until these values are overwritten! )
|
|
|
|
|
|
|
|
ld b, 80 / 2 ; alternate for 80 lines
|
|
|
|
ld hl, LYOverrides
|
|
|
|
.loop
|
|
|
|
; $00 is the middle position
|
|
|
|
ld [hl], +112 ; coming from the left
|
|
|
|
inc hl
|
|
|
|
ld [hl], -112 ; coming from the right
|
|
|
|
inc hl
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
; Make sure the rest of the buffer is empty
|
|
|
|
ld hl, LYOverrides + 80
|
|
|
|
xor a
|
|
|
|
ld bc, LYOverridesEnd - (LYOverrides + 80)
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
; Let LCD Stat know we're messing around with SCX
|
|
|
|
ld a, rSCX - rJOYP
|
|
|
|
ld [hLCDStatCustom], a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
|
|
|
|
|
|
|
; Reset audio
|
|
|
|
call ChannelsOff
|
|
|
|
call EnableLCD
|
|
|
|
|
|
|
|
; Set sprite size to 8x16
|
|
|
|
ld a, [rLCDC]
|
|
|
|
set 2, a
|
|
|
|
ld [rLCDC], a
|
|
|
|
|
|
|
|
ld a, +112
|
|
|
|
ld [hSCX], a
|
|
|
|
ld a, 8
|
|
|
|
ld [hSCY], a
|
|
|
|
ld a, 7
|
|
|
|
ld [hWX], a
|
|
|
|
ld a, -112
|
|
|
|
ld [hWY], a
|
|
|
|
|
|
|
|
ld a, $1
|
|
|
|
ld [hCGBPalUpdate], a
|
|
|
|
|
|
|
|
; Update BG Map 0 (bank 0)
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
|
|
|
|
xor a
|
2015-10-21 14:43:42 +00:00
|
|
|
ld [Unkn1Pals + 2], a
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
; Play starting sound effect
|
|
|
|
call SFXChannelsOff
|
|
|
|
ld de, SFX_TITLE_SCREEN_ENTRANCE
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
ret
|
|
|
|
; 10eea7
|
|
|
|
|
2015-10-19 20:49:29 +00:00
|
|
|
SuicuneFrameIterator: ; 10eea7
|
2015-10-21 14:43:42 +00:00
|
|
|
ld hl, Unkn1Pals + 2
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
inc [hl]
|
2015-10-19 20:49:29 +00:00
|
|
|
|
|
|
|
; Only do this once every eight frames
|
|
|
|
and (1 << 3) - 1
|
2013-09-15 22:59:53 +00:00
|
|
|
ret nz
|
2015-10-19 20:49:29 +00:00
|
|
|
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, c
|
2015-10-19 20:49:29 +00:00
|
|
|
and 3 << 3
|
2013-09-15 22:59:53 +00:00
|
|
|
sla a
|
|
|
|
swap a
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2015-10-19 20:49:29 +00:00
|
|
|
ld hl, .Frames
|
2013-09-15 22:59:53 +00:00
|
|
|
add hl, de
|
|
|
|
ld d, [hl]
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
2015-10-19 20:49:29 +00:00
|
|
|
call LoadSuicuneFrame
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, $3
|
|
|
|
ld [hBGMapThird], a
|
|
|
|
ret
|
|
|
|
; 10eece
|
|
|
|
|
2015-10-19 20:49:29 +00:00
|
|
|
.Frames: ; 10eece
|
|
|
|
db $80 ; VTiles4 tile $00
|
|
|
|
db $88 ; VTiles4 tile $08
|
|
|
|
db $00 ; VTiles5 tile $00
|
|
|
|
db $08 ; VTiles5 tile $08
|
2014-03-04 05:12:57 +00:00
|
|
|
; 10eed2
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
|
2015-10-19 20:49:29 +00:00
|
|
|
LoadSuicuneFrame: ; 10eed2
|
2014-06-04 08:10:56 +00:00
|
|
|
hlcoord 6, 12
|
2015-10-19 20:49:29 +00:00
|
|
|
ld b, 6
|
|
|
|
.row
|
|
|
|
ld c, 8
|
|
|
|
.col
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
inc d
|
|
|
|
dec c
|
2015-10-19 20:49:29 +00:00
|
|
|
jr nz, .col
|
|
|
|
ld a, SCREEN_WIDTH - 8
|
2013-09-15 22:59:53 +00:00
|
|
|
add l
|
|
|
|
ld l, a
|
2015-10-19 20:49:29 +00:00
|
|
|
ld a, 0
|
2013-09-15 22:59:53 +00:00
|
|
|
adc h
|
|
|
|
ld h, a
|
2015-10-19 20:49:29 +00:00
|
|
|
ld a, 8
|
2013-09-15 22:59:53 +00:00
|
|
|
add d
|
|
|
|
ld d, a
|
|
|
|
dec b
|
2015-10-19 20:49:29 +00:00
|
|
|
jr nz, .row
|
2013-09-15 22:59:53 +00:00
|
|
|
ret
|
|
|
|
; 10eeef
|
|
|
|
|
2014-04-09 22:27:29 +00:00
|
|
|
DrawTitleGraphic: ; 10eeef
|
|
|
|
; input:
|
|
|
|
; hl: draw location
|
|
|
|
; b: height
|
|
|
|
; c: width
|
|
|
|
; d: tile to start drawing from
|
|
|
|
; e: number of tiles to advance for each row
|
2015-10-19 20:49:29 +00:00
|
|
|
.row
|
2013-09-15 22:59:53 +00:00
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push hl
|
2015-10-19 20:49:29 +00:00
|
|
|
.col
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
inc d
|
|
|
|
dec c
|
2015-10-19 20:49:29 +00:00
|
|
|
jr nz, .col
|
2013-09-15 22:59:53 +00:00
|
|
|
pop hl
|
2015-10-19 20:49:29 +00:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-09-15 22:59:53 +00:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ld a, e
|
|
|
|
add d
|
|
|
|
ld d, a
|
|
|
|
dec b
|
2015-10-19 20:49:29 +00:00
|
|
|
jr nz, .row
|
2013-09-15 22:59:53 +00:00
|
|
|
ret
|
|
|
|
; 10ef06
|
|
|
|
|
2015-10-19 20:49:29 +00:00
|
|
|
InitializeBackground: ; 10ef06
|
2013-09-15 22:59:53 +00:00
|
|
|
ld hl, Sprites
|
2015-10-19 20:49:29 +00:00
|
|
|
ld d, -$22
|
2013-09-15 22:59:53 +00:00
|
|
|
ld e, $0
|
2015-10-19 20:49:29 +00:00
|
|
|
ld c, 5
|
|
|
|
.loop
|
2013-09-15 22:59:53 +00:00
|
|
|
push bc
|
2015-10-19 20:49:29 +00:00
|
|
|
call .InitColumn
|
2013-09-15 22:59:53 +00:00
|
|
|
pop bc
|
|
|
|
ld a, $10
|
|
|
|
add d
|
|
|
|
ld d, a
|
|
|
|
dec c
|
2015-10-19 20:49:29 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:59:53 +00:00
|
|
|
ret
|
|
|
|
; 10ef1c
|
|
|
|
|
2015-10-19 20:49:29 +00:00
|
|
|
.InitColumn: ; 10ef1c
|
2013-09-15 22:59:53 +00:00
|
|
|
ld c, $6
|
|
|
|
ld b, $40
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop2
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
add $8
|
|
|
|
ld b, a
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-09-15 22:59:53 +00:00
|
|
|
inc e
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-15 22:59:53 +00:00
|
|
|
ld a, $80
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop2
|
2013-09-15 22:59:53 +00:00
|
|
|
ret
|
|
|
|
; 10ef32
|
|
|
|
|
|
|
|
|
|
|
|
AnimateTitleCrystal: ; 10ef32
|
|
|
|
; Move the title screen crystal downward until it's fully visible
|
|
|
|
|
|
|
|
; Stop at y=6
|
|
|
|
; y is really from the bottom of the sprite, which is two tiles high
|
|
|
|
ld hl, Sprites
|
|
|
|
ld a, [hl]
|
2015-10-19 20:49:29 +00:00
|
|
|
cp 6 + $10
|
2013-09-15 22:59:53 +00:00
|
|
|
ret z
|
|
|
|
|
|
|
|
; Move all 30 parts of the crystal down by 2
|
|
|
|
ld c, 30
|
|
|
|
.loop
|
|
|
|
ld a, [hl]
|
|
|
|
add 2
|
|
|
|
ld [hli], a
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 3
|
2013-09-15 22:59:53 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-15 22:59:53 +00:00
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
ret
|
|
|
|
; 10ef46
|
|
|
|
|
|
|
|
TitleSuicuneGFX: ; 10ef46
|
2014-04-02 04:37:12 +00:00
|
|
|
INCBIN "gfx/title/suicune.w128.2bpp.lz"
|
2014-03-04 05:12:57 +00:00
|
|
|
; 10f326
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
TitleLogoGFX: ; 10f326
|
2014-04-02 04:37:12 +00:00
|
|
|
INCBIN "gfx/title/logo.w160.t4.2bpp.lz"
|
2014-03-04 05:12:57 +00:00
|
|
|
; 10fcee
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
TitleCrystalGFX: ; 10fcee
|
2014-04-02 04:37:12 +00:00
|
|
|
INCBIN "gfx/title/crystal.w48.interleave.2bpp.lz"
|
2014-03-04 05:12:57 +00:00
|
|
|
; 10fede
|
2013-09-15 22:59:53 +00:00
|
|
|
|
|
|
|
TitleScreenPalettes:
|
|
|
|
; BG
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 19, 00, 00
|
|
|
|
RGB 15, 08, 31
|
|
|
|
RGB 15, 08, 31
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 15, 16, 31
|
|
|
|
RGB 31, 01, 13
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 07, 07, 07
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 02, 03, 30
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 13, 13, 13
|
|
|
|
RGB 31, 31, 18
|
|
|
|
RGB 02, 03, 30
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 19, 19, 19
|
|
|
|
RGB 29, 28, 12
|
|
|
|
RGB 02, 03, 30
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 25, 25, 25
|
|
|
|
RGB 28, 25, 06
|
|
|
|
RGB 02, 03, 30
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 26, 21, 00
|
|
|
|
RGB 02, 03, 30
|
|
|
|
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 11, 11, 19
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
; OBJ
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 10, 00, 15
|
|
|
|
RGB 17, 05, 22
|
|
|
|
RGB 19, 09, 31
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 00, 00, 00
|