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:
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$FF
|
|
|
|
call PlaySound ; stop music
|
2015-07-18 15:17:29 +00:00
|
|
|
ld a, BANK(Music_Routes2)
|
2014-05-22 22:13:20 +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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl,wNumBoxItems
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,POTION
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wcf91],a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,1
|
2015-07-13 06:00:48 +00:00
|
|
|
ld [wItemQuantity],a
|
2014-05-22 22:13:20 +00:00
|
|
|
call AddItemToInventory ; give one potion
|
2015-08-30 00:15:05 +00:00
|
|
|
ld a,[wDefaultMap]
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wDestinationMap],a
|
|
|
|
call SpecialWarpIn
|
2014-05-22 22:13:20 +00:00
|
|
|
xor a
|
2014-09-14 18:29:18 +00:00
|
|
|
ld [hTilesetType],a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd732]
|
2015-07-18 15:17:29 +00:00
|
|
|
bit 1,a ; possibly a debug mode bit
|
|
|
|
jp nz,.skipChoosingNames
|
2014-05-22 22:13:20 +00:00
|
|
|
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
|
|
|
|
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
|
2015-07-18 15:17:29 +00:00
|
|
|
ld [wd0b5],a
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
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
|
|
|
|
ld hl,IntroducePlayerText
|
|
|
|
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
|
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
|
|
|
|
ld hl,IntroduceRivalText
|
|
|
|
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
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a,[wd72d]
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr nz,.next
|
|
|
|
ld hl,OakSpeechText3
|
|
|
|
call PrintText
|
|
|
|
.next
|
|
|
|
ld a,[H_LOADEDROMBANK]
|
|
|
|
push af
|
2015-07-19 08:46:12 +00:00
|
|
|
ld a,SFX_SHRINK
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound
|
|
|
|
pop af
|
|
|
|
ld [H_LOADEDROMBANK],a
|
2015-07-03 19:37:53 +00:00
|
|
|
ld [MBC1RomBank],a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld c,4
|
|
|
|
call DelayFrames
|
2015-07-03 19:37:53 +00:00
|
|
|
ld de,RedSprite
|
2014-05-29 08:31:46 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld c,4
|
|
|
|
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
|
|
|
|
ld a,[H_LOADEDROMBANK]
|
|
|
|
push af
|
2014-06-10 05:10:11 +00:00
|
|
|
ld a, BANK(Music_PalletTown)
|
2015-08-09 05:32:44 +00:00
|
|
|
ld [wAudioROMBank],a
|
|
|
|
ld [wAudioSavedROMBank],a
|
|
|
|
ld a, 10
|
|
|
|
ld [wAudioFadeOutControl],a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,$FF
|
2015-08-09 05:32:44 +00:00
|
|
|
ld [wNewSoundID],a
|
2014-05-22 22:13:20 +00:00
|
|
|
call PlaySound ; stop music
|
|
|
|
pop af
|
|
|
|
ld [H_LOADEDROMBANK],a
|
2015-07-03 19:37:53 +00:00
|
|
|
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
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b,7
|
|
|
|
ld c,7
|
|
|
|
call ClearScreenArea
|
|
|
|
call LoadTextBoxTilePatterns
|
|
|
|
ld a,1
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wUpdateSpritesEnabled],a
|
2015-07-03 19:37:53 +00:00
|
|
|
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:
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl,IntroFadePalettes
|
|
|
|
ld b,6
|
|
|
|
.next
|
|
|
|
ld a,[hli]
|
|
|
|
ld [rBGP],a
|
|
|
|
ld c,10
|
|
|
|
call DelayFrames
|
|
|
|
dec b
|
|
|
|
jr nz,.next
|
|
|
|
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:
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a,119
|
2015-07-15 02:46:52 +00:00
|
|
|
ld [rWX],a
|
2014-05-22 22:13:20 +00:00
|
|
|
call DelayFrame
|
|
|
|
|
2016-06-12 04:30:05 +00:00
|
|
|
ld a,%11100100
|
2014-05-22 22:13:20 +00:00
|
|
|
ld [rBGP],a
|
|
|
|
.next
|
|
|
|
call DelayFrame
|
2015-07-15 02:46:52 +00:00
|
|
|
ld a,[rWX]
|
2014-05-22 22:13:20 +00:00
|
|
|
sub 8
|
|
|
|
cp $FF
|
|
|
|
ret z
|
2015-07-15 02:46:52 +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
|
|
|
|
ld a,b
|
|
|
|
call UncompressSpriteFromDE
|
2015-08-31 03:15:32 +00:00
|
|
|
ld hl,sSpriteBuffer1
|
|
|
|
ld de,sSpriteBuffer0
|
2014-05-29 08:31:46 +00:00
|
|
|
ld bc,$310
|
2014-05-22 22:13:20 +00:00
|
|
|
call CopyData
|
2014-05-29 08:31:46 +00:00
|
|
|
ld de,vFrontPic
|
2014-05-22 22:13:20 +00:00
|
|
|
call InterlaceMergeSpriteBuffers
|
|
|
|
pop bc
|
|
|
|
ld a,c
|
|
|
|
and a
|
2015-07-18 20:52:03 +00:00
|
|
|
coord hl, 15, 1
|
2014-05-22 22:13:20 +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
|
2015-07-24 03:48:35 +00:00
|
|
|
ld [hStartTileID],a
|
2015-07-03 19:37:53 +00:00
|
|
|
predef_jump CopyUncompressedPicToTilemap
|