2020-08-22 06:49:21 -07:00
|
|
|
SplashScreen:
|
2020-08-21 16:24:04 -07:00
|
|
|
; Play the copyright screen and GameFreak Presents sequence.
|
|
|
|
; Return carry if user cancels animation by pressing a button.
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
; Reinitialize everything
|
2020-08-21 16:24:04 -07:00
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearTilemap
|
|
|
|
ld a, HIGH(vBGMap0)
|
|
|
|
ldh [hBGMapAddress + 1], a
|
|
|
|
xor a ; LOW(vBGMap0)
|
|
|
|
ldh [hBGMapAddress], a
|
|
|
|
ldh [hJoyDown], a
|
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
|
|
|
ld a, SCREEN_HEIGHT_PX
|
|
|
|
ldh [hWY], a
|
|
|
|
call WaitBGMap
|
|
|
|
ld b, SCGB_GAMEFREAK_LOGO
|
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; Draw copyright screen
|
2020-08-21 16:24:04 -07:00
|
|
|
callfar Copyright
|
|
|
|
call WaitBGMap
|
|
|
|
ld c, 100
|
|
|
|
call DelayFrames
|
|
|
|
call ClearTilemap
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; Stop here if not in GBC mode
|
2020-08-21 16:24:04 -07:00
|
|
|
farcall GBCOnlyScreen
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; Play GameFreak logo animation
|
|
|
|
call GameFreakPresentsInit
|
2020-08-21 16:24:04 -07:00
|
|
|
.joy_loop
|
|
|
|
call JoyTextDelay
|
|
|
|
ldh a, [hJoyLast]
|
|
|
|
and BUTTONS
|
|
|
|
jr nz, .pressed_button
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .finish
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresentsScene
|
2020-08-21 16:24:04 -07:00
|
|
|
farcall PlaySpriteAnimations
|
|
|
|
call DelayFrame
|
|
|
|
jr .joy_loop
|
|
|
|
|
|
|
|
.pressed_button
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresentsEnd
|
2020-08-21 16:24:04 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.finish
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresentsEnd
|
2020-08-21 16:24:04 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresentsInit:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld de, GameFreakLogoGFX
|
|
|
|
ld hl, vTiles2
|
|
|
|
lb bc, BANK(GameFreakLogoGFX), 28
|
|
|
|
call Get1bpp
|
|
|
|
|
|
|
|
ldh a, [rSVBK]
|
|
|
|
push af
|
|
|
|
ld a, BANK(wDecompressScratch)
|
|
|
|
ldh [rSVBK], a
|
|
|
|
|
|
|
|
ld hl, GameFreakDittoGFX
|
|
|
|
ld de, wDecompressScratch
|
|
|
|
ld a, BANK(GameFreakDittoGFX)
|
|
|
|
call FarDecompress
|
|
|
|
|
|
|
|
ld hl, vTiles0
|
|
|
|
ld de, wDecompressScratch
|
|
|
|
lb bc, 1, 8 tiles
|
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
ld hl, vTiles1
|
|
|
|
ld de, wDecompressScratch + $80 tiles
|
|
|
|
lb bc, 1, 8 tiles
|
|
|
|
call Request2bpp
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ldh [rSVBK], a
|
|
|
|
|
|
|
|
farcall ClearSpriteAnims
|
|
|
|
depixel 10, 11, 4, 0
|
|
|
|
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
|
|
|
|
call InitSpriteAnimStruct
|
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
|
|
|
add hl, bc
|
2020-08-22 06:49:21 -07:00
|
|
|
ld [hl], 160
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR1
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
2020-08-22 06:49:21 -07:00
|
|
|
ld [hl], 96
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
2020-08-22 06:49:21 -07:00
|
|
|
ld [hl], 48
|
2020-08-21 16:24:04 -07:00
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ld [wIntroSceneFrameCounter], a
|
|
|
|
ld [wIntroSceneTimer], a
|
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
2020-08-22 06:49:21 -07:00
|
|
|
ld a, 1
|
2020-08-21 16:24:04 -07:00
|
|
|
ldh [hBGMapMode], a
|
2020-08-22 06:49:21 -07:00
|
|
|
ld a, 144
|
2020-08-21 16:24:04 -07:00
|
|
|
ldh [hWY], a
|
|
|
|
lb de, %11100100, %11100100
|
|
|
|
call DmgToCgbObjPals
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresentsEnd:
|
2020-08-21 16:24:04 -07:00
|
|
|
farcall ClearSpriteAnims
|
|
|
|
call ClearTilemap
|
|
|
|
call ClearSprites
|
|
|
|
ld c, 16
|
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresentsScene:
|
2020-08-21 16:24:04 -07:00
|
|
|
jumptable .scenes, wJumptableIndex
|
|
|
|
|
|
|
|
.scenes
|
2020-08-22 06:49:21 -07:00
|
|
|
dw GameFreakPresents_WaitSpriteAnim
|
|
|
|
dw GameFreakPresents_PlaceGameFreak
|
|
|
|
dw GameFreakPresents_PlacePresents
|
2020-08-27 05:52:27 -07:00
|
|
|
dw GameFreakPresents_WaitForTimer
|
2020-08-21 16:24:04 -07:00
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresents_NextScene:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresents_WaitSpriteAnim:
|
2020-08-21 16:24:04 -07:00
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresents_PlaceGameFreak:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
cp 32
|
2020-08-21 16:24:04 -07:00
|
|
|
jr nc, .PlaceGameFreak
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.PlaceGameFreak:
|
|
|
|
ld [hl], 0
|
2020-08-27 05:52:27 -07:00
|
|
|
ld hl, .game_freak
|
2020-08-21 16:24:04 -07:00
|
|
|
decoord 5, 10
|
2020-08-27 05:52:27 -07:00
|
|
|
ld bc, .end - .game_freak
|
2020-08-21 16:24:04 -07:00
|
|
|
call CopyBytes
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresents_NextScene
|
2020-08-21 16:24:04 -07:00
|
|
|
ld de, SFX_GAME_FREAK_PRESENTS
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-27 05:52:27 -07:00
|
|
|
.game_freak
|
2020-08-27 09:03:54 -07:00
|
|
|
db $00, $01, $02, $03, $0d, $04, $05, $03, $01, $06
|
2020-08-21 16:24:04 -07:00
|
|
|
.end
|
|
|
|
db "@"
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakPresents_PlacePresents:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
cp 64
|
2020-08-21 16:24:04 -07:00
|
|
|
jr nc, .place_presents
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.place_presents
|
|
|
|
ld [hl], 0
|
|
|
|
ld hl, .presents
|
|
|
|
decoord 7, 11
|
|
|
|
ld bc, .end - .presents
|
|
|
|
call CopyBytes
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresents_NextScene
|
2020-08-21 16:24:04 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.presents
|
2020-08-27 09:03:54 -07:00
|
|
|
db $07, $08, $09, $0a, $0b, $0c
|
2020-08-21 16:24:04 -07:00
|
|
|
.end
|
|
|
|
db "@"
|
|
|
|
|
2020-08-27 05:52:27 -07:00
|
|
|
GameFreakPresents_WaitForTimer:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
cp 128
|
2020-08-21 16:24:04 -07:00
|
|
|
jr nc, .finish
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.finish
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakLogoSpriteAnim:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .scenes
|
|
|
|
add hl, de
|
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
jp hl
|
|
|
|
|
|
|
|
.scenes:
|
2020-08-22 06:49:21 -07:00
|
|
|
dw GameFreakLogo_Init
|
|
|
|
dw GameFreakLogo_Bounce
|
|
|
|
dw GameFreakLogo_Ditto
|
|
|
|
dw GameFreakLogo_Transform
|
|
|
|
dw GameFreakLogo_Done
|
2020-08-21 16:24:04 -07:00
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakLogo_Init:
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakLogo_Bounce:
|
|
|
|
; Bounce with a height of 0C, 0C / 48 times.
|
|
|
|
; By default, this is twice, with a height of 96 pixels and 48 pixels.
|
|
|
|
; Sine offset starts at 48 (32+32/2, or pi+pi/2), so it starts at the maximum
|
|
|
|
; value of the sine wave (i.e. the top of the screen).
|
|
|
|
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR1 ; jump height
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2020-08-22 06:49:21 -07:00
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
; Load the sine offset, make sure it doesn't reach the negative part of the wave
|
2020-08-21 16:24:04 -07:00
|
|
|
ld d, a
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2 ; sine offset
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
and $3f ; full circle = 2*pi = 2*32
|
|
|
|
cp 32
|
|
|
|
jr nc, .no_negative
|
|
|
|
add 32
|
|
|
|
.no_negative
|
|
|
|
|
2020-08-21 16:24:04 -07:00
|
|
|
ld e, a
|
2020-08-22 06:49:21 -07:00
|
|
|
farcall BattleAnim_Sine_e ; e = d * sin(e * pi/32)
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], e
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; Decrement the sine offset
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2 ; sine offset
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
dec [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
and $1f ; a%32 == 0
|
2020-08-21 16:24:04 -07:00
|
|
|
ret nz
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; If the ditto's reached the ground, decrement the jump height and play the sfx
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR1 ; jump height
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
sub 48
|
2020-08-21 16:24:04 -07:00
|
|
|
ld [hl], a
|
|
|
|
ld de, SFX_DITTO_BOUNCE
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
.done
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
2020-08-22 06:49:21 -07:00
|
|
|
ld [hl], 0
|
2020-08-21 16:24:04 -07:00
|
|
|
ld de, SFX_DITTO_POP_UP
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakLogo_Ditto:
|
|
|
|
; Wait a little, then start transforming
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2 ; frame count
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
cp 32
|
|
|
|
jr nc, .start_transform
|
2020-08-21 16:24:04 -07:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
.start_transform
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
2020-08-22 06:49:21 -07:00
|
|
|
ld [hl], 0
|
2020-08-21 16:24:04 -07:00
|
|
|
ld de, SFX_DITTO_TRANSFORM
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
GameFreakLogo_Transform:
|
2020-08-22 07:22:37 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_VAR2 ; frame count
|
2020-08-21 16:24:04 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
cp 64
|
|
|
|
jr z, .done
|
2020-08-21 16:24:04 -07:00
|
|
|
inc [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
|
|
|
|
; Fade ditto's palettes while it's transforming
|
2020-08-21 16:24:04 -07:00
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld e, a
|
2020-08-22 06:49:21 -07:00
|
|
|
ld d, 0
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, GameFreakDittoPaletteFade
|
|
|
|
add hl, de
|
|
|
|
add hl, de
|
|
|
|
ldh a, [rSVBK]
|
|
|
|
push af
|
|
|
|
ld a, BANK(wOBPals2)
|
|
|
|
ldh [rSVBK], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [wOBPals2 + 12], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [wOBPals2 + 13], a
|
|
|
|
pop af
|
|
|
|
ldh [rSVBK], a
|
|
|
|
ld a, TRUE
|
|
|
|
ldh [hCGBPalUpdate], a
|
|
|
|
ret
|
|
|
|
|
2020-08-22 06:49:21 -07:00
|
|
|
.done
|
2020-08-21 16:24:04 -07:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2020-08-22 06:49:21 -07:00
|
|
|
call GameFreakPresents_NextScene
|
|
|
|
GameFreakLogo_Done:
|
2020-08-21 16:24:04 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
GameFreakDittoPaletteFade:
|
|
|
|
INCLUDE "gfx/splash/ditto_fade.pal"
|
|
|
|
|
|
|
|
GameFreakLogoGFX:
|
|
|
|
INCBIN "gfx/splash/gamefreak_presents.1bpp"
|
|
|
|
INCBIN "gfx/splash/gamefreak_logo.1bpp"
|