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
|
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
|
|
|
|
ld hl, wSpriteStateData1
|
|
|
|
ld bc, $200
|
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl, NintenText
|
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
|
|
|
|
ld hl, SonyText
|
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:
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, $FF
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound ; stop music
|
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
|
|
|
|
call SetDefaultNames
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
call AddItemToInventory ; give one potion
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [hTilesetType], a
|
|
|
|
ld a, [wd732]
|
|
|
|
bit 1, a ; possibly a debug mode bit
|
|
|
|
jp nz, .skipChoosingNames
|
|
|
|
ld de, ProfOakPic
|
2015-08-05 21:20:29 +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
|
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
|
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
|
2015-08-05 21:20:29 +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
|
2015-08-05 21:20:29 +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
|
|
|
|
.skipChoosingNames
|
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
|
2015-08-05 21:20:29 +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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [H_LOADEDROMBANK]
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [H_LOADEDROMBANK], a
|
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [H_LOADEDROMBANK]
|
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
|
|
|
|
ld a, $FF
|
|
|
|
ld [wNewSoundID], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound ; stop music
|
|
|
|
pop af
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [H_LOADEDROMBANK], 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
|
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:
|
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:
|
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]
|
|
|
|
ld [rBGP], a
|
|
|
|
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:
|
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:
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, 119
|
|
|
|
ld [rWX], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrame
|
|
|
|
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, %11100100
|
|
|
|
ld [rBGP], a
|
2014-05-22 22:13:20 +00:00
|
|
|
.next
|
|
|
|
call DelayFrame
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [rWX]
|
2014-05-22 22:13:20 +00:00
|
|
|
sub 8
|
|
|
|
cp $FF
|
|
|
|
ret z
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [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
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 15, 1
|
2017-12-30 00:54:27 +00:00
|
|
|
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
|
2017-12-30 00:54:27 +00:00
|
|
|
ld [hStartTileID], a
|
2015-07-03 19:37:53 +00:00
|
|
|
predef_jump CopyUncompressedPicToTilemap
|