pokered-rematch/engine/intro.asm

459 lines
8.2 KiB
NASM
Raw Normal View History

2015-08-11 06:23:00 +00:00
MOVE_GENGAR_RIGHT EQU $00
MOVE_GENGAR_LEFT EQU $01
MOVE_NIDORINO_RIGHT EQU $ff
2016-06-12 00:24:04 +00:00
PlayIntro:
2014-05-22 22:13:20 +00:00
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
2016-06-12 00:24:04 +00:00
PlayIntroScene:
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_NIDORINO_INTRO
call RunPaletteCommand
2014-05-22 22:13:20 +00:00
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
2015-08-31 02:38:41 +00:00
ld [wBaseCoordX], a
2014-05-22 22:13:20 +00:00
ld a, 80
2015-08-31 02:38:41 +00:00
ld [wBaseCoordY], a
2015-08-05 21:20:29 +00:00
lb bc, 6, 6
2015-07-17 05:08:34 +00:00
call InitIntroNidorinoOAM
2015-08-11 06:23:00 +00:00
lb de, 80 / 2, MOVE_NIDORINO_RIGHT
2015-07-17 05:08:34 +00:00
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-08-11 06:23:00 +00:00
lb de, 8 / 2, MOVE_GENGAR_LEFT
2015-07-17 05:08:34 +00:00
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-08-11 06:23:00 +00:00
lb de, 16 / 2, MOVE_GENGAR_RIGHT
2015-07-17 05:08:34 +00:00
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-08-11 06:23:00 +00:00
lb de, 8 / 2, MOVE_GENGAR_LEFT
2015-07-17 05:08:34 +00:00
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
2016-06-12 00:24:04 +00:00
AnimateIntroNidorino:
2014-05-22 22:13:20 +00:00
ld a, [de]
cp $50
ret z
2015-08-31 02:38:41 +00:00
ld [wBaseCoordY], a
2014-05-22 22:13:20 +00:00
inc de
ld a, [de]
2015-08-31 02:38:41 +00:00
ld [wBaseCoordX], 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
2016-06-12 00:24:04 +00:00
UpdateIntroNidorinoOAM:
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
2015-08-31 02:38:41 +00:00
ld a, [wBaseCoordY]
2014-05-22 22:13:20 +00:00
add [hl]
2015-07-24 21:39:45 +00:00
ld [hli], a ; Y
2015-08-31 02:38:41 +00:00
ld a, [wBaseCoordX]
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
2016-06-12 00:24:04 +00:00
InitIntroNidorinoOAM:
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
2015-08-31 02:38:41 +00:00
ld a, [wBaseCoordY]
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
2015-08-31 02:38:41 +00:00
ld a, [wBaseCoordX]
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
2015-08-31 02:38:41 +00:00
ld a, [wBaseCoordX]
2015-07-17 05:08:34 +00:00
add 8
2015-08-31 02:38:41 +00:00
ld [wBaseCoordX], 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
2016-06-12 00:24:04 +00:00
IntroClearScreen:
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
2016-06-12 00:24:04 +00:00
IntroClearMiddleOfScreen:
2015-07-17 05:08:34 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroClearCommon:
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
2016-06-12 00:24:04 +00:00
IntroPlaceBlackTiles:
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
2016-06-12 00:24:04 +00:00
IntroMoveMon:
2015-07-17 05:08:34 +00:00
; 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
2015-08-31 02:38:41 +00:00
ld [wBaseCoordX], a
2014-05-22 22:13:20 +00:00
xor a
2015-08-31 02:38:41 +00:00
ld [wBaseCoordY], 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
2016-06-12 00:24:04 +00:00
IntroCopyTiles:
2015-07-18 20:52:03 +00:00
coord hl, 13, 7
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
CopyTileIDsFromList_ZeroBaseTileID:
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
2016-06-12 00:24:04 +00:00
PlayMoveSoundB:
2015-07-17 05:08:34 +00:00
; unused
predef GetMoveSoundB
2014-05-22 22:13:20 +00:00
ld a, b
jp PlaySound
2016-06-12 00:24:04 +00:00
LoadIntroGraphics:
ld hl, FightIntroBackMon
2014-05-29 08:31:46 +00:00
ld de, vChars2
2015-08-10 04:56:20 +00:00
ld bc, FightIntroBackMonEnd - FightIntroBackMon
2014-05-22 22:13:20 +00:00
ld a, BANK(FightIntroBackMon)
call FarCopyData2
ld hl, GameFreakIntro
2014-05-29 08:31:46 +00:00
ld de, vChars2 + $600
2015-08-10 04:56:20 +00:00
ld bc, GameFreakIntroEnd - GameFreakIntro
2014-05-22 22:13:20 +00:00
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, GameFreakIntro
2014-05-29 08:31:46 +00:00
ld de, vChars1
2015-08-10 04:56:20 +00:00
ld bc, GameFreakIntroEnd - GameFreakIntro
2014-05-22 22:13:20 +00:00
ld a, BANK(GameFreakIntro)
call FarCopyData2
ld hl, FightIntroFrontMon
2014-05-29 08:31:46 +00:00
ld de, vChars0
2015-08-10 04:56:20 +00:00
ld bc, FightIntroFrontMonEnd - FightIntroFrontMon
2014-05-22 22:13:20 +00:00
ld a, BANK(FightIntroFrontMon)
jp FarCopyData2
2016-06-12 00:24:04 +00:00
PlayShootingStar:
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_GAME_FREAK_INTRO
call RunPaletteCommand
2014-05-22 22:13:20 +00:00
callba LoadCopyrightAndTextBoxTiles
2016-06-12 04:30:05 +00:00
ld a, %11100100
ld [rBGP], a
ld c, 180
2014-05-22 22:13:20 +00:00
call DelayFrames
call ClearScreen
call DisableLCD
xor a
2015-08-31 02:38:41 +00:00
ld [wCurOpponent], 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)
2015-08-09 05:32:44 +00:00
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
2014-05-22 22:13:20 +00:00
ld a, MUSIC_INTRO_BATTLE
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], 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
2016-06-12 00:24:04 +00:00
IntroDrawBlackBars:
2015-07-17 05:08:34 +00:00
; 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
2016-06-12 00:24:04 +00:00
EmptyFunc4:
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation0:
2014-05-22 22:13:20 +00:00
db 0, 0
db $50
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation1:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation2:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation3:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation4:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation5:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation6:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
IntroNidorinoAnimation7:
2014-05-22 22:13:20 +00:00
; 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
2016-06-12 00:24:04 +00:00
GameFreakIntro:
INCBIN "gfx/gamefreak_intro.2bpp"
2014-05-22 22:13:20 +00:00
INCBIN "gfx/gamefreak_logo.2bpp"
ds $10 ; blank tile
2015-08-10 04:56:20 +00:00
GameFreakIntroEnd:
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
FightIntroBackMon:
2014-05-22 22:13:20 +00:00
INCBIN "gfx/intro_fight.2bpp"
2015-08-10 04:56:20 +00:00
FightIntroBackMonEnd:
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
FightIntroFrontMon:
2014-05-22 22:13:20 +00:00
2014-10-17 08:42:32 +00:00
IF DEF(_RED)
INCBIN "gfx/red/intro_nido_1.2bpp"
INCBIN "gfx/red/intro_nido_2.2bpp"
INCBIN "gfx/red/intro_nido_3.2bpp"
2014-05-22 22:13:20 +00:00
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_BLUE)
INCBIN "gfx/blue/intro_purin_1.2bpp"
INCBIN "gfx/blue/intro_purin_2.2bpp"
INCBIN "gfx/blue/intro_purin_3.2bpp"
2014-05-22 22:13:20 +00:00
ENDC
2015-08-10 04:56:20 +00:00
FightIntroFrontMonEnd:
ds $10 ; blank tile