diff options
| author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-07-03 09:38:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-03 09:38:52 -0400 |
| commit | c85050497c1bd062e9cd40bf5b32fa3beca366cc (patch) | |
| tree | 9593ddd3ab820223ab580d5fc0ae133b485b8315 /engine/movie/oak_speech | |
| parent | Actually run .travis/webhook.sh (diff) | |
| parent | Add engine/movie/oak_speech/ subdirectory (diff) | |
| download | pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.gz pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.xz pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.zip | |
Merge pull request #256 from Rangi42/master
Add subdirectories to engine/ similar to pokecrystal
Diffstat (limited to 'engine/movie/oak_speech')
| -rwxr-xr-x | engine/movie/oak_speech/clear_save.asm | 23 | ||||
| -rw-r--r-- | engine/movie/oak_speech/init_player_data.asm | 55 | ||||
| -rwxr-xr-x | engine/movie/oak_speech/oak_speech.asm | 233 | ||||
| -rwxr-xr-x | engine/movie/oak_speech/oak_speech2.asm | 219 |
4 files changed, 530 insertions, 0 deletions
diff --git a/engine/movie/oak_speech/clear_save.asm b/engine/movie/oak_speech/clear_save.asm new file mode 100755 index 00000000..b47cd6c4 --- /dev/null +++ b/engine/movie/oak_speech/clear_save.asm @@ -0,0 +1,23 @@ +DoClearSaveDialogue: + call ClearScreen + call RunDefaultPaletteCommand + call LoadFontTilePatterns + call LoadTextBoxTilePatterns + ld hl, ClearSaveDataText + call PrintText + coord hl, 14, 7 + lb bc, 8, 15 + ld a, NO_YES_MENU + ld [wTwoOptionMenuID], a + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a + call DisplayTextBoxID + ld a, [wCurrentMenuItem] + and a + jp z, Init + callba ClearSAV + jp Init + +ClearSaveDataText: + TX_FAR _ClearSaveDataText + db "@" diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm new file mode 100644 index 00000000..c576e65a --- /dev/null +++ b/engine/movie/oak_speech/init_player_data.asm @@ -0,0 +1,55 @@ +InitPlayerData: +InitPlayerData2: + + call Random + ld a, [hRandomSub] + ld [wPlayerID], a + + call Random + ld a, [hRandomAdd] + ld [wPlayerID + 1], a + + ld a, $ff + ld [wUnusedD71B], a + + ld hl, wPartyCount + call InitializeEmptyList + ld hl, wNumInBox + call InitializeEmptyList + ld hl, wNumBagItems + call InitializeEmptyList + ld hl, wNumBoxItems + call InitializeEmptyList + +START_MONEY EQU $3000 + ld hl, wPlayerMoney + 1 + ld a, START_MONEY / $100 + ld [hld], a + xor a + ld [hli], a + inc hl + ld [hl], a + + ld [wMonDataLocation], a + + ld hl, wObtainedBadges + ld [hli], a + + ld [hl], a + + ld hl, wPlayerCoins + ld [hli], a + ld [hl], a + + ld hl, wGameProgressFlags + ld bc, wGameProgressFlagsEnd - wGameProgressFlags + call FillMemory ; clear all game progress flags + + jp InitializeMissableObjectsFlags + +InitializeEmptyList: + xor a ; count + ld [hli], a + dec a ; terminator + ld [hl], a + ret diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm new file mode 100755 index 00000000..b1acfb65 --- /dev/null +++ b/engine/movie/oak_speech/oak_speech.asm @@ -0,0 +1,233 @@ +SetDefaultNames: + ld a, [wLetterPrintingDelayFlags] + push af + ld a, [wOptions] + push af + ld a, [wd732] + push af + ld hl, wPlayerName + ld bc, wBoxDataEnd - wPlayerName + xor a + call FillMemory + ld hl, wSpriteStateData1 + ld bc, $200 + xor a + call FillMemory + pop af + ld [wd732], a + pop af + ld [wOptions], a + pop af + ld [wLetterPrintingDelayFlags], a + ld a, [wOptionsInitialized] + and a + call z, InitOptions + ld hl, NintenText + ld de, wPlayerName + ld bc, NAME_LENGTH + call CopyData + ld hl, SonyText + ld de, wRivalName + ld bc, NAME_LENGTH + jp CopyData + +OakSpeech: + ld a, $FF + call PlaySound ; stop music + ld a, BANK(Music_Routes2) + ld c, a + ld a, MUSIC_ROUTES2 + call PlayMusic + call ClearScreen + call LoadTextBoxTilePatterns + call SetDefaultNames + predef InitPlayerData2 + ld hl, wNumBoxItems + ld a, POTION + ld [wcf91], a + ld a, 1 + ld [wItemQuantity], a + call AddItemToInventory ; give one potion + ld a, [wDefaultMap] + ld [wDestinationMap], a + call SpecialWarpIn + 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 + call IntroDisplayPicCenteredOrUpperRight + call FadeInIntroPic + ld hl, OakSpeechText1 + call PrintText + call GBFadeOutToWhite + call ClearScreen + ld a, NIDORINO + ld [wd0b5], a + ld [wcf91], a + call GetMonHeader + coord hl, 6, 4 + call LoadFlippedFrontSpriteByMonIndex + call MovePicLeft + ld hl, OakSpeechText2 + call PrintText + call GBFadeOutToWhite + call ClearScreen + ld de, RedPicFront + lb bc, Bank(RedPicFront), $00 + call IntroDisplayPicCenteredOrUpperRight + call MovePicLeft + ld hl, IntroducePlayerText + call PrintText + call ChoosePlayerName + call GBFadeOutToWhite + call ClearScreen + ld de, Rival1Pic + lb bc, Bank(Rival1Pic), $00 + call IntroDisplayPicCenteredOrUpperRight + call FadeInIntroPic + ld hl, IntroduceRivalText + call PrintText + call ChooseRivalName +.skipChoosingNames + call GBFadeOutToWhite + call ClearScreen + ld de, RedPicFront + lb bc, Bank(RedPicFront), $00 + call IntroDisplayPicCenteredOrUpperRight + call GBFadeInFromWhite + ld a, [wd72d] + and a + jr nz, .next + ld hl, OakSpeechText3 + call PrintText +.next + ld a, [H_LOADEDROMBANK] + push af + ld a, SFX_SHRINK + call PlaySound + pop af + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ld c, 4 + call DelayFrames + ld de, RedSprite + ld hl, vSprites + lb bc, BANK(RedSprite), $0C + call CopyVideoData + ld de, ShrinkPic1 + lb bc, BANK(ShrinkPic1), $00 + call IntroDisplayPicCenteredOrUpperRight + ld c, 4 + call DelayFrames + ld de, ShrinkPic2 + lb bc, BANK(ShrinkPic2), $00 + call IntroDisplayPicCenteredOrUpperRight + call ResetPlayerSpriteData + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(Music_PalletTown) + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + ld a, 10 + ld [wAudioFadeOutControl], a + ld a, $FF + ld [wNewSoundID], a + call PlaySound ; stop music + pop af + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + ld c, 20 + call DelayFrames + coord hl, 6, 5 + ld b, 7 + ld c, 7 + call ClearScreenArea + call LoadTextBoxTilePatterns + ld a, 1 + ld [wUpdateSpritesEnabled], a + ld c, 50 + call DelayFrames + call GBFadeOutToWhite + jp ClearScreen +OakSpeechText1: + TX_FAR _OakSpeechText1 + db "@" +OakSpeechText2: + TX_FAR _OakSpeechText2A + TX_CRY_NIDORINA + TX_FAR _OakSpeechText2B + db "@" +IntroducePlayerText: + TX_FAR _IntroducePlayerText + db "@" +IntroduceRivalText: + TX_FAR _IntroduceRivalText + db "@" +OakSpeechText3: + TX_FAR _OakSpeechText3 + db "@" + +FadeInIntroPic: + ld hl, IntroFadePalettes + ld b, 6 +.next + ld a, [hli] + ld [rBGP], a + ld c, 10 + call DelayFrames + dec b + jr nz, .next + ret + +IntroFadePalettes: + db %01010100 + db %10101000 + db %11111100 + db %11111000 + db %11110100 + db %11100100 + +MovePicLeft: + ld a, 119 + ld [rWX], a + call DelayFrame + + ld a, %11100100 + ld [rBGP], a +.next + call DelayFrame + ld a, [rWX] + sub 8 + cp $FF + ret z + ld [rWX], a + jr .next + +DisplayPicCenteredOrUpperRight: + call GetPredefRegisters +IntroDisplayPicCenteredOrUpperRight: +; b = bank +; de = address of compressed pic +; c: 0 = centred, non-zero = upper-right + push bc + ld a, b + call UncompressSpriteFromDE + ld hl, sSpriteBuffer1 + ld de, sSpriteBuffer0 + ld bc, $310 + call CopyData + ld de, vFrontPic + call InterlaceMergeSpriteBuffers + pop bc + ld a, c + and a + coord hl, 15, 1 + jr nz, .next + coord hl, 6, 4 +.next + xor a + ld [hStartTileID], a + predef_jump CopyUncompressedPicToTilemap diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm new file mode 100755 index 00000000..fdc9ffa3 --- /dev/null +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -0,0 +1,219 @@ +ChoosePlayerName: + call OakSpeechSlidePicRight + ld de, DefaultNamesPlayer + call DisplayIntroNameTextBox + ld a, [wCurrentMenuItem] + and a + jr z, .customName + ld hl, DefaultNamesPlayerList + call GetDefaultName + ld de, wPlayerName + call OakSpeechSlidePicLeft + jr .done +.customName + ld hl, wPlayerName + xor a ; NAME_PLAYER_SCREEN + ld [wNamingScreenType], a + call DisplayNamingScreen + ld a, [wcf4b] + cp "@" + jr z, .customName + call ClearScreen + call Delay3 + ld de, RedPicFront + ld b, BANK(RedPicFront) + call IntroDisplayPicCenteredOrUpperRight +.done + ld hl, YourNameIsText + jp PrintText + +YourNameIsText: + TX_FAR _YourNameIsText + db "@" + +ChooseRivalName: + call OakSpeechSlidePicRight + ld de, DefaultNamesRival + call DisplayIntroNameTextBox + ld a, [wCurrentMenuItem] + and a + jr z, .customName + ld hl, DefaultNamesRivalList + call GetDefaultName + ld de, wRivalName + call OakSpeechSlidePicLeft + jr .done +.customName + ld hl, wRivalName + ld a, NAME_RIVAL_SCREEN + ld [wNamingScreenType], a + call DisplayNamingScreen + ld a, [wcf4b] + cp "@" + jr z, .customName + call ClearScreen + call Delay3 + ld de, Rival1Pic + ld b, $13 + call IntroDisplayPicCenteredOrUpperRight +.done + ld hl, HisNameIsText + jp PrintText + +HisNameIsText: + TX_FAR _HisNameIsText + db "@" + +OakSpeechSlidePicLeft: + push de + coord hl, 0, 0 + lb bc, 12, 11 + call ClearScreenArea ; clear the name list text box + ld c, 10 + call DelayFrames + pop de + ld hl, wcd6d + ld bc, NAME_LENGTH + call CopyData + call Delay3 + coord hl, 12, 4 + lb de, 6, 6 * SCREEN_WIDTH + 5 + ld a, $ff + jr OakSpeechSlidePicCommon + +OakSpeechSlidePicRight: + coord hl, 5, 4 + lb de, 6, 6 * SCREEN_WIDTH + 5 + xor a + +OakSpeechSlidePicCommon: + push hl + push de + push bc + ld [hSlideDirection], a + ld a, d + ld [hSlideAmount], a + ld a, e + ld [hSlidingRegionSize], a + ld c, a + ld a, [hSlideDirection] + and a + jr nz, .next +; If sliding right, point hl to the end of the pic's tiles. + ld d, 0 + add hl, de +.next + ld d, h + ld e, l +.loop + xor a + ld [H_AUTOBGTRANSFERENABLED], a + ld a, [hSlideDirection] + and a + jr nz, .slideLeft +; sliding right + ld a, [hli] + ld [hld], a + dec hl + jr .next2 +.slideLeft + ld a, [hld] + ld [hli], a + inc hl +.next2 + dec c + jr nz, .loop + ld a, [hSlideDirection] + and a + jr z, .next3 +; If sliding left, we need to zero the last tile in the pic (there is no need +; to take a corresponding action when sliding right because hl initially points +; to a 0 tile in that case). + xor a + dec hl + ld [hl], a +.next3 + ld a, 1 + ld [H_AUTOBGTRANSFERENABLED], a + call Delay3 + ld a, [hSlidingRegionSize] + ld c, a + ld h, d + ld l, e + ld a, [hSlideDirection] + and a + jr nz, .slideLeft2 + inc hl + jr .next4 +.slideLeft2 + dec hl +.next4 + ld d, h + ld e, l + ld a, [hSlideAmount] + dec a + ld [hSlideAmount], a + jr nz, .loop + pop bc + pop de + pop hl + ret + +DisplayIntroNameTextBox: + push de + coord hl, 0, 0 + ld b, $a + ld c, $9 + call TextBoxBorder + coord hl, 3, 0 + ld de, .namestring + call PlaceString + pop de + coord hl, 2, 2 + call PlaceString + call UpdateSprites + xor a + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a + inc a + ld [wTopMenuItemX], a + ld [wMenuWatchedKeys], a ; A_BUTTON + inc a + ld [wTopMenuItemY], a + inc a + ld [wMaxMenuItem], a + jp HandleMenuInput + +.namestring + db "NAME@" + +INCLUDE "text/player_names.asm" + +GetDefaultName: +; a = name index +; hl = name list + ld b, a + ld c, 0 +.loop + ld d, h + ld e, l +.innerLoop + ld a, [hli] + cp "@" + jr nz, .innerLoop + ld a, b + cp c + jr z, .foundName + inc c + jr .loop +.foundName + ld h, d + ld l, e + ld de, wcd6d + ld bc, $14 + jp CopyData + +INCLUDE "text/player_names_list.asm" + +TextTerminator_6b20: + db "@" |
