pokered/engine/movie/oak_speech/oak_speech.asm

234 lines
4.2 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
SetDefaultNames:
2015-07-15 02:46:52 +00:00
ld a, [wLetterPrintingDelayFlags]
2014-05-22 22:13:20 +00:00
push af
2015-08-31 02:38:41 +00:00
ld a, [wOptions]
2014-05-22 22:13:20 +00:00
push af
ld a, [wd732]
2014-05-22 22:13:20 +00:00
push af
ld hl, wPlayerName
2016-06-12 04:30:05 +00:00
ld bc, wBoxDataEnd - wPlayerName
2014-05-22 22:13:20 +00:00
xor a
call FillMemory
ld hl, wSpriteStateData1
ld bc, $200
xor a
call FillMemory
pop af
ld [wd732], a
2014-05-22 22:13:20 +00:00
pop af
2015-08-31 02:38:41 +00:00
ld [wOptions], a
2014-05-22 22:13:20 +00:00
pop af
2015-07-15 02:46:52 +00:00
ld [wLetterPrintingDelayFlags], a
2015-07-19 03:49:52 +00:00
ld a, [wOptionsInitialized]
2014-05-22 22:13:20 +00:00
and a
2015-07-19 03:49:52 +00:00
call z, InitOptions
2014-05-22 22:13:20 +00:00
ld hl, NintenText
ld de, wPlayerName
ld bc, NAME_LENGTH
2014-05-22 22:13:20 +00:00
call CopyData
ld hl, SonyText
2015-08-31 02:38:41 +00:00
ld de, wRivalName
ld bc, NAME_LENGTH
2014-05-22 22:13:20 +00:00
jp CopyData
2016-06-12 00:24:04 +00:00
OakSpeech:
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
2015-07-18 15:17:29 +00:00
ld a, BANK(Music_Routes2)
ld c, a
2015-07-18 15:17:29 +00:00
ld a, MUSIC_ROUTES2
call PlayMusic
2014-05-22 22:13:20 +00:00
call ClearScreen
call LoadTextBoxTilePatterns
call SetDefaultNames
predef InitPlayerData2
ld hl, wNumBoxItems
ld a, POTION
ld [wcf91], a
ld a, 1
ld [wItemQuantity], a
2014-05-22 22:13:20 +00:00
call AddItemToInventory ; give one potion
ld a, [wDefaultMap]
ld [wDestinationMap], a
2014-09-13 07:50:56 +00:00
call SpecialWarpIn
2014-05-22 22:13:20 +00:00
xor a
ld [hTilesetType], a
ld a, [wd732]
bit 1, a ; possibly a debug mode bit
jp nz, .skipChoosingNames
ld de, ProfOakPic
lb bc, BANK(ProfOakPic), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
2014-05-22 22:13:20 +00:00
call FadeInIntroPic
ld hl, OakSpeechText1
2015-07-18 15:17:29 +00:00
call PrintText
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
call ClearScreen
ld a, NIDORINO
ld [wd0b5], a
ld [wcf91], a
2015-07-18 15:17:29 +00:00
call GetMonHeader
2015-07-18 20:52:03 +00:00
coord hl, 6, 4
2015-07-18 15:17:29 +00:00
call LoadFlippedFrontSpriteByMonIndex
2014-05-22 22:13:20 +00:00
call MovePicLeft
ld hl, OakSpeechText2
2015-07-18 15:17:29 +00:00
call PrintText
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
2014-05-22 22:13:20 +00:00
call MovePicLeft
ld hl, IntroducePlayerText
2014-05-22 22:13:20 +00:00
call PrintText
2015-07-18 15:17:29 +00:00
call ChoosePlayerName
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
call ClearScreen
ld de, Rival1Pic
lb bc, BANK(Rival1Pic), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
2014-05-22 22:13:20 +00:00
call FadeInIntroPic
ld hl, IntroduceRivalText
2014-05-22 22:13:20 +00:00
call PrintText
2015-07-18 15:17:29 +00:00
call ChooseRivalName
.skipChoosingNames
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
call ClearScreen
ld de, RedPicFront
lb bc, BANK(RedPicFront), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
2014-09-13 07:50:56 +00:00
call GBFadeInFromWhite
ld a, [wd72d]
2014-05-22 22:13:20 +00:00
and a
jr nz, .next
ld hl, OakSpeechText3
2014-05-22 22:13:20 +00:00
call PrintText
.next
2020-07-03 23:59:41 +00:00
ld a, [hLoadedROMBank]
2014-05-22 22:13:20 +00:00
push af
ld a, SFX_SHRINK
2014-05-22 22:13:20 +00:00
call PlaySound
pop af
2020-07-03 23:59:41 +00:00
ld [hLoadedROMBank], a
ld [MBC1RomBank], a
ld c, 4
2014-05-22 22:13:20 +00:00
call DelayFrames
ld de, RedSprite
ld hl, vSprites
2015-08-05 21:20:29 +00:00
lb bc, BANK(RedSprite), $0C
2014-05-22 22:13:20 +00:00
call CopyVideoData
ld de, ShrinkPic1
2015-08-05 21:20:29 +00:00
lb bc, BANK(ShrinkPic1), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
ld c, 4
2014-05-22 22:13:20 +00:00
call DelayFrames
ld de, ShrinkPic2
2015-08-05 21:20:29 +00:00
lb bc, BANK(ShrinkPic2), $00
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
2014-05-22 22:13:20 +00:00
call ResetPlayerSpriteData
2020-07-03 23:59:41 +00:00
ld a, [hLoadedROMBank]
2014-05-22 22:13:20 +00:00
push af
ld a, BANK(Music_PalletTown)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
2015-08-09 05:32:44 +00:00
ld a, 10
ld [wAudioFadeOutControl], a
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
call PlaySound
2014-05-22 22:13:20 +00:00
pop af
2020-07-03 23:59:41 +00:00
ld [hLoadedROMBank], a
ld [MBC1RomBank], a
ld c, 20
2014-05-22 22:13:20 +00:00
call DelayFrames
2015-07-18 20:52:03 +00:00
coord hl, 6, 5
ld b, 7
ld c, 7
2014-05-22 22:13:20 +00:00
call ClearScreenArea
call LoadTextBoxTilePatterns
ld a, 1
ld [wUpdateSpritesEnabled], a
ld c, 50
2014-05-22 22:13:20 +00:00
call DelayFrames
2014-09-13 07:50:56 +00:00
call GBFadeOutToWhite
2014-05-22 22:13:20 +00:00
jp ClearScreen
2016-06-12 00:24:04 +00:00
OakSpeechText1:
2014-05-22 22:13:20 +00:00
TX_FAR _OakSpeechText1
db "@"
2016-06-12 00:24:04 +00:00
OakSpeechText2:
2014-05-22 22:13:20 +00:00
TX_FAR _OakSpeechText2A
2016-07-18 06:17:03 +00:00
TX_CRY_NIDORINA
2014-05-22 22:13:20 +00:00
TX_FAR _OakSpeechText2B
db "@"
2016-06-12 00:24:04 +00:00
IntroducePlayerText:
2014-05-22 22:13:20 +00:00
TX_FAR _IntroducePlayerText
db "@"
2016-06-12 00:24:04 +00:00
IntroduceRivalText:
2014-05-22 22:13:20 +00:00
TX_FAR _IntroduceRivalText
db "@"
2016-06-12 00:24:04 +00:00
OakSpeechText3:
2014-05-22 22:13:20 +00:00
TX_FAR _OakSpeechText3
db "@"
2016-06-12 00:24:04 +00:00
FadeInIntroPic:
ld hl, IntroFadePalettes
ld b, 6
2014-05-22 22:13:20 +00:00
.next
ld a, [hli]
ld [rBGP], a
ld c, 10
2014-05-22 22:13:20 +00:00
call DelayFrames
dec b
jr nz, .next
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
IntroFadePalettes:
2014-05-22 22:13:20 +00:00
db %01010100
db %10101000
db %11111100
db %11111000
db %11110100
db %11100100
2016-06-12 00:24:04 +00:00
MovePicLeft:
ld a, 119
ld [rWX], a
2014-05-22 22:13:20 +00:00
call DelayFrame
ld a, %11100100
ld [rBGP], a
2014-05-22 22:13:20 +00:00
.next
call DelayFrame
ld a, [rWX]
2014-05-22 22:13:20 +00:00
sub 8
cp $FF
ret z
ld [rWX], a
2014-05-22 22:13:20 +00:00
jr .next
2016-06-12 00:24:04 +00:00
DisplayPicCenteredOrUpperRight:
call GetPredefRegisters
2016-06-12 00:24:04 +00:00
IntroDisplayPicCenteredOrUpperRight:
2015-07-18 15:17:29 +00:00
; b = bank
; de = address of compressed pic
; c: 0 = centred, non-zero = upper-right
2014-05-22 22:13:20 +00:00
push bc
ld a, b
2014-05-22 22:13:20 +00:00
call UncompressSpriteFromDE
ld hl, sSpriteBuffer1
ld de, sSpriteBuffer0
ld bc, $310
2014-05-22 22:13:20 +00:00
call CopyData
ld de, vFrontPic
2014-05-22 22:13:20 +00:00
call InterlaceMergeSpriteBuffers
pop bc
ld a, c
2014-05-22 22:13:20 +00:00
and a
2015-07-18 20:52:03 +00:00
coord hl, 15, 1
jr nz, .next
2015-07-18 20:52:03 +00:00
coord hl, 6, 4
2014-05-22 22:13:20 +00:00
.next
xor a
ld [hStartTileID], a
predef_jump CopyUncompressedPicToTilemap