2023-02-26 16:14:21 +00:00
|
|
|
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.
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wd732]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
2015-07-03 19:37:53 +00:00
|
|
|
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
|
2020-07-05 21:29:11 +00:00
|
|
|
ld hl, wSpriteDataStart
|
|
|
|
ld bc, wSpriteDataEnd - wSpriteDataStart
|
2014-05-22 22:13:20 +00:00
|
|
|
xor a
|
|
|
|
call FillMemory
|
|
|
|
pop af
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2023-02-26 16:14:21 +00:00
|
|
|
; 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.
|
2023-02-26 16:14:21 +00:00
|
|
|
ld hl, DebugNewGamePlayerName
|
2015-07-03 19:37:53 +00:00
|
|
|
ld de, wPlayerName
|
2015-08-11 04:51:20 +00:00
|
|
|
ld bc, NAME_LENGTH
|
2014-05-22 22:13:20 +00:00
|
|
|
call CopyData
|
2023-02-26 16:14:21 +00:00
|
|
|
ld hl, DebugNewGameRivalName
|
2015-08-31 02:38:41 +00:00
|
|
|
ld de, wRivalName
|
2015-08-11 04:51:20 +00:00
|
|
|
ld bc, NAME_LENGTH
|
2014-05-22 22:13:20 +00:00
|
|
|
jp CopyData
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
OakSpeech:
|
2020-07-03 20:37:47 +00:00
|
|
|
ld a, SFX_STOP_ALL_MUSIC
|
|
|
|
call PlaySound
|
2015-07-18 15:17:29 +00:00
|
|
|
ld a, BANK(Music_Routes2)
|
2017-12-30 00:54:27 +00:00
|
|
|
ld c, a
|
2015-07-18 15:17:29 +00:00
|
|
|
ld a, MUSIC_ROUTES2
|
2015-07-03 19:37:53 +00:00
|
|
|
call PlayMusic
|
2014-05-22 22:13:20 +00:00
|
|
|
call ClearScreen
|
|
|
|
call LoadTextBoxTilePatterns
|
2023-02-26 16:14:21 +00:00
|
|
|
call PrepareOakSpeech
|
2014-06-16 20:57:26 +00:00
|
|
|
predef InitPlayerData2
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2020-11-29 20:17:29 +00:00
|
|
|
ldh [hTileAnimations], a
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [wd732]
|
2023-07-15 22:36:59 +00:00
|
|
|
bit BIT_DEBUG_MODE, a
|
|
|
|
jp nz, .skipSpeech
|
2017-12-30 00:54:27 +00:00
|
|
|
ld de, ProfOakPic
|
2020-07-04 02:11:35 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, NIDORINO
|
|
|
|
ld [wd0b5], a
|
|
|
|
ld [wcf91], a
|
2015-07-18 15:17:29 +00:00
|
|
|
call GetMonHeader
|
2020-07-07 15:30:10 +00:00
|
|
|
hlcoord 6, 4
|
2015-07-18 15:17:29 +00:00
|
|
|
call LoadFlippedFrontSpriteByMonIndex
|
2014-05-22 22:13:20 +00:00
|
|
|
call MovePicLeft
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld de, RedPicFront
|
2020-07-04 02:11:35 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld de, Rival1Pic
|
2020-07-04 02:11:35 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld de, RedPicFront
|
2020-07-04 02:11:35 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [wd72d]
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
2017-12-30 00:54:27 +00:00
|
|
|
jr nz, .next
|
|
|
|
ld hl, OakSpeechText3
|
2014-05-22 22:13:20 +00:00
|
|
|
call PrintText
|
|
|
|
.next
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh a, [hLoadedROMBank]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, SFX_SHRINK
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound
|
|
|
|
pop af
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hLoadedROMBank], a
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [MBC1RomBank], a
|
|
|
|
ld c, 4
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrames
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld c, 4
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrames
|
2017-12-30 00:54:27 +00:00
|
|
|
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-06 23:03:05 +00:00
|
|
|
ldh a, [hLoadedROMBank]
|
2014-05-22 22:13:20 +00:00
|
|
|
push af
|
2014-06-10 05:10:11 +00:00
|
|
|
ld a, BANK(Music_PalletTown)
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [wAudioROMBank], a
|
|
|
|
ld [wAudioSavedROMBank], a
|
2015-08-09 05:32:44 +00:00
|
|
|
ld a, 10
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [wAudioFadeOutControl], a
|
2020-07-03 20:37:47 +00:00
|
|
|
ld a, SFX_STOP_ALL_MUSIC
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [wNewSoundID], a
|
2020-07-03 20:37:47 +00:00
|
|
|
call PlaySound
|
2014-05-22 22:13:20 +00:00
|
|
|
pop af
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hLoadedROMBank], a
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [MBC1RomBank], a
|
|
|
|
ld c, 20
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrames
|
2020-07-07 15:30:10 +00:00
|
|
|
hlcoord 6, 5
|
2017-12-30 00:54:27 +00:00
|
|
|
ld b, 7
|
|
|
|
ld c, 7
|
2014-05-22 22:13:20 +00:00
|
|
|
call ClearScreenArea
|
|
|
|
call LoadTextBoxTilePatterns
|
2017-12-30 00:54:27 +00:00
|
|
|
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:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _OakSpeechText1
|
|
|
|
text_end
|
2016-06-12 00:24:04 +00:00
|
|
|
OakSpeechText2:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _OakSpeechText2A
|
2023-07-15 22:36:59 +00:00
|
|
|
; BUG: The cry played does not match the sprite displayed.
|
2020-07-04 21:09:35 +00:00
|
|
|
sound_cry_nidorina
|
|
|
|
text_far _OakSpeechText2B
|
|
|
|
text_end
|
2016-06-12 00:24:04 +00:00
|
|
|
IntroducePlayerText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _IntroducePlayerText
|
|
|
|
text_end
|
2016-06-12 00:24:04 +00:00
|
|
|
IntroduceRivalText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _IntroduceRivalText
|
|
|
|
text_end
|
2016-06-12 00:24:04 +00:00
|
|
|
OakSpeechText3:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _OakSpeechText3
|
|
|
|
text_end
|
2014-05-22 22:13:20 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
FadeInIntroPic:
|
2017-12-30 00:54:27 +00:00
|
|
|
ld hl, IntroFadePalettes
|
|
|
|
ld b, 6
|
2014-05-22 22:13:20 +00:00
|
|
|
.next
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [hli]
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rBGP], a
|
2017-12-30 00:54:27 +00:00
|
|
|
ld c, 10
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrames
|
|
|
|
dec b
|
2017-12-30 00:54:27 +00:00
|
|
|
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:
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, 119
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rWX], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrame
|
|
|
|
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, %11100100
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rBGP], a
|
2014-05-22 22:13:20 +00:00
|
|
|
.next
|
|
|
|
call DelayFrame
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh a, [rWX]
|
2014-05-22 22:13:20 +00:00
|
|
|
sub 8
|
|
|
|
cp $FF
|
|
|
|
ret z
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rWX], a
|
2014-05-22 22:13:20 +00:00
|
|
|
jr .next
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
DisplayPicCenteredOrUpperRight:
|
2014-05-23 22:11:09 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, b
|
2014-05-22 22:13:20 +00:00
|
|
|
call UncompressSpriteFromDE
|
2017-12-30 00:54:27 +00:00
|
|
|
ld hl, sSpriteBuffer1
|
|
|
|
ld de, sSpriteBuffer0
|
|
|
|
ld bc, $310
|
2014-05-22 22:13:20 +00:00
|
|
|
call CopyData
|
2017-12-30 00:54:27 +00:00
|
|
|
ld de, vFrontPic
|
2014-05-22 22:13:20 +00:00
|
|
|
call InterlaceMergeSpriteBuffers
|
|
|
|
pop bc
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, c
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
2020-07-07 15:30:10 +00:00
|
|
|
hlcoord 15, 1
|
2017-12-30 00:54:27 +00:00
|
|
|
jr nz, .next
|
2020-07-07 15:30:10 +00:00
|
|
|
hlcoord 6, 4
|
2014-05-22 22:13:20 +00:00
|
|
|
.next
|
|
|
|
xor a
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hStartTileID], a
|
2015-07-03 19:37:53 +00:00
|
|
|
predef_jump CopyUncompressedPicToTilemap
|