123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- MOVE_GENGAR_RIGHT EQU $00
- MOVE_GENGAR_LEFT EQU $01
- MOVE_NIDORINO_RIGHT EQU $ff
- PlayIntro:
- xor a
- ld [hJoyHeld], a
- inc a
- ld [H_AUTOBGTRANSFERENABLED], a
- call PlayShootingStar
- call PlayIntroScene
- call GBFadeOutToWhite
- xor a
- ld [hSCX], a
- ld [H_AUTOBGTRANSFERENABLED], a
- call ClearSprites
- call DelayFrame
- ret
- PlayIntroScene:
- ld b, SET_PAL_NIDORINO_INTRO
- call RunPaletteCommand
- ld a, %11100100
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
- xor a
- ld [hSCX], a
- ld b, $3 ; Gengar tiles
- call IntroCopyTiles
- ld a, 0
- ld [wBaseCoordX], a
- ld a, 80
- ld [wBaseCoordY], a
- lb bc, 6, 6
- call InitIntroNidorinoOAM
- lb de, 80 / 2, MOVE_NIDORINO_RIGHT
- call IntroMoveMon
- ret c
- ; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- xor a
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation1
- call AnimateIntroNidorino
- ; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation2
- call AnimateIntroNidorino
- ld c, $a
- call CheckForUserInterruption
- ret c
- ; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- ld de, IntroNidorinoAnimation1
- call AnimateIntroNidorino
- ; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation2
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
- ; raise
- ld b, $4
- call IntroCopyTiles
- ld a, SFX_INTRO_RAISE
- call PlaySound
- lb de, 8 / 2, MOVE_GENGAR_LEFT
- call IntroMoveMon
- ld c, $1e
- call CheckForUserInterruption
- ret c
- ; slash
- ld b, $5
- call IntroCopyTiles
- ld a, SFX_INTRO_CRASH
- call PlaySound
- lb de, 16 / 2, MOVE_GENGAR_RIGHT
- call IntroMoveMon
- ; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- ld a, $24
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation3
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
- lb de, 8 / 2, MOVE_GENGAR_LEFT
- call IntroMoveMon
- ld b, $3
- call IntroCopyTiles
- ld c, $3c
- call CheckForUserInterruption
- ret c
- ; hip
- ld a, SFX_INTRO_HIP
- call PlaySound
- xor a
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation4
- call AnimateIntroNidorino
- ; hop
- ld a, SFX_INTRO_HOP
- call PlaySound
- ld de, IntroNidorinoAnimation5
- call AnimateIntroNidorino
- ld c, $14
- call CheckForUserInterruption
- ret c
- ld a, $24
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation6
- call AnimateIntroNidorino
- ld c, $1e
- call CheckForUserInterruption
- ret c
- ; lunge
- ld a, SFX_INTRO_LUNGE
- call PlaySound
- ld a, $48
- ld [wIntroNidorinoBaseTile], a
- ld de, IntroNidorinoAnimation7
- jp AnimateIntroNidorino
- AnimateIntroNidorino:
- ld a, [de]
- cp $50
- ret z
- ld [wBaseCoordY], a
- inc de
- ld a, [de]
- ld [wBaseCoordX], a
- push de
- ld c, 6 * 6
- call UpdateIntroNidorinoOAM
- ld c, 5
- call DelayFrames
- pop de
- inc de
- jr AnimateIntroNidorino
- UpdateIntroNidorinoOAM:
- ld hl, wOAMBuffer
- ld a, [wIntroNidorinoBaseTile]
- ld d, a
- .loop
- ld a, [wBaseCoordY]
- add [hl]
- ld [hli], a ; Y
- ld a, [wBaseCoordX]
- add [hl]
- ld [hli], a ; X
- ld a, d
- ld [hli], a ; tile
- inc hl
- inc d
- dec c
- jr nz, .loop
- ret
- InitIntroNidorinoOAM:
- ld hl, wOAMBuffer
- ld d, 0
- .loop
- push bc
- ld a, [wBaseCoordY]
- ld e, a
- .innerLoop
- ld a, e
- add 8
- ld e, a
- ld [hli], a ; Y
- ld a, [wBaseCoordX]
- ld [hli], a ; X
- ld a, d
- ld [hli], a ; tile
- ld a, $80
- ld [hli], a ; attributes
- inc d
- dec c
- jr nz, .innerLoop
- ld a, [wBaseCoordX]
- add 8
- ld [wBaseCoordX], a
- pop bc
- dec b
- jr nz, .loop
- ret
- IntroClearScreen:
- ld hl, vBGMap1
- ld bc, $240
- jr IntroClearCommon
- IntroClearMiddleOfScreen:
- ; clear the area of the tile map between the black bars on the top and bottom
- coord hl, 0, 4
- ld bc, SCREEN_WIDTH * 10
- IntroClearCommon:
- ld [hl], $0
- inc hl
- dec bc
- ld a, b
- or c
- jr nz, IntroClearCommon
- ret
- IntroPlaceBlackTiles:
- ld a, $1
- .loop
- ld [hli], a
- dec c
- jr nz, .loop
- ret
- IntroMoveMon:
- ; 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
- ld a, e
- cp $ff
- jr z, .moveNidorinoRight
- cp $1
- jr z, .moveGengarLeft
- ; move Gengar right
- ld a, [hSCX]
- dec a
- dec a
- jr .next
- .moveNidorinoRight
- push de
- ld a, 2
- ld [wBaseCoordX], a
- xor a
- ld [wBaseCoordY], a
- ld c, 6 * 6
- call UpdateIntroNidorinoOAM
- pop de
- .moveGengarLeft
- ld a, [hSCX]
- inc a
- inc a
- .next
- ld [hSCX], a
- push de
- ld c, 2
- call CheckForUserInterruption
- pop de
- ret c
- dec d
- jr nz, IntroMoveMon
- ret
- IntroCopyTiles:
- coord hl, 13, 7
- CopyTileIDsFromList_ZeroBaseTileID:
- ld c, 0
- predef_jump CopyTileIDsFromList
- PlayMoveSoundB:
- ; unused
- predef GetMoveSoundB
- ld a, b
- jp PlaySound
- LoadIntroGraphics:
- ld hl, FightIntroBackMon
- ld de, vChars2
- ld bc, FightIntroBackMonEnd - FightIntroBackMon
- ld a, BANK(FightIntroBackMon)
- call FarCopyData2
- ld hl, GameFreakIntro
- ld de, vChars2 + $600
- ld bc, GameFreakIntroEnd - GameFreakIntro
- ld a, BANK(GameFreakIntro)
- call FarCopyData2
- ld hl, GameFreakIntro
- ld de, vChars1
- ld bc, GameFreakIntroEnd - GameFreakIntro
- ld a, BANK(GameFreakIntro)
- call FarCopyData2
- ld hl, FightIntroFrontMon
- ld de, vChars0
- ld bc, FightIntroFrontMonEnd - FightIntroFrontMon
- ld a, BANK(FightIntroFrontMon)
- jp FarCopyData2
- PlayShootingStar:
- ld b, SET_PAL_GAME_FREAK_INTRO
- call RunPaletteCommand
- callba LoadCopyrightAndTextBoxTiles
- ld a, %11100100
- ld [rBGP], a
- ld c, 180
- call DelayFrames
- call ClearScreen
- call DisableLCD
- xor a
- ld [wCurOpponent], a
- call IntroDrawBlackBars
- call LoadIntroGraphics
- call EnableLCD
- ld hl, rLCDC
- res 5, [hl]
- set 3, [hl]
- ld c, 64
- call DelayFrames
- callba AnimateShootingStar
- push af
- pop af
- jr c, .next ; skip the delay if the user interrupted the animation
- ld c, 40
- call DelayFrames
- .next
- ld a, BANK(Music_IntroBattle)
- ld [wAudioROMBank], a
- ld [wAudioSavedROMBank], a
- ld a, MUSIC_INTRO_BATTLE
- ld [wNewSoundID], a
- call PlaySound
- call IntroClearMiddleOfScreen
- call ClearSprites
- jp Delay3
- IntroDrawBlackBars:
- ; clear the screen and draw black bars on the top and bottom
- call IntroClearScreen
- coord hl, 0, 0
- ld c, SCREEN_WIDTH * 4
- call IntroPlaceBlackTiles
- coord hl, 0, 14
- ld c, SCREEN_WIDTH * 4
- call IntroPlaceBlackTiles
- ld hl, vBGMap1
- ld c, $80
- call IntroPlaceBlackTiles
- ld hl, vBGMap1 + $1c0
- ld c, $80
- jp IntroPlaceBlackTiles
- EmptyFunc4:
- ret
- IntroNidorinoAnimation0:
- db 0, 0
- db $50
- IntroNidorinoAnimation1:
- ; 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:
- ; 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:
- ; 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:
- ; 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:
- ; 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:
- ; 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:
- ; 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:
- INCBIN "gfx/gamefreak_intro.2bpp"
- INCBIN "gfx/gamefreak_logo.2bpp"
- ds $10 ; blank tile
- GameFreakIntroEnd:
- FightIntroBackMon:
- INCBIN "gfx/intro_fight.2bpp"
- FightIntroBackMonEnd:
- FightIntroFrontMon:
- IF DEF(_RED)
- INCBIN "gfx/red/intro_nido_1.2bpp"
- INCBIN "gfx/red/intro_nido_2.2bpp"
- INCBIN "gfx/red/intro_nido_3.2bpp"
- ENDC
- IF DEF(_BLUE)
- INCBIN "gfx/blue/intro_purin_1.2bpp"
- INCBIN "gfx/blue/intro_purin_2.2bpp"
- INCBIN "gfx/blue/intro_purin_3.2bpp"
- ENDC
- FightIntroFrontMonEnd:
- ds $10 ; blank tile
|