2020-08-22 13:49:21 +00:00
|
|
|
SplashScreen:
|
2020-08-21 23:24:04 +00:00
|
|
|
; Play the copyright screen and GameFreak Presents sequence.
|
|
|
|
; Return carry if user cancels animation by pressing a button.
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
; Reinitialize everything
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
|
|
|
|
; Draw copyright screen
|
2020-08-21 23:24:04 +00:00
|
|
|
callfar Copyright
|
|
|
|
call WaitBGMap
|
|
|
|
ld c, 100
|
|
|
|
call DelayFrames
|
|
|
|
call ClearTilemap
|
2020-08-22 13:49:21 +00:00
|
|
|
|
|
|
|
; Stop here if not in GBC mode
|
2020-08-21 23:24:04 +00:00
|
|
|
farcall GBCOnlyScreen
|
2020-08-22 13:49:21 +00:00
|
|
|
|
|
|
|
; Play GameFreak logo animation
|
|
|
|
call GameFreakPresentsInit
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
call GameFreakPresentsScene
|
2020-08-21 23:24:04 +00:00
|
|
|
farcall PlaySpriteAnimations
|
|
|
|
call DelayFrame
|
|
|
|
jr .joy_loop
|
|
|
|
|
|
|
|
.pressed_button
|
2020-08-22 13:49:21 +00:00
|
|
|
call GameFreakPresentsEnd
|
2020-08-21 23:24:04 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.finish
|
2020-08-22 13:49:21 +00:00
|
|
|
call GameFreakPresentsEnd
|
2020-08-21 23:24:04 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresentsInit:
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
ld [hl], 160
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
2020-08-22 13:49:21 +00:00
|
|
|
ld [hl], 96
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
2020-08-22 13:49:21 +00:00
|
|
|
ld [hl], 48
|
2020-08-21 23:24:04 +00:00
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ld [wIntroSceneFrameCounter], a
|
|
|
|
ld [wIntroSceneTimer], a
|
|
|
|
ldh [hSCX], a
|
|
|
|
ldh [hSCY], a
|
2020-08-22 13:49:21 +00:00
|
|
|
ld a, 1
|
2020-08-21 23:24:04 +00:00
|
|
|
ldh [hBGMapMode], a
|
2020-08-22 13:49:21 +00:00
|
|
|
ld a, 144
|
2020-08-21 23:24:04 +00:00
|
|
|
ldh [hWY], a
|
|
|
|
lb de, %11100100, %11100100
|
|
|
|
call DmgToCgbObjPals
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresentsEnd:
|
2020-08-21 23:24:04 +00:00
|
|
|
farcall ClearSpriteAnims
|
|
|
|
call ClearTilemap
|
|
|
|
call ClearSprites
|
|
|
|
ld c, 16
|
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresentsScene:
|
2020-08-21 23:24:04 +00:00
|
|
|
jumptable .scenes, wJumptableIndex
|
|
|
|
|
|
|
|
.scenes
|
2020-08-22 13:49:21 +00:00
|
|
|
dw GameFreakPresents_WaitSpriteAnim
|
|
|
|
dw GameFreakPresents_PlaceGameFreak
|
|
|
|
dw GameFreakPresents_PlacePresents
|
|
|
|
dw GameFreakPresents_DelayEnd
|
2020-08-21 23:24:04 +00:00
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresents_NextScene:
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresents_WaitSpriteAnim:
|
2020-08-21 23:24:04 +00:00
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresents_PlaceGameFreak:
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
cp 32
|
2020-08-21 23:24:04 +00:00
|
|
|
jr nc, .PlaceGameFreak
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.PlaceGameFreak:
|
|
|
|
ld [hl], 0
|
|
|
|
ld hl, .GAME_FREAK
|
|
|
|
decoord 5, 10
|
|
|
|
ld bc, .end - .GAME_FREAK
|
|
|
|
call CopyBytes
|
2020-08-22 13:49:21 +00:00
|
|
|
call GameFreakPresents_NextScene
|
2020-08-21 23:24:04 +00:00
|
|
|
ld de, SFX_GAME_FREAK_PRESENTS
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
|
|
|
.GAME_FREAK:
|
|
|
|
; G A M E _ F R E A K
|
|
|
|
db 0, 1, 2, 3, 13, 4, 5, 3, 1, 6
|
|
|
|
.end
|
|
|
|
db "@"
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresents_PlacePresents:
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
cp 64
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
call GameFreakPresents_NextScene
|
2020-08-21 23:24:04 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.presents
|
|
|
|
db 7, 8, 9, 10, 11, 12
|
|
|
|
.end
|
|
|
|
db "@"
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakPresents_DelayEnd:
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, wIntroSceneTimer
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
cp 128
|
2020-08-21 23:24:04 +00:00
|
|
|
jr nc, .finish
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.finish
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakLogoSpriteAnim:
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
dw GameFreakLogo_Init
|
|
|
|
dw GameFreakLogo_Bounce
|
|
|
|
dw GameFreakLogo_Ditto
|
|
|
|
dw GameFreakLogo_Transform
|
|
|
|
dw GameFreakLogo_Done
|
2020-08-21 23:24:04 +00:00
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakLogo_Init:
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00: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).
|
|
|
|
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C ; jump height
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2020-08-22 13:49:21 +00:00
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
; Load the sine offset, make sure it doesn't reach the negative part of the wave
|
2020-08-21 23:24:04 +00:00
|
|
|
ld d, a
|
2020-08-22 13:49:21 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D ; sine offset
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
and $3f ; full circle = 2*pi = 2*32
|
|
|
|
cp 32
|
|
|
|
jr nc, .no_negative
|
|
|
|
add 32
|
|
|
|
.no_negative
|
|
|
|
|
2020-08-21 23:24:04 +00:00
|
|
|
ld e, a
|
2020-08-22 13:49:21 +00:00
|
|
|
farcall BattleAnim_Sine_e ; e = d * sin(e * pi/32)
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], e
|
2020-08-22 13:49:21 +00:00
|
|
|
|
|
|
|
; Decrement the sine offset
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D ; sine offset
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
dec [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
and $1f ; a%32 == 0
|
2020-08-21 23:24:04 +00:00
|
|
|
ret nz
|
2020-08-22 13:49:21 +00:00
|
|
|
|
|
|
|
; If the ditto's reached the ground, decrement the jump height and play the sfx
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C ; jump height
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
sub 48
|
2020-08-21 23:24:04 +00:00
|
|
|
ld [hl], a
|
|
|
|
ld de, SFX_DITTO_BOUNCE
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
.done
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
2020-08-22 13:49:21 +00:00
|
|
|
ld [hl], 0
|
2020-08-21 23:24:04 +00:00
|
|
|
ld de, SFX_DITTO_POP_UP
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakLogo_Ditto:
|
|
|
|
; Wait a little, then start transforming
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D ; frame count
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
cp 32
|
|
|
|
jr nc, .start_transform
|
2020-08-21 23:24:04 +00:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
.start_transform
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
2020-08-22 13:49:21 +00:00
|
|
|
ld [hl], 0
|
2020-08-21 23:24:04 +00:00
|
|
|
ld de, SFX_DITTO_TRANSFORM
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2020-08-22 13:49:21 +00:00
|
|
|
GameFreakLogo_Transform:
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D ; frame count
|
2020-08-21 23:24:04 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
cp 64
|
|
|
|
jr z, .done
|
2020-08-21 23:24:04 +00:00
|
|
|
inc [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
|
|
|
|
; Fade ditto's palettes while it's transforming
|
2020-08-21 23:24:04 +00:00
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld e, a
|
2020-08-22 13:49:21 +00:00
|
|
|
ld d, 0
|
2020-08-21 23:24:04 +00: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 13:49:21 +00:00
|
|
|
.done
|
2020-08-21 23:24:04 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
2020-08-22 13:49:21 +00:00
|
|
|
call GameFreakPresents_NextScene
|
|
|
|
GameFreakLogo_Done:
|
2020-08-21 23:24:04 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
GameFreakDittoPaletteFade:
|
|
|
|
INCLUDE "gfx/splash/ditto_fade.pal"
|
|
|
|
|
|
|
|
GameFreakLogoGFX:
|
|
|
|
INCBIN "gfx/splash/gamefreak_presents.1bpp"
|
|
|
|
INCBIN "gfx/splash/gamefreak_logo.1bpp"
|