pokered/engine/intro.asm

451 lines
8.4 KiB
NASM
Raw Normal View History

2014-05-22 22:13:20 +00:00
PlayIntro: ; 41682 (10:5682)
xor a
2014-05-25 17:51:53 +00:00
ld [hJoyHeld], a
2014-05-22 22:13:20 +00:00
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call PlayShootingStar
call PlayIntroScene
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
xor a
2015-02-07 10:43:08 +00:00
ld [hSCX], a
2014-05-22 22:13:20 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-23 22:34:35 +00:00
call ClearSprites
2014-05-22 22:13:20 +00:00
call DelayFrame
ret
PlayIntroScene: ; 4169d (10:569d)
ld b, $7
call GoPAL_SET
ld a, %11100100
ld [rBGP], a
ld [rOBP0], a
ld [rOBP1], a
xor a
2015-02-07 10:43:08 +00:00
ld [hSCX], a
2015-07-17 05:08:34 +00:00
ld b, $3 ; Gengar tiles
call IntroCopyTiles
2014-05-22 22:13:20 +00:00
ld a, 0
ld [W_BASECOORDX], a
ld a, 80
ld [W_BASECOORDY], a
2015-08-05 21:20:29 +00:00
lb bc, 6, 6
2015-07-17 05:08:34 +00:00
call InitIntroNidorinoOAM
ld de, $28ff ; move Nidorino right by 80 pixels
call IntroMoveMon
2014-05-22 22:13:20 +00:00
ret c
; hip
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HIP
2014-05-22 22:13:20 +00:00
call PlaySound
xor a
2015-07-24 21:39:45 +00:00
ld [wIntroNidorinoBaseTile], a
2014-05-22 22:13:20 +00:00
ld de, IntroNidorinoAnimation1
call AnimateIntroNidorino
; hop
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HOP
2014-05-22 22:13:20 +00:00
call PlaySound
ld de, IntroNidorinoAnimation2
call AnimateIntroNidorino
ld c, $a
call CheckForUserInterruption
ret c
; hip
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HIP
2014-05-22 22:13:20 +00:00
call PlaySound
ld de, IntroNidorinoAnimation1
call AnimateIntroNidorino
; hop
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HOP
2014-05-22 22:13:20 +00:00
call PlaySound
ld de, IntroNidorinoAnimation2
call AnimateIntroNidorino
ld c, $1e
call CheckForUserInterruption
ret c
; raise
ld b, $4
2015-07-17 05:08:34 +00:00
call IntroCopyTiles
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_RAISE
2014-05-22 22:13:20 +00:00
call PlaySound
2015-07-17 05:08:34 +00:00
ld de, $401 ; move Gengar left by 8 pixels
call IntroMoveMon
2014-05-22 22:13:20 +00:00
ld c, $1e
call CheckForUserInterruption
ret c
; slash
ld b, $5
2015-07-17 05:08:34 +00:00
call IntroCopyTiles
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_CRASH
2014-05-22 22:13:20 +00:00
call PlaySound
2015-07-17 05:08:34 +00:00
ld de, $800 ; move Gengar right by 16 pixels
call IntroMoveMon
2014-05-22 22:13:20 +00:00
; hip
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HIP
2014-05-22 22:13:20 +00:00
call PlaySound
ld a, $24
2015-07-24 21:39:45 +00:00
ld [wIntroNidorinoBaseTile], a
2014-05-22 22:13:20 +00:00
ld de, IntroNidorinoAnimation3
call AnimateIntroNidorino
ld c, $1e
call CheckForUserInterruption
ret c
2015-07-17 05:08:34 +00:00
ld de, $401 ; move Gengar left by 8 pixels
call IntroMoveMon
2014-05-22 22:13:20 +00:00
ld b, $3
2015-07-17 05:08:34 +00:00
call IntroCopyTiles
2014-05-22 22:13:20 +00:00
ld c, $3c
call CheckForUserInterruption
ret c
; hip
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HIP
2014-05-22 22:13:20 +00:00
call PlaySound
xor a
2015-07-24 21:39:45 +00:00
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation4
2014-05-22 22:13:20 +00:00
call AnimateIntroNidorino
; hop
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_HOP
2014-05-22 22:13:20 +00:00
call PlaySound
ld de, IntroNidorinoAnimation5
2014-05-22 22:13:20 +00:00
call AnimateIntroNidorino
ld c, $14
call CheckForUserInterruption
ret c
ld a, $24
2015-07-24 21:39:45 +00:00
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation6
2014-05-22 22:13:20 +00:00
call AnimateIntroNidorino
ld c, $1e
call CheckForUserInterruption
ret c
; lunge
2015-07-19 08:46:12 +00:00
ld a, SFX_INTRO_LUNGE
2014-05-22 22:13:20 +00:00
call PlaySound
ld a, $48
2015-07-24 21:39:45 +00:00
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation7
2014-05-22 22:13:20 +00:00
jp AnimateIntroNidorino
AnimateIntroNidorino: ; 41793 (10:5793)
ld a, [de]
cp $50
ret z
ld [W_BASECOORDY], a
2014-05-22 22:13:20 +00:00
inc de
ld a, [de]
ld [W_BASECOORDX], a
2014-05-22 22:13:20 +00:00
push de
2015-07-17 05:08:34 +00:00
ld c, 6 * 6
call UpdateIntroNidorinoOAM
2014-05-22 22:13:20 +00:00
ld c, 5
call DelayFrames
pop de
inc de
jr AnimateIntroNidorino
2015-07-17 05:08:34 +00:00
UpdateIntroNidorinoOAM: ; 417ae (10:57ae)
2014-05-22 22:13:20 +00:00
ld hl, wOAMBuffer
2015-07-24 21:39:45 +00:00
ld a, [wIntroNidorinoBaseTile]
2014-05-22 22:13:20 +00:00
ld d, a
2015-07-17 05:08:34 +00:00
.loop
ld a, [W_BASECOORDY]
2014-05-22 22:13:20 +00:00
add [hl]
2015-07-24 21:39:45 +00:00
ld [hli], a ; Y
ld a, [W_BASECOORDX]
2014-05-22 22:13:20 +00:00
add [hl]
2015-07-24 21:39:45 +00:00
ld [hli], a ; X
2014-05-22 22:13:20 +00:00
ld a, d
2015-07-24 21:39:45 +00:00
ld [hli], a ; tile
2014-05-22 22:13:20 +00:00
inc hl
inc d
dec c
2015-07-17 05:08:34 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2015-07-17 05:08:34 +00:00
InitIntroNidorinoOAM: ; 417c7 (10:57c7)
2014-05-22 22:13:20 +00:00
ld hl, wOAMBuffer
2015-07-17 05:08:34 +00:00
ld d, 0
.loop
2014-05-22 22:13:20 +00:00
push bc
ld a, [W_BASECOORDY]
2014-05-22 22:13:20 +00:00
ld e, a
2015-07-17 05:08:34 +00:00
.innerLoop
2014-05-22 22:13:20 +00:00
ld a, e
2015-07-17 05:08:34 +00:00
add 8
2014-05-22 22:13:20 +00:00
ld e, a
2015-07-17 05:08:34 +00:00
ld [hli], a ; Y
ld a, [W_BASECOORDX]
2015-07-17 05:08:34 +00:00
ld [hli], a ; X
2014-05-22 22:13:20 +00:00
ld a, d
2015-07-17 05:08:34 +00:00
ld [hli], a ; tile
2014-05-22 22:13:20 +00:00
ld a, $80
2015-07-17 05:08:34 +00:00
ld [hli], a ; attributes
2014-05-22 22:13:20 +00:00
inc d
dec c
2015-07-17 05:08:34 +00:00
jr nz, .innerLoop
ld a, [W_BASECOORDX]
2015-07-17 05:08:34 +00:00
add 8
ld [W_BASECOORDX], a
2014-05-22 22:13:20 +00:00
pop bc
dec b
2015-07-17 05:08:34 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2015-07-17 05:08:34 +00:00
IntroClearScreen: ; 417f0 (10:57f0)
2014-05-29 08:31:46 +00:00
ld hl, vBGMap1
2014-05-22 22:13:20 +00:00
ld bc, $240
2015-07-17 05:08:34 +00:00
jr IntroClearCommon
2014-05-22 22:13:20 +00:00
2015-07-17 05:08:34 +00:00
IntroClearMiddleOfScreen: ; 417f8 (10:57f8)
; clear the area of the tile map between the black bars on the top and bottom
2015-07-18 20:52:03 +00:00
coord hl, 0, 4
2015-07-17 05:08:34 +00:00
ld bc, SCREEN_WIDTH * 10
IntroClearCommon: ; 417fe (10:57fe)
2014-05-22 22:13:20 +00:00
ld [hl], $0
inc hl
dec bc
ld a, b
or c
2015-07-17 05:08:34 +00:00
jr nz, IntroClearCommon
2014-05-22 22:13:20 +00:00
ret
2015-07-17 05:08:34 +00:00
IntroPlaceBlackTiles: ; 41807 (10:5807)
2014-05-22 22:13:20 +00:00
ld a, $1
2015-07-17 05:08:34 +00:00
.loop
2014-05-22 22:13:20 +00:00
ld [hli], a
dec c
2015-07-17 05:08:34 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
ret
2015-07-17 05:08:34 +00:00
IntroMoveMon: ; 4180e (10:580e)
; d = number of times to move the mon (2 pixels each time)
; e: $00 = move Gengar right, $01 = move Gengar left, $ff = move Nidorino right
2014-05-22 22:13:20 +00:00
ld a, e
cp $ff
2015-07-17 05:08:34 +00:00
jr z, .moveNidorinoRight
2014-05-22 22:13:20 +00:00
cp $1
2015-07-17 05:08:34 +00:00
jr z, .moveGengarLeft
; move Gengar right
2015-02-07 10:43:08 +00:00
ld a, [hSCX]
2014-05-22 22:13:20 +00:00
dec a
dec a
2015-07-17 05:08:34 +00:00
jr .next
.moveNidorinoRight
2014-05-22 22:13:20 +00:00
push de
2015-07-17 05:08:34 +00:00
ld a, 2
ld [W_BASECOORDX], a
2014-05-22 22:13:20 +00:00
xor a
ld [W_BASECOORDY], a
2015-07-17 05:08:34 +00:00
ld c, 6 * 6
call UpdateIntroNidorinoOAM
2014-05-22 22:13:20 +00:00
pop de
2015-07-17 05:08:34 +00:00
.moveGengarLeft
2015-02-07 10:43:08 +00:00
ld a, [hSCX]
2014-05-22 22:13:20 +00:00
inc a
inc a
2015-07-17 05:08:34 +00:00
.next
2015-02-07 10:43:08 +00:00
ld [hSCX], a
2014-05-22 22:13:20 +00:00
push de
2015-07-17 05:08:34 +00:00
ld c, 2
2014-05-22 22:13:20 +00:00
call CheckForUserInterruption
pop de
ret c
dec d
2015-07-17 05:08:34 +00:00
jr nz, IntroMoveMon
2014-05-22 22:13:20 +00:00
ret
2015-07-17 05:08:34 +00:00
IntroCopyTiles: ; 4183f (10:583f)
2015-07-18 20:52:03 +00:00
coord hl, 13, 7
2014-05-22 22:13:20 +00:00
2015-02-07 10:43:08 +00:00
CopyTileIDsFromList_ZeroBaseTileID: ; 41842 (10:5842)
2015-07-17 05:08:34 +00:00
ld c, 0
2015-02-07 10:43:08 +00:00
predef_jump CopyTileIDsFromList
2014-05-22 22:13:20 +00:00
2015-07-17 05:08:34 +00:00
PlayMoveSoundB: ; 41849 (10:5849)
; unused
predef GetMoveSoundB
2014-05-22 22:13:20 +00:00
ld a, b
jp PlaySound
LoadIntroGraphics: ; 41852 (10:5852)
ld hl, FightIntroBackMon
2014-05-29 08:31:46 +00:00
ld de, vChars2
2014-05-22 22:13:20 +00:00
ld bc, $600
ld a, BANK(FightIntroBackMon)
call FarCopyData2
ld hl, GameFreakIntro
2014-05-29 08:31:46 +00:00
ld de, vChars2 + $600
2014-05-22 22:13:20 +00:00
ld bc, $140
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, GameFreakIntro
2014-05-29 08:31:46 +00:00
ld de, vChars1
2014-05-22 22:13:20 +00:00
ld bc, $140
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, FightIntroFrontMon
2014-05-29 08:31:46 +00:00
ld de, vChars0
2014-05-22 22:13:20 +00:00
ld bc, $6c0
ld a, BANK(FightIntroFrontMon)
jp FarCopyData2
PlayShootingStar: ; 4188a (10:588a)
ld b, $c
call GoPAL_SET
callba LoadCopyrightAndTextBoxTiles
ld a, $e4
ld [rBGP], a
ld c, 180
2014-05-22 22:13:20 +00:00
call DelayFrames
call ClearScreen
call DisableLCD
xor a
ld [W_CUROPPONENT], a
2015-07-17 05:08:34 +00:00
call IntroDrawBlackBars
2014-05-22 22:13:20 +00:00
call LoadIntroGraphics
call EnableLCD
ld hl, rLCDC
2014-05-22 22:13:20 +00:00
res 5, [hl]
set 3, [hl]
ld c, 64
2014-05-22 22:13:20 +00:00
call DelayFrames
callba AnimateShootingStar
push af
pop af
2015-07-17 05:08:34 +00:00
jr c, .next ; skip the delay if the user interrupted the animation
ld c, 40
2014-05-22 22:13:20 +00:00
call DelayFrames
2015-07-17 05:08:34 +00:00
.next
2014-06-09 20:18:29 +00:00
ld a, BANK(Music_IntroBattle)
ld [wc0ef], a
ld [wc0f0], a
2014-05-22 22:13:20 +00:00
ld a, MUSIC_INTRO_BATTLE
ld [wc0ee], a
2014-05-22 22:13:20 +00:00
call PlaySound
2015-07-17 05:08:34 +00:00
call IntroClearMiddleOfScreen
2014-05-23 22:34:35 +00:00
call ClearSprites
2014-05-22 22:13:20 +00:00
jp Delay3
2015-07-17 05:08:34 +00:00
IntroDrawBlackBars: ; 418e9 (10:58e9)
; clear the screen and draw black bars on the top and bottom
call IntroClearScreen
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-17 05:08:34 +00:00
ld c, SCREEN_WIDTH * 4
call IntroPlaceBlackTiles
2015-07-18 20:52:03 +00:00
coord hl, 0, 14
2015-07-17 05:08:34 +00:00
ld c, SCREEN_WIDTH * 4
call IntroPlaceBlackTiles
2014-05-29 08:31:46 +00:00
ld hl, vBGMap1
2014-05-22 22:13:20 +00:00
ld c, $80
2015-07-17 05:08:34 +00:00
call IntroPlaceBlackTiles
2014-05-29 08:31:46 +00:00
ld hl, vBGMap1 + $1c0
2014-05-22 22:13:20 +00:00
ld c, $80
2015-07-17 05:08:34 +00:00
jp IntroPlaceBlackTiles
2014-05-22 22:13:20 +00:00
2015-07-17 05:08:34 +00:00
EmptyFunc4: ; 4190c (10:590c)
2014-05-22 22:13:20 +00:00
ret
IntroNidorinoAnimation0: ; 4190d (10:590d)
db 0, 0
db $50
IntroNidorinoAnimation1: ; 41910 (10:5910)
; This is a sequence of pixel movements for part of the Nidorino animation. This
; list describes how Nidorino should hop.
; First byte is y movement, second byte is x movement
db 0, 0
db -2, 2
db -1, 2
db 1, 2
db 2, 2
db $50 ; list terminator
IntroNidorinoAnimation2: ; 4191b (10:591b)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db 0, 0
db -2, -2
db -1, -2
db 1, -2
db 2, -2
db $50 ; list terminator
IntroNidorinoAnimation3: ; 41926 (10:5926)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db 0, 0
db -12, 6
db -8, 6
db 8, 6
db 12, 6
db $50 ; list terminator
IntroNidorinoAnimation4: ; 41931 (10:5931)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db 0, 0
db -8, -4
db -4, -4
db 4, -4
db 8, -4
db $50 ; list terminator
IntroNidorinoAnimation5: ; 4193c (10:593c)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db 0, 0
db -8, 4
db -4, 4
db 4, 4
db 8, 4
db $50 ; list terminator
IntroNidorinoAnimation6: ; 41947 (10:5947)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db 0, 0
db 2, 0
db 2, 0
db 0, 0
db $50 ; list terminator
IntroNidorinoAnimation7: ; 41950 (10:5950)
; This is a sequence of pixel movements for part of the Nidorino animation.
; First byte is y movement, second byte is x movement
db -8, -16
db -7, -14
db -6, -12
db -4, -10
db $50 ; list terminator
GameFreakIntro: ; 41959 (10:5959)
INCBIN "gfx/gamefreak_intro.2bpp"
2014-05-22 22:13:20 +00:00
INCBIN "gfx/gamefreak_logo.2bpp"
ds $10 ; blank tile
FightIntroBackMon: ; 41a99 (10:5a99)
INCBIN "gfx/intro_fight.2bpp"
FightIntroFrontMon: ; 42099 (10:6099)
2014-10-17 08:42:32 +00:00
IF DEF(_RED)
2014-05-22 22:13:20 +00:00
INCBIN "gfx/red/intro_nido_1.6x6.2bpp"
INCBIN "gfx/red/intro_nido_2.6x6.2bpp"
INCBIN "gfx/red/intro_nido_3.6x6.2bpp"
ds $10 ; blank tile
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_BLUE)
2014-05-22 22:13:20 +00:00
INCBIN "gfx/blue/intro_purin_1.6x6.2bpp"
INCBIN "gfx/blue/intro_purin_2.6x6.2bpp"
INCBIN "gfx/blue/intro_purin_3.6x6.2bpp"
ds $10 ; blank tile
ENDC