pokered/engine/movie/oak_speech/oak_speech.asm

243 lines
4.8 KiB
NASM
Raw Normal View History

PrepareOakSpeech:
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
2023-07-15 22:36:59 +00:00
; Retrieve BIT_DEBUG_MODE set in DebugMenu for StartNewGameDebug.
; BUG: StartNewGame carries over bit 5 from previous save files,
; which causes CheckForceBikeOrSurf to not return.
; To fix this in debug builds, reset bit 5 here or in StartNewGame.
; In non-debug builds, the instructions can be removed.
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, wSpriteDataStart
ld bc, wSpriteDataEnd - wSpriteDataStart
2014-05-22 22:13:20 +00:00
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
; These debug names are used for StartNewGameDebug.
; TestBattle uses the debug names from DebugMenu.
2023-07-15 22:36:59 +00:00
; A variant of this process is performed in PrepareTitleScreen.
ld hl, DebugNewGamePlayerName
ld de, wPlayerName
ld bc, NAME_LENGTH
2014-05-22 22:13:20 +00:00
call CopyData
ld hl, DebugNewGameRivalName
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 PrepareOakSpeech
predef InitPlayerData2
ld hl, wNumBoxItems
ld a, POTION
ld [wcf91], a
ld a, 1
ld [wItemQuantity], a
2023-07-15 22:36:59 +00:00
call AddItemToInventory
ld a, [wDefaultMap]
ld [wDestinationMap], a
2023-07-15 22:36:59 +00:00
call PrepareForSpecialWarp
2014-05-22 22:13:20 +00:00
xor a
ldh [hTileAnimations], a
ld a, [wd732]
2023-07-15 22:36:59 +00:00
bit BIT_DEBUG_MODE, a
jp nz, .skipSpeech
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
hlcoord 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
2023-07-15 22:36:59 +00:00
.skipSpeech
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
ldh 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
ldh [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
ldh 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
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld c, 20
2014-05-22 22:13:20 +00:00
call DelayFrames
hlcoord 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:
text_far _OakSpeechText1
text_end
2016-06-12 00:24:04 +00:00
OakSpeechText2:
text_far _OakSpeechText2A
2023-07-15 22:36:59 +00:00
; BUG: The cry played does not match the sprite displayed.
sound_cry_nidorina
text_far _OakSpeechText2B
text_end
2016-06-12 00:24:04 +00:00
IntroducePlayerText:
text_far _IntroducePlayerText
text_end
2016-06-12 00:24:04 +00:00
IntroduceRivalText:
text_far _IntroduceRivalText
text_end
2016-06-12 00:24:04 +00:00
OakSpeechText3:
text_far _OakSpeechText3
text_end
2014-05-22 22:13:20 +00:00
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]
ldh [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:
2023-11-20 22:53:19 +00:00
dc 1, 1, 1, 0
dc 2, 2, 2, 0
dc 3, 3, 3, 0
dc 3, 3, 2, 0
dc 3, 3, 1, 0
dc 3, 2, 1, 0
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
MovePicLeft:
ld a, 119
ldh [rWX], a
2014-05-22 22:13:20 +00:00
call DelayFrame
ld a, %11100100
ldh [rBGP], a
2014-05-22 22:13:20 +00:00
.next
call DelayFrame
ldh a, [rWX]
2014-05-22 22:13:20 +00:00
sub 8
cp $FF
ret z
ldh [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
hlcoord 15, 1
jr nz, .next
hlcoord 6, 4
2014-05-22 22:13:20 +00:00
.next
xor a
ldh [hStartTileID], a
predef_jump CopyUncompressedPicToTilemap