From b0f4c725dccb621ff42552aae0809f605818e57b Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 19 Sep 2018 16:27:07 +0200 Subject: Document some early duel functions --- src/engine/bank01.asm | 105 +++++++++++++++++++++++++++++++++----------------- src/engine/bank03.asm | 4 +- 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index dc01bb7..1729b77 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -1822,9 +1822,9 @@ Func_4b60: ; 4b60 (1:4b60) push af ld a, PLAYER_TURN ldh [hWhoseTurn], a - call Func_4cd5 + call ChooseInitialArenaAndBenchPokemon call SwapTurn - call Func_4cd5 + call ChooseInitialArenaAndBenchPokemon call SwapTurn jp c, .asm_4c77 call Func_311d @@ -1943,13 +1943,19 @@ Func_4b60: ; 4b60 (1:4b60) db $06, $08, $0d, $03 ; 0x4cd5 -Func_4cd5: ; 4cd5 (1:4cd5) +; have the turn duelist place, at the beginning of the duel, the active Pokemon +; and 0 more bench Pokemon, all of which must be basic Pokemon cards. +; also transmits the turn holder's duelvars to the other duelist in a link duel. +; called twice, once for each duelist. +ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable cp DUELIST_TYPE_PLAYER - jr z, .player_choose_arena + jr z, .choose_arena cp DUELIST_TYPE_LINK_OPP jr z, .exchange_duelvars + +; AI opponent's turn push af push hl call Func_2bc3 @@ -1959,6 +1965,7 @@ Func_4cd5: ; 4cd5 (1:4cd5) or a ret +; link opponent's turn .exchange_duelvars ldtx hl, TransmitingDataText call DrawWideTextBox_PrintText @@ -1979,7 +1986,9 @@ Func_4cd5: ; 4cd5 (1:4cd5) .error jp DuelTransmissionError -.player_choose_arena +; player's turn (either AI or link duel) +; prompt (force) the player to choose a basic Pokemon card to place in the arena +.choose_arena call EmptyScreen ld a, BOXMSG_ARENA_POKEMON call DrawDuelBoxMessage @@ -1987,16 +1996,16 @@ Func_4cd5: ; 4cd5 (1:4cd5) call DrawWideTextBox_WaitForInput ld a, $1 call DoPracticeDuelAction -.asm_4d28 +.choose_arena_loop xor a ldtx hl, PleaseChooseAnActivePokemonText - call Func_5502 - jr c, .asm_4d28 + call DisplayPlaceInitialPokemonCardsScreen + jr c, .choose_arena_loop ldh a, [hTempCardIndex_ff98] call LoadCardDataToBuffer1_FromDeckIndex ld a, $2 call DoPracticeDuelAction - jr c, .asm_4d28 + jr c, .choose_arena_loop ldh a, [hTempCardIndex_ff98] call PutHandPokemonCardInPlayArea ldh a, [hTempCardIndex_ff98] @@ -2004,6 +2013,8 @@ Func_4cd5: ; 4cd5 (1:4cd5) call DisplayCardDetailScreen jr .choose_bench +; after choosing the active Pokemon, let the player place 0 or more basic Pokemon +; cards in the bench. loop until the player decides to stop placing Pokemon cards. .choose_bench call EmptyScreen ld a, BOXMSG_BENCH_POKEMON @@ -2015,8 +2026,8 @@ Func_4cd5: ; 4cd5 (1:4cd5) .bench_loop ld a, $1 ldtx hl, ChooseYourBenchPokemonText - call Func_5502 - jr c, .asm_4d8e + call DisplayPlaceInitialPokemonCardsScreen + jr c, .bench_done ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable cp MAX_PLAY_AREA_POKEMON @@ -2035,7 +2046,7 @@ Func_4cd5: ; 4cd5 (1:4cd5) call DrawWideTextBox_WaitForInput jr .bench_loop -.asm_4d8e +.bench_done ld a, $4 call DoPracticeDuelAction jr c, .bench_loop @@ -2068,7 +2079,7 @@ ShuffleDeckAndDrawSevenCards: ; 4d97 (1:4d97) push hl push bc call LoadCardDataToBuffer1_FromDeckIndex - call .check_basic_pokemon + call IsLoadedCard1BasicPokemon.skip_mysterious_fossil_clefairy_doll pop bc pop hl or b @@ -2082,13 +2093,19 @@ ShuffleDeckAndDrawSevenCards: ; 4d97 (1:4d97) scf ret -.asm_4dd1 +; return nc if the card at wLoadedCard1 is a basic Pokemon card +; MYSTERIOUS_FOSSIL and CLEFAIRY_DOLL do count as basic Pokemon cards +IsLoadedCard1BasicPokemon: ; 4dd1 (1:4dd1) ld a, [wLoadedCard1ID] cp MYSTERIOUS_FOSSIL jr z, .basic cp CLEFAIRY_DOLL jr z, .basic -.check_basic_pokemon +; fallthrough + +; return nc if the card at wLoadedCard1 is a basic Pokemon card +; MYSTERIOUS_FOSSIL and CLEFAIRY_DOLL do NOT count unless already checked +.skip_mysterious_fossil_clefairy_doll ld a, [wLoadedCard1Type] cp TYPE_ENERGY jr nc, .energy_trainer_nonbasic @@ -2098,15 +2115,17 @@ ShuffleDeckAndDrawSevenCards: ; 4d97 (1:4d97) ; basic ld a, $01 - ret + ret ; z + .energy_trainer_nonbasic xor a scf ret -.basic + +.basic ; MYSTERIOUS_FOSSIL or CLEFAIRY_DOLL ld a, $01 or a - ret + ret ; nz ; 0x4df3 DisplayNoBasicPokemonInHandScreenAndText: ; 4df3 (1:4df3) @@ -2154,7 +2173,9 @@ NoBasicPokemonCardListParameters: db SYM_SPACE ; tile behind cursor dw $0000 ; function pointer if non-0 -Func_4e40: ; 4e40 (1:4e40) +; used only during the practice duel with Sam. +; displays the list with the player's cards in hand, and the player's name above the list. +DisplayPracticeDuelPlayerHandScreen: ; 4e40 (1:4e40) call CreateHandCardList call EmptyScreen call LoadDuelCardSymbolTiles @@ -2656,7 +2677,7 @@ PracticeDuelActionTable: ; 51f8 (1:51f8) ; 0x520e Func_520e: ; 520e (1:520e) - call Func_4e40 + call DisplayPracticeDuelPlayerHandScreen call EnableLCD ldtx hl, Text01a4 jp Func_52bc @@ -2673,7 +2694,7 @@ Func_521a: ; 521a (1:521a) ; 0x522a Func_522a: ; 522a (1:522a) - call Func_4e40 + call DisplayPracticeDuelPlayerHandScreen call EnableLCD ldtx hl, Text01a6 jp Func_52bc @@ -2690,7 +2711,7 @@ Func_5236: ; 5236 (1:5236) ; 0x5245 Func_5245: ; 5245 (1:5245) - call Func_4e40 + call DisplayPracticeDuelPlayerHandScreen call EnableLCD ld a, $ff ld [wcc00], a @@ -2801,7 +2822,13 @@ DuelMenuData: ; 54e9 (1:54e9) db $ff ; 0x5502 -Func_5502: ; 5502 (1:5502) +; display the screen that prompts the player to choose a Pokemon card to +; place in the arena or in the bench at the beginning of the duel. +; input: + ; a = 0 -> prompted to place Pokemon card in arena + ; a = 1 -> prompted to place Pokemon card in bench +; return carry if no card was placed (only allowed for bench) +DisplayPlaceInitialPokemonCardsScreen: ; 5502 (1:5502) ld [wcbfd], a push hl call CreateHandCardList @@ -2810,24 +2837,30 @@ Func_5502: ; 5502 (1:5502) call SetCardListInfoBoxText ld a, PLAY_CHECK ld [wCardListItemSelectionMenuType], a -.asm_5515 +.display_card_list call DisplayCardList - jr nc, .asm_5523 + jr nc, .card_selected + ; attempted to exit screen ld a, [wcbfd] or a - jr z, .asm_5515 + ; player is forced to place a Pokemon card in the arena + jr z, .display_card_list + ; in the bench, however, we can get away without placing anything + ; alternatively, the player doesn't want or can't place more bench Pokemon scf - jr .asm_5538 -.asm_5523 + jr .done +.card_selected ldh a, [hTempCardIndex_ff98] call LoadCardDataToBuffer1_FromDeckIndex - call Func_4dd1 - jr nc, .asm_5538 + call IsLoadedCard1BasicPokemon + jr nc, .done + ; invalid card selected, tell the player and go back ldtx hl, YouCannotSelectThisCardText call DrawWideTextBox_WaitForInput call DrawCardListScreenLayout - jr .asm_5515 -.asm_5538 + jr .display_card_list +.done + ; valid basic Pokemon card selected, or no card selected (bench only) push af ld a, [wSortCardListByID] or a @@ -2903,6 +2936,8 @@ Func_5591: ; 5591 (1:5591) ; Discard Pile card list, including a bottom-right image of the current card. ; since this loads the text for the Hand card list screen, SetDiscardPileScreenTexts ; is called after this if the screen corresponds to a Discard Pile list. +; the dimensions of text box where the card list is printed are 20x13, in order to accomodate +; another text box below it (wCardListInfoBoxText) as well as the image of the selected card. InitAndDrawCardListScreenLayout: ; 559a (1:559a) xor a ld hl, wSelectedDuelSubMenuItem @@ -2953,14 +2988,14 @@ DrawCardListScreenLayout: ; 0x55f0 ; displays a list of cards and handles input in order to navigate through the list, -; select a card, open a card page... +; select a card, open a card page, etc. ; input: ; - text IDs at wCardListInfoBoxText and wCardListHeaderText ; - $ff-terminated list of cards to display at wDuelTempList ; - wSelectedDuelSubMenuItem (initial item) and wSelectedDuelSubMenuScrollOffset ; (initial page scroll offset). Usually both 0 to begin with the first card. -; returns carry if B is pressed to exit the card list screen, or the selected -; card at hTempCardIndex_ff98 and at a. +; returns carry if B is pressed to exit the card list screen. +; otherwise returns the selected card at hTempCardIndex_ff98 and at a. DisplayCardList: ; 55f0 (1:55f0) call DrawNarrowTextBox call PrintCardListHeaderAndInfoBoxTexts diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 1c346d5..5539d38 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1850,7 +1850,7 @@ OWScript_PrintTextCloseBox: ; cdb9 (3:4db9) Func_cdcb: ; cdcb (3:4dcb) ld a, [wd3b6] ld [wd3aa], a -Func_4dd1: ; cdd1 (3:4dd1) +Func_cdd1: ; cdd1 (3:4dd1) farcall Func_1c50a jp IncreaseOWScriptPointerBy1 @@ -1862,7 +1862,7 @@ Func_cdd8: ; cdd8 (3:4dd8) ld a, [wd696] ld [wd3ab], a call Func_39c3 - call Func_4dd1 + call Func_cdd1 pop af ld [wd3ab], a pop af -- cgit v1.2.3 From 602a9a97bce5ab51abcac33e5e464923f0d47279 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 20 Sep 2018 16:58:10 +0200 Subject: Dump practice duel text table --- src/engine/bank01.asm | 134 ++++++++++++++++++++++++++++++++++------------ src/text/text2.asm | 10 ++-- src/text/text_offsets.asm | 10 ++-- 3 files changed, 111 insertions(+), 43 deletions(-) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 1729b77..ba62547 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -2664,62 +2664,62 @@ DoPracticeDuelAction: ; 51e7 (1:51e7) PracticeDuelActionTable: ; 51f8 (1:51f8) dw $0000 - dw Func_520e - dw Func_521a - dw Func_522a - dw Func_5236 - dw Func_5245 - dw Func_5256 - dw Func_5278 - dw Func_5284 - dw Func_529b - dw Func_52b0 + dw PracticeDuel_520e + dw PracticeDuel_521a + dw PracticeDuel_522a + dw PracticeDuel_5236 + dw PracticeDuel_5245 + dw PracticeDuel_5256 + dw PracticeDuel_5278 + dw PracticeDuel_5284 + dw PracticeDuel_529b + dw PracticeDuel_52b0 ; 0x520e -Func_520e: ; 520e (1:520e) +PracticeDuel_520e: ; 520e (1:520e) call DisplayPracticeDuelPlayerHandScreen call EnableLCD - ldtx hl, Text01a4 - jp Func_52bc + ldtx hl, DrawSevenCardsPracticeDuelText + jp PrintDrMasonInstructions ; 0x521a -Func_521a: ; 521a (1:521a) +PracticeDuel_521a: ; 521a (1:521a) ld a, [wLoadedCard1ID] cp GOLDEEN ret z - ldtx hl, Text01a5 + ldtx hl, ChooseGoldeenPracticeDuelText ldtx de, DrMasonText scf - jp Func_52bc + jp PrintDrMasonInstructions ; 0x522a -Func_522a: ; 522a (1:522a) +PracticeDuel_522a: ; 522a (1:522a) call DisplayPracticeDuelPlayerHandScreen call EnableLCD - ldtx hl, Text01a6 - jp Func_52bc + ldtx hl, PutPokemonOnBenchPracticeDuelText + jp PrintDrMasonInstructions ; 0x5236 -Func_5236: ; 5236 (1:5236) +PracticeDuel_5236: ; 5236 (1:5236) ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable cp 2 ret z - ldtx hl, Text01a7 + ldtx hl, ChooseStaryuPracticeDuelText scf - jp Func_52bc + jp PrintDrMasonInstructions ; 0x5245 -Func_5245: ; 5245 (1:5245) +PracticeDuel_5245: ; 5245 (1:5245) call DisplayPracticeDuelPlayerHandScreen call EnableLCD ld a, $ff ld [wcc00], a - ldtx hl, Text01a8 - jp Func_52bc + ldtx hl, PressBToFinishPracticeDuelText + jp PrintDrMasonInstructions ; 0x5256 -Func_5256: ; 5256 (1:5256) +PracticeDuel_5256: ; 5256 (1:5256) call $5351 call EnableLCD ld a, [wDuelTurns] @@ -2735,7 +2735,7 @@ Func_5256: ; 5256 (1:5256) jp $5382 ; 0x5278 -Func_5278: ; 5278 (1:5278) +PracticeDuel_5278: ; 5278 (1:5278) ld a, [wDuelTurns] srl a ld hl, $541f @@ -2743,9 +2743,9 @@ Func_5278: ; 5278 (1:5278) ret nc ; fallthrough -Func_5284: ; 5284 (1:5284) +PracticeDuel_5284: ; 5284 (1:5284) ldtx hl, Text01da - call Func_52bc + call PrintDrMasonInstructions ld a, $02 call BankswitchSRAM ld de, sCurrentDuel @@ -2756,7 +2756,7 @@ Func_5284: ; 5284 (1:5284) ret ; 0x529b -Func_529b: ; 529b (1:529b) +PracticeDuel_529b: ; 529b (1:529b) ld a, [wDuelTurns] cp 7 jr z, .asm_52a4 @@ -2769,7 +2769,7 @@ Func_529b: ; 529b (1:529b) jp $5396 ; 0x52b0 -Func_52b0: ; 52b0 (1:52b0) +PracticeDuel_52b0: ; 52b0 (1:52b0) ldh a, [hTempPlayAreaLocation_ff9d] cp PLAY_AREA_BENCH_1 ret z @@ -2778,7 +2778,8 @@ Func_52b0: ; 52b0 (1:52b0) scf ; fallthrough -Func_52bc: ; 52bc (1:52bc) +; print a text box with given the text id at hl, labeled as 'Dr. Mason' +PrintDrMasonInstructions: ; 52bc (1:52bc) push af ldtx de, DrMasonText call PrintScrollableText_WithTextBoxLabel @@ -2786,7 +2787,74 @@ Func_52bc: ; 52bc (1:52bc) ret ; 0x52c5 - INCROM $52c5, $54c8 +PracticeDuelTextPointerTable: ; 52c5 (1:52c5) + dw PracticeDuelText_52d5 + dw PracticeDuelText_52e5 + dw PracticeDuelText_52f5 + dw PracticeDuelText_5305 + dw PracticeDuelText_5315 + dw PracticeDuelText_5320 + dw PracticeDuelText_5330 + dw PracticeDuelText_533b +; 0x52d5 + +practicetext: MACRO + db \1 ; Y coord to place text + tx \2 ; help text + tx \3 ; instruction text +ENDM + +PracticeDuelText_52d5: + practicetext 2, Text01c0, Text01a9 + practicetext 5, Text01c1, Text01aa + practicetext 8, Text01c2, Text01ab + db $00 + +PracticeDuelText_52e5: + practicetext 2, Text01c3, Text01ac + practicetext 5, Text01c4, Text01ad + practicetext 8, Text01c5, Text01ae + db $00 + +PracticeDuelText_52f5: + practicetext 2, Text01c6, Text01af + practicetext 5, Text01c7, Text01b0 + practicetext 8, Text01c8, Text01b1 + db $00 + +PracticeDuelText_5305: + practicetext 2, Text01c9, Text01b2 + practicetext 5, Text01ca, Text01b3 + practicetext 8, Text01cb, Text01b4 + db $00 + +PracticeDuelText_5315: + practicetext 2, Text01cc, Text01b5 + practicetext 6, Text01cd, Text01b6 + db $00 + +PracticeDuelText_5320: + practicetext 2, Text01ce, Text01b7 + practicetext 5, Text01cf, Text01b8 + practicetext 8, Text01d0, Text01b9 + db $00 + +PracticeDuelText_5330: + practicetext 2, Text01d1, Text01ba + practicetext 5, Text01d2, Text01bb + db $00 + +PracticeDuelText_533b: + practicetext 2, Text01d3, Text01bc + practicetext 5, Text01d4, Text01bd + db $00 + +PracticeDuelText_5346: + practicetext 2, Text01d5, Text01be + practicetext 7, Text01d6, Text01bf + db $00 + + INCROM $5351, $54c8 ; display BOXMSG_PLAYERS_TURN or BOXMSG_OPPONENTS_TURN and print ; DuelistsTurnText in a textbox. also call ExchangeRNG. diff --git a/src/text/text2.asm b/src/text/text2.asm index 934a2ec..24d28c9 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -906,7 +906,7 @@ DrMasonText: ; 3a122 (e:6122) text "Dr. Mason" done -Text01a4: ; 3a12d (e:612d) +DrawSevenCardsPracticeDuelText: ; 3a12d (e:612d) text "Draw 7 cards," line "" line "and get ready for the battle!" @@ -919,12 +919,12 @@ Text01a4: ; 3a12d (e:612d) line "choose Goldeen." done -Text01a5: ; 3a204 (e:6204) +ChooseGoldeenPracticeDuelText: ; 3a204 (e:6204) text "Choose Goldeen for this" line "practice duel, OK?" done -Text01a6: ; 3a230 (e:6230) +PutPokemonOnBenchPracticeDuelText: ; 3a230 (e:6230) text "Next, put your Pokémon on your" line "Bench." line "You can switch Benched Pokémon" @@ -935,12 +935,12 @@ Text01a6: ; 3a230 (e:6230) line "put it there." done -Text01a7: ; 3a2f6 (e:62f6) +ChooseStaryuPracticeDuelText: ; 3a2f6 (e:62f6) text "Choose Staryu for this" line "practice duel, OK?" done -Text01a8: ; 3a321 (e:6321) +PressBToFinishPracticeDuelText: ; 3a321 (e:6321) text "When you have no Pokémon to put on" line "your Bench, press the B Button to" line "finish." diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index d09504f..dd55e82 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -421,11 +421,11 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text01a1 ; 0x01a1 textpointer Text01a2 ; 0x01a2 textpointer DrMasonText ; 0x01a3 - textpointer Text01a4 ; 0x01a4 - textpointer Text01a5 ; 0x01a5 - textpointer Text01a6 ; 0x01a6 - textpointer Text01a7 ; 0x01a7 - textpointer Text01a8 ; 0x01a8 + textpointer DrawSevenCardsPracticeDuelText ; 0x01a4 + textpointer ChooseGoldeenPracticeDuelText ; 0x01a5 + textpointer PutPokemonOnBenchPracticeDuelText ; 0x01a6 + textpointer ChooseStaryuPracticeDuelText ; 0x01a7 + textpointer PressBToFinishPracticeDuelText ; 0x01a8 textpointer Text01a9 ; 0x01a9 textpointer Text01aa ; 0x01aa textpointer Text01ab ; 0x01ab -- cgit v1.2.3 From 44cc025c1e122646d478edc6d73d79dbbeb59da9 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 20 Sep 2018 18:33:56 +0200 Subject: Disassemble practice duel code --- src/engine/bank01.asm | 173 +++++++++++++++++++++++++++++++++++++++++++--- src/text/text2.asm | 10 +-- src/text/text_offsets.asm | 10 +-- src/wram.asm | 3 + 4 files changed, 175 insertions(+), 21 deletions(-) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index ba62547..1237c3d 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -2720,36 +2720,36 @@ PracticeDuel_5245: ; 5245 (1:5245) ; 0x5256 PracticeDuel_5256: ; 5256 (1:5256) - call $5351 + call Func_5351 call EnableLCD ld a, [wDuelTurns] ld hl, wcc00 cp [hl] ld [hl], a ld a, $00 - jp nz, $5382 + jp nz, Func_5382 ldtx de, DrMasonText - ldtx hl, Text01d9 + ldtx hl, NeedPracticeAgainPracticeDuelText call PrintScrollableText_WithTextBoxLabel_NoWait call YesOrNoMenu - jp $5382 + jp Func_5382 ; 0x5278 PracticeDuel_5278: ; 5278 (1:5278) ld a, [wDuelTurns] srl a - ld hl, $541f + ld hl, PointerTable_541f call JumpToFunctionInTable ret nc ; fallthrough PracticeDuel_5284: ; 5284 (1:5284) - ldtx hl, Text01da + ldtx hl, ThisIsPracticeModePracticeDuelText call PrintDrMasonInstructions ld a, $02 call BankswitchSRAM ld de, sCurrentDuel - call $66ff + call LoadSavedDuelData xor a call BankswitchSRAM scf @@ -2763,10 +2763,10 @@ PracticeDuel_529b: ; 529b (1:529b) or a ret .asm_52a4 - call $5351 + call Func_5351 call EnableLCD - ld hl, $5346 - jp $5396 + ld hl, PracticeDuelText_5346 + jp Func_5396 ; 0x52b0 PracticeDuel_52b0: ; 52b0 (1:52b0) @@ -2854,7 +2854,158 @@ PracticeDuelText_5346: practicetext 7, Text01d6, Text01bf db $00 - INCROM $5351, $54c8 +Func_5351: ; 5351 (1:5351) + call EmptyScreen + lb de, 0, 0 + lb bc, 20, 12 + call DrawRegularTextBox +; fallthrough + +Func_535d: ; 535d (1:535d) + ld a, [wDuelTurns] + cp 7 + jr z, .replace_due_to_knockout + ; load the player's turn number to TX_RAM3 in order to print it + srl a + inc a + ld l, a + ld h, $00 + call LoadTxRam3 + lb de, 1, 0 + call InitTextPrinting + ldtx hl, PlayersTurnPracticeDuelText + jp PrintText +.replace_due_to_knockout + lb de, 1, 0 + ldtx hl, ReplaceDueToKnockoutPracticeDuelText + jp InitTextPrinting_ProcessTextFromID +; 0x5382 + +Func_5382: ; 5382 (1:5382) + push af + ld a, [wDuelTurns] + and %11111110 + ld e, a + ld d, $00 + ld hl, PracticeDuelTextPointerTable + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + pop af + or a + jr nz, Func_53da +; fallthrough + +Func_5396: ; 5396 (1:5396) + xor a + ld [wcbca], a + ld a, l + ld [wcc01], a + ld a, h + ld [wcc01 + 1], a +.asm_53a2 + call Func_53fa + ld a, [hli] + ld [wcbca], a + or a + jr z, Func_53d3 + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push hl + ld l, e + ld h, d + ldtx de, DrMasonText + call PrintScrollableText_WithTextBoxLabel + pop hl + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push hl + call SetNoLineSeparation + ld l, e + ld h, d + ld a, [wcbca] + ld e, a + ld d, 1 + call InitTextPrinting_ProcessTextFromID + call SetOneLineSeparation + pop hl + jr .asm_53a2 + +Func_53d3: ; 53d3 (1:53d3) + ldtx hl, LetsPlayTheGamePracticeDuelText + call PrintDrMasonInstructions + ret + +Func_53da: ; 53da (1:53da) + ld a, [hli] + or a + jr z, Func_53d3 + ld e, a + ld d, 1 + call Func_53e6 + jr Func_53da +; 0x53e6 + +Func_53e6: ; 53e6 (1:53e6) + inc hl + inc hl + ld c, [hl] + inc hl + ld b, [hl] + inc hl + push hl + ld l, c + ld h, b + call SetNoLineSeparation + call InitTextPrinting_ProcessTextFromID + call SetOneLineSeparation + pop hl + ret +; 0x53fa + +Func_53fa: ; 53fa (1:53fa) + ld a, $01 + ldh [hffb0], a + push hl + call Func_535d + ld hl, wcc01 + ld a, [hli] + ld h, [hl] + ld l, a +.asm_5408 + ld a, [wcbca] + cp [hl] + jr c, .asm_541a + ld a, [hli] + or a + jr z, .asm_541a + ld e, a + ld d, $01 + call Func_53e6 + jr .asm_5408 +.asm_541a + pop hl + xor a + ldh [hffb0], a + ret +; 0x541f + +PointerTable_541f: ; 541f (1:541f) + dw $542f + dw $5438 + dw $5454 + dw $5467 + dw $5488 + dw $549c + dw $54b7 + dw $54b7 + + INCROM $542f, $54c8 ; display BOXMSG_PLAYERS_TURN or BOXMSG_OPPONENTS_TURN and print ; DuelistsTurnText in a textbox. also call ExchangeRNG. diff --git a/src/text/text2.asm b/src/text/text2.asm index 24d28c9..a93f9c8 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -1245,25 +1245,25 @@ Text01d7: ; 3b35a (e:735a) line "OK?" done -Text01d8: ; 3b380 (e:7380) +LetsPlayTheGamePracticeDuelText: ; 3b380 (e:7380) text "Now, let's play the game!" done -Text01d9: ; 3b39b (e:739b) +NeedPracticeAgainPracticeDuelText: ; 3b39b (e:739b) text "Do you need to practice again?" done -Text01da: ; 3b3bb (e:73bb) +ThisIsPracticeModePracticeDuelText: ; 3b3bb (e:73bb) text "This is Practice Mode, so" line "please follow my guidance." line "Do it again." done -Text01db: ; 3b3fe (e:73fe) +PlayersTurnPracticeDuelText: ; 3b3fe (e:73fe) text "'s turn " done -Text01dc: ; 3b40a (e:740a) +ReplaceDueToKnockoutPracticeDuelText: ; 3b40a (e:740a) text " Replace due to Knockout " done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index dd55e82..0a18aa5 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -473,11 +473,11 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text01d5 ; 0x01d5 textpointer Text01d6 ; 0x01d6 textpointer Text01d7 ; 0x01d7 - textpointer Text01d8 ; 0x01d8 - textpointer Text01d9 ; 0x01d9 - textpointer Text01da ; 0x01da - textpointer Text01db ; 0x01db - textpointer Text01dc ; 0x01dc + textpointer LetsPlayTheGamePracticeDuelText ; 0x01d8 + textpointer NeedPracticeAgainPracticeDuelText ; 0x01d9 + textpointer ThisIsPracticeModePracticeDuelText ; 0x01da + textpointer PlayersTurnPracticeDuelText ; 0x01db + textpointer ReplaceDueToKnockoutPracticeDuelText ; 0x01dc textpointer Text01dd ; 0x01dd textpointer PracticePlayerDeckName ; 0x01de textpointer SamsPracticeDeckName ; 0x01df diff --git a/src/wram.asm b/src/wram.asm index ca314b7..daee579 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -651,6 +651,8 @@ wCurPlayAreaY:: ; cbca ; Y position to display the attached energies, HP bar, and Pluspower/Defender icons ; obviously different for player and opponent side. used by DrawDuelHUD. wHUDEnergyAndHPBarsY:: ; cbca + +wcbca:: ; cbca ds $1 ; selected bench slot (1-5, that is, a PLAY_AREA_BENCH_* constant) @@ -797,6 +799,7 @@ wcbff:: ; cbff wcc00:: ; cc00 ds $1 +wcc01:: ; cc01 ds $2 ; used to print a Pokemon card's length in feet and inches -- cgit v1.2.3 From 2bf36c743705e426b68d1a053ebcc99c15e2aa33 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 20 Sep 2018 20:31:02 +0200 Subject: Finish disassembling and begin documenting practice duel code --- src/engine/bank01.asm | 220 +++++++++++++++++++++++++++++++++++++------------- src/wram.asm | 2 +- 2 files changed, 166 insertions(+), 56 deletions(-) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 1237c3d..767e6a0 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -2664,75 +2664,78 @@ DoPracticeDuelAction: ; 51e7 (1:51e7) PracticeDuelActionTable: ; 51f8 (1:51f8) dw $0000 - dw PracticeDuel_520e - dw PracticeDuel_521a - dw PracticeDuel_522a - dw PracticeDuel_5236 - dw PracticeDuel_5245 - dw PracticeDuel_5256 + dw PracticeDuel_DrawSevenCards + dw PracticeDuel_PlayGoldeen + dw PracticeDuel_PutStaryuInBench + dw PracticeDuel_VerifyInitialPlay + dw PracticeDuel_DonePuttingOnBench + dw PracticeDuel_PrintTurnInstructions dw PracticeDuel_5278 dw PracticeDuel_5284 dw PracticeDuel_529b dw PracticeDuel_52b0 ; 0x520e -PracticeDuel_520e: ; 520e (1:520e) +PracticeDuel_DrawSevenCards: ; 520e (1:520e) call DisplayPracticeDuelPlayerHandScreen call EnableLCD ldtx hl, DrawSevenCardsPracticeDuelText - jp PrintDrMasonInstructions + jp PrintPracticeDuelDrMasonInstructions ; 0x521a -PracticeDuel_521a: ; 521a (1:521a) +PracticeDuel_PlayGoldeen: ; 521a (1:521a) ld a, [wLoadedCard1ID] cp GOLDEEN ret z ldtx hl, ChooseGoldeenPracticeDuelText ldtx de, DrMasonText scf - jp PrintDrMasonInstructions + jp PrintPracticeDuelDrMasonInstructions ; 0x522a -PracticeDuel_522a: ; 522a (1:522a) +PracticeDuel_PutStaryuInBench: ; 522a (1:522a) call DisplayPracticeDuelPlayerHandScreen call EnableLCD ldtx hl, PutPokemonOnBenchPracticeDuelText - jp PrintDrMasonInstructions + jp PrintPracticeDuelDrMasonInstructions ; 0x5236 -PracticeDuel_5236: ; 5236 (1:5236) +PracticeDuel_VerifyInitialPlay: ; 5236 (1:5236) ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable cp 2 ret z ldtx hl, ChooseStaryuPracticeDuelText scf - jp PrintDrMasonInstructions + jp PrintPracticeDuelDrMasonInstructions ; 0x5245 -PracticeDuel_5245: ; 5245 (1:5245) +PracticeDuel_DonePuttingOnBench: ; 5245 (1:5245) call DisplayPracticeDuelPlayerHandScreen call EnableLCD ld a, $ff - ld [wcc00], a + ld [wPracticeDuelTurn], a ldtx hl, PressBToFinishPracticeDuelText - jp PrintDrMasonInstructions + jp PrintPracticeDuelDrMasonInstructions ; 0x5256 -PracticeDuel_5256: ; 5256 (1:5256) - call Func_5351 +PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256) + call DrawPracticeDuelInstructionsTextBox call EnableLCD ld a, [wDuelTurns] - ld hl, wcc00 + ld hl, wPracticeDuelTurn cp [hl] ld [hl], a - ld a, $00 - jp nz, Func_5382 + ; calling PrintPracticeDuelInstructionsForCurrentTurn with a = 0 means that Dr. Mason's + ; instructions are also printed along with each of the point-by-point instructions + ld a, 0 + jp nz, PrintPracticeDuelInstructionsForCurrentTurn + ; practice duel over ldtx de, DrMasonText ldtx hl, NeedPracticeAgainPracticeDuelText call PrintScrollableText_WithTextBoxLabel_NoWait call YesOrNoMenu - jp Func_5382 + jp PrintPracticeDuelInstructionsForCurrentTurn ; 0x5278 PracticeDuel_5278: ; 5278 (1:5278) @@ -2745,7 +2748,7 @@ PracticeDuel_5278: ; 5278 (1:5278) PracticeDuel_5284: ; 5284 (1:5284) ldtx hl, ThisIsPracticeModePracticeDuelText - call PrintDrMasonInstructions + call PrintPracticeDuelDrMasonInstructions ld a, $02 call BankswitchSRAM ld de, sCurrentDuel @@ -2763,10 +2766,10 @@ PracticeDuel_529b: ; 529b (1:529b) or a ret .asm_52a4 - call Func_5351 + call DrawPracticeDuelInstructionsTextBox call EnableLCD ld hl, PracticeDuelText_5346 - jp Func_5396 + jp PrintPracticeDuelInstructions ; 0x52b0 PracticeDuel_52b0: ; 52b0 (1:52b0) @@ -2779,7 +2782,7 @@ PracticeDuel_52b0: ; 52b0 (1:52b0) ; fallthrough ; print a text box with given the text id at hl, labeled as 'Dr. Mason' -PrintDrMasonInstructions: ; 52bc (1:52bc) +PrintPracticeDuelDrMasonInstructions: ; 52bc (1:52bc) push af ldtx de, DrMasonText call PrintScrollableText_WithTextBoxLabel @@ -2799,9 +2802,9 @@ PracticeDuelTextPointerTable: ; 52c5 (1:52c5) ; 0x52d5 practicetext: MACRO - db \1 ; Y coord to place text - tx \2 ; help text - tx \3 ; instruction text + db \1 ; Y coord to place the point-by-point instruction + tx \2 ; Dr. Mason's instruction + tx \3 ; Static point-by-point instruction ENDM PracticeDuelText_52d5: @@ -2854,14 +2857,17 @@ PracticeDuelText_5346: practicetext 7, Text01d6, Text01bf db $00 -Func_5351: ; 5351 (1:5351) +; in a practice duel, draws the text box where the point-by-point +; instructions for the next player action will be written into +DrawPracticeDuelInstructionsTextBox: ; 5351 (1:5351) call EmptyScreen lb de, 0, 0 lb bc, 20, 12 call DrawRegularTextBox ; fallthrough -Func_535d: ; 535d (1:535d) +; print "'s Turn [wDuelTurns]" (usually) as the textbox label +PrintPracticeDuelInstructionsTextBoxLabel: ; 535d (1:535d) ld a, [wDuelTurns] cp 7 jr z, .replace_due_to_knockout @@ -2881,7 +2887,11 @@ Func_535d: ; 535d (1:535d) jp InitTextPrinting_ProcessTextFromID ; 0x5382 -Func_5382: ; 5382 (1:5382) +; print the instructions of the current practice duel turn, taken from +; one of the structs in PracticeDuelTextPointerTable. +; if a != 0, only the point-by-point instructions are printed, otherwise +; Dr. Mason instructions are also shown in a textbox at the bottom of the screen. +PrintPracticeDuelInstructionsForCurrentTurn: ; 5382 (1:5382) push af ld a, [wDuelTurns] and %11111110 @@ -2894,10 +2904,13 @@ Func_5382: ; 5382 (1:5382) ld l, a pop af or a - jr nz, Func_53da + jr nz, PrintPracticeDuelInstructions_Debug ; fallthrough -Func_5396: ; 5396 (1:5396) +; print practice duel instructions given hl = PracticeDuelText_* +; each practicetext entry (see above) contains a Dr. Mason text along with +; a numbered instruction text, that is later printed without text delay. +PrintPracticeDuelInstructions: ; 5396 (1:5396) xor a ld [wcbca], a ld a, l @@ -2909,7 +2922,7 @@ Func_5396: ; 5396 (1:5396) ld a, [hli] ld [wcbca], a or a - jr z, Func_53d3 + jr z, PrintPracticeDuelLetsPlayTheGame ld e, [hl] inc hl ld d, [hl] @@ -2936,22 +2949,28 @@ Func_5396: ; 5396 (1:5396) pop hl jr .asm_53a2 -Func_53d3: ; 53d3 (1:53d3) +; print the generic Dr. Mason's text that completes all his practice duel instructions +PrintPracticeDuelLetsPlayTheGame: ; 53d3 (1:53d3) ldtx hl, LetsPlayTheGamePracticeDuelText - call PrintDrMasonInstructions + call PrintPracticeDuelDrMasonInstructions ret -Func_53da: ; 53da (1:53da) +; simplified version of PrintPracticeDuelInstructions that skips Dr. Mason's text +; and instead places the point-by-point instructions all at once. +; doesn't appear to be ever used, so it was probably used for testing during development. +PrintPracticeDuelInstructions_Debug: ; 53da (1:53da) ld a, [hli] or a - jr z, Func_53d3 + jr z, PrintPracticeDuelLetsPlayTheGame ld e, a ld d, 1 - call Func_53e6 - jr Func_53da + call PrintPracticeDuelNumberedInstruction + jr PrintPracticeDuelInstructions_Debug ; 0x53e6 -Func_53e6: ; 53e6 (1:53e6) +; print a practice duel point-by-point instruction at d,e, with text id at hl, +; that has been read from an entry of PracticeDuelText_* +PrintPracticeDuelNumberedInstruction: ; 53e6 (1:53e6) inc hl inc hl ld c, [hl] @@ -2972,7 +2991,7 @@ Func_53fa: ; 53fa (1:53fa) ld a, $01 ldh [hffb0], a push hl - call Func_535d + call PrintPracticeDuelInstructionsTextBoxLabel ld hl, wcc01 ld a, [hli] ld h, [hl] @@ -2986,7 +3005,7 @@ Func_53fa: ; 53fa (1:53fa) jr z, .asm_541a ld e, a ld d, $01 - call Func_53e6 + call PrintPracticeDuelNumberedInstruction jr .asm_5408 .asm_541a pop hl @@ -2996,16 +3015,107 @@ Func_53fa: ; 53fa (1:53fa) ; 0x541f PointerTable_541f: ; 541f (1:541f) - dw $542f - dw $5438 - dw $5454 - dw $5467 - dw $5488 - dw $549c - dw $54b7 - dw $54b7 - - INCROM $542f, $54c8 + dw Func_542f + dw Func_5438 + dw Func_5454 + dw Func_5467 + dw Func_5488 + dw Func_549c + dw Func_54b7 + dw Func_54b7 + +Func_542f: ; 542f (1:542f) + ld a, [wTempCardID_ccc2] + cp GOLDEEN + jp nz, Func_54c6 + ret +; 0x5438 + +Func_5438: ; 5438 (1:5438) + ld a, [wTempCardID_ccc2] + cp SEAKING + jp nz, Func_54c6 + ld a, [wSelectedMoveIndex] + cp 1 + jp nz, Func_54c6 + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + PSYCHIC] + or a + jr z, Func_54c6 + ret +; 0x5454 + +Func_5454: ; 5454 (1:5454) + ld a, [wTempCardID_ccc2] + cp SEAKING + jr nz, Func_54c6 + ld e, PLAY_AREA_BENCH_1 + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + WATER] + or a + jr z, Func_54c6 + ret +; 0x5467 + +Func_5467: ; 5467 (1:5467) + ld a, [wPlayerNumberOfPokemonInPlayArea] + cp 3 + jr nz, Func_54c6 + ld e, PLAY_AREA_BENCH_2 + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + WATER] + or a + jr z, Func_54c6 + ld a, [wTempCardID_ccc2] + cp SEAKING + jr nz, Func_54c6 + ld a, [wSelectedMoveIndex] + cp 1 + jr nz, Func_54c6 + ret +; 0x5488 + +Func_5488: ; 5488 (1:5488) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + WATER] + cp 2 + jr nz, Func_54c6 + ld a, [wTempCardID_ccc2] + cp STARYU + jr nz, Func_54c6 + ret +; 0x549c + +Func_549c: ; 549c (1:549c) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + WATER] + cp 3 + jr nz, Func_54c6 + ld a, [wPlayerArenaCardHP] + cp 40 + jr nz, Func_54c6 + ld a, [wTempCardID_ccc2] + cp STARYU + jr nz, Func_54c6 + ret +; 0x54b7 + +Func_54b7: ; 54b7 (1:54b7) + ld a, [wTempCardID_ccc2] + cp STARMIE + jr nz, Func_54c6 + ld a, [wSelectedMoveIndex] + cp 1 + jr nz, Func_54c6 + ret + +Func_54c6: + scf + ret +; 0x54c8 ; display BOXMSG_PLAYERS_TURN or BOXMSG_OPPONENTS_TURN and print ; DuelistsTurnText in a textbox. also call ExchangeRNG. diff --git a/src/wram.asm b/src/wram.asm index daee579..5d22c69 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -796,7 +796,7 @@ wPracticeDuelAction:: ; cbfe wcbff:: ; cbff ds $1 -wcc00:: ; cc00 +wPracticeDuelTurn:: ; cc00 ds $1 wcc01:: ; cc01 -- cgit v1.2.3 From 89e3b966a0dd1ff78757c0b4056cb0b1b1c8c898 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 21 Sep 2018 19:32:34 +0200 Subject: Document most practice duel code --- src/constants/duel_constants.asm | 13 +++ src/engine/bank01.asm | 227 +++++++++++++++++++++------------------ src/text/text2.asm | 96 ++++++++--------- src/text/text_offsets.asm | 96 ++++++++--------- 4 files changed, 230 insertions(+), 202 deletions(-) diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index ee6b940..d9b9e9c 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -188,3 +188,16 @@ CHECK_PLAY_AREA EQU $0a ;NONE EQU $00 PLAY_CHECK EQU $01 SELECT_CHECK EQU $02 + +; constants for PracticeDuelActionTable entries + const_def 1 + const PRACTICEDUEL_DRAW_SEVEN_CARDS + const PRACTICEDUEL_PLAY_GOLDEEN + const PRACTICEDUEL_PUT_STARYU_IN_BENCH + const PRACTICEDUEL_VERIFY_INITIAL_PLAY + const PRACTICEDUEL_DONE_PUTTING_ON_BENCH + const PRACTICEDUEL_PRINT_TURN_INSTRUCTIONS + const PRACTICEDUEL_VERIFY_PLAYER_TURN_ACTIONS + const PRACTICEDUEL_REPEAT_INSTRUCTIONS + const PRACTICEDUEL_PLAY_STARYU_FROM_BENCH + const PRACTICEDUEL_REPLACE_KNOCKED_OUT_POKEMON diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 767e6a0..c612498 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -164,7 +164,7 @@ MainDuelLoop ; 40ee (1:40ee) or a jr z, .next_turn ld a, [hl] - cp 15 ; the practice duel lasts 15 turns + cp 15 ; the practice duel lasts 15 turns (8 player turns and 7 opponent turns) jr c, .next_turn xor a ; DUEL_WIN ld [wDuelResult], a @@ -330,7 +330,9 @@ HandleTurn: ; 4225 (1:4225) call SaveDuelStateToSRAM ; fallthrough -Func_4268: +; when a practice duel turn needs to be restarted because the player did not +; follow the instructions correctly, the game jumps here +RestartPracticeDuelTurn: ; 4268 (1:4268) ld a, $06 call DoPracticeDuelAction ; fallthrough @@ -521,9 +523,10 @@ DuelMenu_PkmnPower: ; 438e (1:438e) ; triggered by selecting the "Done" item in the duel menu DuelMenu_Done: ; 439a (1:439a) - ld a, $08 + ld a, PRACTICEDUEL_REPEAT_INSTRUCTIONS call DoPracticeDuelAction - jp c, Func_4268 + ; always jumps on practice duel (no action requires player to select Done) + jp c, RestartPracticeDuelTurn ld a, $05 call SetAIAction_SerialSendDuelData call ClearNonTurnTemporaryDuelvars @@ -1105,9 +1108,10 @@ DuelMenu_Attack: ; 46fc (1:46fc) call CopyMoveDataAndDamage_FromDeckIndex call HandleAmnesiaSubstatus jr c, .cannot_use_due_to_amnesia - ld a, $07 + ld a, PRACTICEDUEL_VERIFY_PLAYER_TURN_ACTIONS call DoPracticeDuelAction - jp c, Func_4268 + ; if player did something wrong in the practice duel, jump in order to restart turn + jp c, RestartPracticeDuelTurn call UseAttackOrPokemonPower jp c, DuelMainInterface ret @@ -1994,7 +1998,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) call DrawDuelBoxMessage ldtx hl, ChooseBasicPkmnToPlaceInArenaText call DrawWideTextBox_WaitForInput - ld a, $1 + ld a, PRACTICEDUEL_DRAW_SEVEN_CARDS call DoPracticeDuelAction .choose_arena_loop xor a @@ -2003,7 +2007,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) jr c, .choose_arena_loop ldh a, [hTempCardIndex_ff98] call LoadCardDataToBuffer1_FromDeckIndex - ld a, $2 + ld a, PRACTICEDUEL_PLAY_GOLDEEN call DoPracticeDuelAction jr c, .choose_arena_loop ldh a, [hTempCardIndex_ff98] @@ -2021,7 +2025,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) call DrawDuelBoxMessage ldtx hl, ChooseUpTo5BasicPkmnToPlaceOnBenchText call PrintScrollableText_NoTextBoxLabel - ld a, $3 + ld a, PRACTICEDUEL_PUT_STARYU_IN_BENCH call DoPracticeDuelAction .bench_loop ld a, $1 @@ -2037,7 +2041,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) ldh a, [hTempCardIndex_ff98] ldtx hl, PlacedOnTheBenchText call DisplayCardDetailScreen - ld a, $5 + ld a, PRACTICEDUEL_DONE_PUTTING_ON_BENCH call DoPracticeDuelAction jr .bench_loop @@ -2047,7 +2051,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5) jr .bench_loop .bench_done - ld a, $4 + ld a, PRACTICEDUEL_VERIFY_INITIAL_PLAY call DoPracticeDuelAction jr c, .bench_loop or a @@ -2652,6 +2656,8 @@ DuelHorizontalSeparatorCGBPalData: ; 51c0 (1:51c0) ; 0x51e7 ; if this is a practice duel, execute the practice duel action at wPracticeDuelAction +; if not a practice duel, always return nc +; the practice duel functions below return carry when something's wrong DoPracticeDuelAction: ; 51e7 (1:51e7) ld [wPracticeDuelAction], a ld a, [wIsPracticeDuel] @@ -2670,10 +2676,10 @@ PracticeDuelActionTable: ; 51f8 (1:51f8) dw PracticeDuel_VerifyInitialPlay dw PracticeDuel_DonePuttingOnBench dw PracticeDuel_PrintTurnInstructions - dw PracticeDuel_5278 - dw PracticeDuel_5284 - dw PracticeDuel_529b - dw PracticeDuel_52b0 + dw PracticeDuel_VerifyPlayerTurnActions + dw PracticeDuel_RepeatInstructions + dw PracticeDuel_PlayStaryuFromBench + dw PracticeDuel_ReplaceKnockedOutPokemon ; 0x520e PracticeDuel_DrawSevenCards: ; 520e (1:520e) @@ -2730,7 +2736,9 @@ PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256) ; instructions are also printed along with each of the point-by-point instructions ld a, 0 jp nz, PrintPracticeDuelInstructionsForCurrentTurn - ; practice duel over + ; if we're here, the player followed the current turn actions wrong and has to + ; epeat them. ask the player whether to show detailed instructions again, in + ; order to call PrintPracticeDuelInstructionsForCurrentTurn with a = 0 or a = 1. ldtx de, DrMasonText ldtx hl, NeedPracticeAgainPracticeDuelText call PrintScrollableText_WithTextBoxLabel_NoWait @@ -2738,46 +2746,51 @@ PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256) jp PrintPracticeDuelInstructionsForCurrentTurn ; 0x5278 -PracticeDuel_5278: ; 5278 (1:5278) +PracticeDuel_VerifyPlayerTurnActions: ; 5278 (1:5278) ld a, [wDuelTurns] srl a - ld hl, PointerTable_541f + ld hl, PracticeDuelTurnVerificationPointerTable call JumpToFunctionInTable + ; return nc if player followed instructions correctly ret nc ; fallthrough -PracticeDuel_5284: ; 5284 (1:5284) - ldtx hl, ThisIsPracticeModePracticeDuelText +PracticeDuel_RepeatInstructions: ; 5284 (1:5284) + ldtx hl, FollowMyGuidancePracticeDuelText call PrintPracticeDuelDrMasonInstructions + ; restart the turn from the saved data of the previous turn ld a, $02 call BankswitchSRAM ld de, sCurrentDuel call LoadSavedDuelData xor a call BankswitchSRAM + ; return carry in order to repeat instructions scf ret ; 0x529b -PracticeDuel_529b: ; 529b (1:529b) +PracticeDuel_PlayStaryuFromBench: ; 529b (1:529b) ld a, [wDuelTurns] cp 7 - jr z, .asm_52a4 + jr z, .its_sam_turn_4 or a ret -.asm_52a4 +.its_sam_turn_4 + ; ask player to choose Staryu from bench to replace knocked out Seaking call DrawPracticeDuelInstructionsTextBox call EnableLCD - ld hl, PracticeDuelText_5346 + ld hl, PracticeDuelText_SamTurn4 jp PrintPracticeDuelInstructions ; 0x52b0 -PracticeDuel_52b0: ; 52b0 (1:52b0) +PracticeDuel_ReplaceKnockedOutPokemon: ; 52b0 (1:52b0) ldh a, [hTempPlayAreaLocation_ff9d] cp PLAY_AREA_BENCH_1 ret z + ; if player selected Drowzee instead (which is at PLAY_AREA_BENCH_2) call HasAlivePokemonOnBench - ldtx hl, Text01d7 + ldtx hl, SelectStaryuPracticeDuelText scf ; fallthrough @@ -2791,70 +2804,71 @@ PrintPracticeDuelDrMasonInstructions: ; 52bc (1:52bc) ; 0x52c5 PracticeDuelTextPointerTable: ; 52c5 (1:52c5) - dw PracticeDuelText_52d5 - dw PracticeDuelText_52e5 - dw PracticeDuelText_52f5 - dw PracticeDuelText_5305 - dw PracticeDuelText_5315 - dw PracticeDuelText_5320 - dw PracticeDuelText_5330 - dw PracticeDuelText_533b + dw PracticeDuelText_Turn1 + dw PracticeDuelText_Turn2 + dw PracticeDuelText_Turn3 + dw PracticeDuelText_Turn4 + dw PracticeDuelText_Turn5 + dw PracticeDuelText_Turn6 + dw PracticeDuelText_Turn7 + dw PracticeDuelText_Turn8 ; 0x52d5 practicetext: MACRO db \1 ; Y coord to place the point-by-point instruction tx \2 ; Dr. Mason's instruction - tx \3 ; Static point-by-point instruction + tx \3 ; static point-by-point instruction ENDM -PracticeDuelText_52d5: - practicetext 2, Text01c0, Text01a9 - practicetext 5, Text01c1, Text01aa - practicetext 8, Text01c2, Text01ab +PracticeDuelText_Turn1: + practicetext 2, Turn1DrMason1PracticeDuelText, Turn1Instr1PracticeDuelText + practicetext 5, Turn1DrMason2PracticeDuelText, Turn1Instr2PracticeDuelText + practicetext 8, Turn1DrMason3PracticeDuelText, Turn1Instr3PracticeDuelText db $00 -PracticeDuelText_52e5: - practicetext 2, Text01c3, Text01ac - practicetext 5, Text01c4, Text01ad - practicetext 8, Text01c5, Text01ae +PracticeDuelText_Turn2: + practicetext 2, Turn2DrMason1PracticeDuelText, Turn2Instr1PracticeDuelText + practicetext 5, Turn2DrMason2PracticeDuelText, Turn2Instr2PracticeDuelText + practicetext 8, Turn2DrMason3PracticeDuelText, Turn2Instr3PracticeDuelText db $00 -PracticeDuelText_52f5: - practicetext 2, Text01c6, Text01af - practicetext 5, Text01c7, Text01b0 - practicetext 8, Text01c8, Text01b1 +PracticeDuelText_Turn3: + practicetext 2, Turn3DrMason1PracticeDuelText, Turn3Instr1PracticeDuelText + practicetext 5, Turn3DrMason2PracticeDuelText, Turn3Instr2PracticeDuelText + practicetext 8, Turn3DrMason3PracticeDuelText, Turn3Instr3PracticeDuelText db $00 -PracticeDuelText_5305: - practicetext 2, Text01c9, Text01b2 - practicetext 5, Text01ca, Text01b3 - practicetext 8, Text01cb, Text01b4 +PracticeDuelText_Turn4: + practicetext 2, Turn4DrMason1PracticeDuelText, Turn4Instr1PracticeDuelText + practicetext 5, Turn4DrMason2PracticeDuelText, Turn4Instr2PracticeDuelText + practicetext 8, Turn4DrMason3PracticeDuelText, Turn4Instr3PracticeDuelText db $00 -PracticeDuelText_5315: - practicetext 2, Text01cc, Text01b5 - practicetext 6, Text01cd, Text01b6 +PracticeDuelText_Turn5: + practicetext 2, Turn5DrMason1PracticeDuelText, Turn5Instr1PracticeDuelText + practicetext 6, Turn5DrMason2PracticeDuelText, Turn5Instr2PracticeDuelText db $00 -PracticeDuelText_5320: - practicetext 2, Text01ce, Text01b7 - practicetext 5, Text01cf, Text01b8 - practicetext 8, Text01d0, Text01b9 +PracticeDuelText_Turn6: + practicetext 2, Turn6DrMason1PracticeDuelText, Turn6Instr1PracticeDuelText + practicetext 5, Turn6DrMason2PracticeDuelText, Turn6Instr2PracticeDuelText + practicetext 8, Turn6DrMason3PracticeDuelText, Turn6Instr3PracticeDuelText db $00 -PracticeDuelText_5330: - practicetext 2, Text01d1, Text01ba - practicetext 5, Text01d2, Text01bb +PracticeDuelText_Turn7: + practicetext 2, Turn7DrMason1PracticeDuelText, Turn7Instr1PracticeDuelText + practicetext 5, Turn7DrMason2PracticeDuelText, Turn7Instr2PracticeDuelText db $00 -PracticeDuelText_533b: - practicetext 2, Text01d3, Text01bc - practicetext 5, Text01d4, Text01bd +PracticeDuelText_Turn8: + practicetext 2, Turn8DrMason1PracticeDuelText, Turn8Instr1PracticeDuelText + practicetext 5, Turn8DrMason2PracticeDuelText, Turn8Instr2PracticeDuelText db $00 -PracticeDuelText_5346: - practicetext 2, Text01d5, Text01be - practicetext 7, Text01d6, Text01bf +; on player's Seaking knocked out +PracticeDuelText_SamTurn4: + practicetext 2, SamTurn4DrMason1PracticeDuelText, SamTurn4Instr1PracticeDuelText + practicetext 7, SamTurn4DrMason2PracticeDuelText, SamTurn4Instr2PracticeDuelText db $00 ; in a practice duel, draws the text box where the point-by-point @@ -2882,6 +2896,8 @@ PrintPracticeDuelInstructionsTextBoxLabel: ; 535d (1:535d) ldtx hl, PlayersTurnPracticeDuelText jp PrintText .replace_due_to_knockout + ; when the player needs to replace a knocked out Pokemon, the label text is different + ; this happens at the end of Sam's fourth turn lb de, 1, 0 ldtx hl, ReplaceDueToKnockoutPracticeDuelText jp InitTextPrinting_ProcessTextFromID @@ -2904,7 +2920,7 @@ PrintPracticeDuelInstructionsForCurrentTurn: ; 5382 (1:5382) ld l, a pop af or a - jr nz, PrintPracticeDuelInstructions_Debug + jr nz, PrintPracticeDuelInstructions_Fast ; fallthrough ; print practice duel instructions given hl = PracticeDuelText_* @@ -2957,15 +2973,14 @@ PrintPracticeDuelLetsPlayTheGame: ; 53d3 (1:53d3) ; simplified version of PrintPracticeDuelInstructions that skips Dr. Mason's text ; and instead places the point-by-point instructions all at once. -; doesn't appear to be ever used, so it was probably used for testing during development. -PrintPracticeDuelInstructions_Debug: ; 53da (1:53da) +PrintPracticeDuelInstructions_Fast: ; 53da (1:53da) ld a, [hli] or a jr z, PrintPracticeDuelLetsPlayTheGame ld e, a ld d, 1 call PrintPracticeDuelNumberedInstruction - jr PrintPracticeDuelInstructions_Debug + jr PrintPracticeDuelInstructions_Fast ; 0x53e6 ; print a practice duel point-by-point instruction at d,e, with text id at hl, @@ -3014,105 +3029,105 @@ Func_53fa: ; 53fa (1:53fa) ret ; 0x541f -PointerTable_541f: ; 541f (1:541f) - dw Func_542f - dw Func_5438 - dw Func_5454 - dw Func_5467 - dw Func_5488 - dw Func_549c - dw Func_54b7 - dw Func_54b7 - -Func_542f: ; 542f (1:542f) +PracticeDuelTurnVerificationPointerTable: ; 541f (1:541f) + dw PracticeDuelVerify_Turn1 + dw PracticeDuelVerify_Turn2 + dw PracticeDuelVerify_Turn3 + dw PracticeDuelVerify_Turn4 + dw PracticeDuelVerify_Turn5 + dw PracticeDuelVerify_Turn6 + dw PracticeDuelVerify_Turn7Or8 + dw PracticeDuelVerify_Turn7Or8 + +PracticeDuelVerify_Turn1: ; 542f (1:542f) ld a, [wTempCardID_ccc2] cp GOLDEEN - jp nz, Func_54c6 + jp nz, ReturnWrongAction ret ; 0x5438 -Func_5438: ; 5438 (1:5438) +PracticeDuelVerify_Turn2: ; 5438 (1:5438) ld a, [wTempCardID_ccc2] cp SEAKING - jp nz, Func_54c6 + jp nz, ReturnWrongAction ld a, [wSelectedMoveIndex] cp 1 - jp nz, Func_54c6 + jp nz, ReturnWrongAction ld e, PLAY_AREA_ARENA call GetPlayAreaCardAttachedEnergies ld a, [wAttachedEnergies + PSYCHIC] or a - jr z, Func_54c6 + jr z, ReturnWrongAction ret ; 0x5454 -Func_5454: ; 5454 (1:5454) +PracticeDuelVerify_Turn3: ; 5454 (1:5454) ld a, [wTempCardID_ccc2] cp SEAKING - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld e, PLAY_AREA_BENCH_1 call GetPlayAreaCardAttachedEnergies ld a, [wAttachedEnergies + WATER] or a - jr z, Func_54c6 + jr z, ReturnWrongAction ret ; 0x5467 -Func_5467: ; 5467 (1:5467) +PracticeDuelVerify_Turn4: ; 5467 (1:5467) ld a, [wPlayerNumberOfPokemonInPlayArea] cp 3 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld e, PLAY_AREA_BENCH_2 call GetPlayAreaCardAttachedEnergies ld a, [wAttachedEnergies + WATER] or a - jr z, Func_54c6 + jr z, ReturnWrongAction ld a, [wTempCardID_ccc2] cp SEAKING - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld a, [wSelectedMoveIndex] cp 1 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ret ; 0x5488 -Func_5488: ; 5488 (1:5488) +PracticeDuelVerify_Turn5: ; 5488 (1:5488) ld e, PLAY_AREA_ARENA call GetPlayAreaCardAttachedEnergies ld a, [wAttachedEnergies + WATER] cp 2 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld a, [wTempCardID_ccc2] cp STARYU - jr nz, Func_54c6 + jr nz, ReturnWrongAction ret ; 0x549c -Func_549c: ; 549c (1:549c) +PracticeDuelVerify_Turn6: ; 549c (1:549c) ld e, PLAY_AREA_ARENA call GetPlayAreaCardAttachedEnergies ld a, [wAttachedEnergies + WATER] cp 3 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld a, [wPlayerArenaCardHP] cp 40 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld a, [wTempCardID_ccc2] cp STARYU - jr nz, Func_54c6 + jr nz, ReturnWrongAction ret ; 0x54b7 -Func_54b7: ; 54b7 (1:54b7) +PracticeDuelVerify_Turn7Or8: ; 54b7 (1:54b7) ld a, [wTempCardID_ccc2] cp STARMIE - jr nz, Func_54c6 + jr nz, ReturnWrongAction ld a, [wSelectedMoveIndex] cp 1 - jr nz, Func_54c6 + jr nz, ReturnWrongAction ret -Func_54c6: +ReturnWrongAction: scf ret ; 0x54c8 diff --git a/src/text/text2.asm b/src/text/text2.asm index a93f9c8..6a37642 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -946,125 +946,125 @@ PressBToFinishPracticeDuelText: ; 3a321 (e:6321) line "finish." done -Text01a9: ; 3a36f (e:636f) +Turn1Instr1PracticeDuelText: ; 3a36f (e:636f) text "1. Choose Hand from the Menu." line " Select a Water Energy card." done -Text01aa: ; 3a3ad (e:63ad) +Turn1Instr2PracticeDuelText: ; 3a3ad (e:63ad) text "2. Attach a Water Energy card to" line " your Active Pokémon, Goldeen." done -Text01ab: ; 3a3f0 (e:63f0) +Turn1Instr3PracticeDuelText: ; 3a3f0 (e:63f0) text "3. Choose Attack from the Menu" line " and select Horn Attack." done -Text01ac: ; 3a42b (e:642b) +Turn2Instr1PracticeDuelText: ; 3a42b (e:642b) text "1. Evolve Goldeen by" line " attaching Seaking to it." done -Text01ad: ; 3a45d (e:645d) +Turn2Instr2PracticeDuelText: ; 3a45d (e:645d) text "2. Attach a Psychic Energy card" line " to the evolved Seaking." done -Text01ae: ; 3a499 (e:6499) +Turn2Instr3PracticeDuelText: ; 3a499 (e:6499) text "3. Choose Attack and select" line " Waterfall to attack your" line " opponent." done -Text01af: ; 3a4df (e:64df) +Turn3Instr1PracticeDuelText: ; 3a4df (e:64df) text "1. Attach a Water Energy card to" line " your Benched Staryu." done -Text01b0: ; 3a519 (e:6519) +Turn3Instr2PracticeDuelText: ; 3a519 (e:6519) text "2. Choose Attack and attack your" line " opponent with Horn Attack." done -Text01b1: ; 3a559 (e:6559) +Turn3Instr3PracticeDuelText: ; 3a559 (e:6559) done -Text01b2: ; 3a55a (e:655a) +Turn4Instr1PracticeDuelText: ; 3a55a (e:655a) text "1. Take Drowzee from your hand" line " and put it on your Bench." done -Text01b3: ; 3a597 (e:6597) +Turn4Instr2PracticeDuelText: ; 3a597 (e:6597) text "2. Attach a Water Energy card to" line " your Benched Drowzee." done -Text01b4: ; 3a5d2 (e:65d2) +Turn4Instr3PracticeDuelText: ; 3a5d2 (e:65d2) text "3. Choose Seaking and attack your" line " opponent with Waterfall." done -Text01b5: ; 3a611 (e:6611) +Turn5Instr1PracticeDuelText: ; 3a611 (e:6611) text "1. Choose a Water Energy card from" line " your hand and attach it to" line " Staryu." done -Text01b6: ; 3a65e (e:665e) +Turn5Instr2PracticeDuelText: ; 3a65e (e:665e) text "2. Choose Staryu and attack your" line " opponent with Slap." done -Text01b7: ; 3a697 (e:6697) +Turn6Instr1PracticeDuelText: ; 3a697 (e:6697) text "1. Choose the Potion card in your" line " hand to recover Staryu's HP." done -Text01b8: ; 3a6da (e:66da) +Turn6Instr2PracticeDuelText: ; 3a6da (e:66da) text "2. Attach a Water Energy card to" line " Staryu." done -Text01b9: ; 3a707 (e:6707) +Turn6Instr3PracticeDuelText: ; 3a707 (e:6707) text "3. Choose Staryu and attack your" line " opponent with Slap." done -Text01ba: ; 3a740 (e:6740) +Turn7Instr1PracticeDuelText: ; 3a740 (e:6740) text "1. Evolve Staryu by" line " attaching Starmie to it." done -Text01bb: ; 3a771 (e:6771) +Turn7Instr2PracticeDuelText: ; 3a771 (e:6771) text "2. Select the evolved Starmie and" line " attack your opponent with Star " line " Freeze." done -Text01bc: ; 3a7c2 (e:67c2) +Turn8Instr1PracticeDuelText: ; 3a7c2 (e:67c2) text "1. Select Starmie and attack your" line " opponent with Star Freeze." done -Text01bd: ; 3a803 (e:6803) +Turn8Instr2PracticeDuelText: ; 3a803 (e:6803) text "2. You Knocked Machop Out." line " Now you can draw a Prize." done -Text01be: ; 3a83c (e:683c) +SamTurn4Instr1PracticeDuelText: ; 3a83c (e:683c) text "1. Your Seaking was Knocked Out." line " Choose your Benched Staryu" line " and press the A Button to set" line " it as your Active Pokémon." done -Text01bf: ; 3a8bb (e:68bb) +SamTurn4Instr2PracticeDuelText: ; 3a8bb (e:68bb) text "2. You can check Pokémon data by" line " pressing SELECT." done -Text01c0: ; 3a8f1 (e:68f1) +Turn1DrMason1PracticeDuelText: ; 3a8f1 (e:68f1) text "To use the attack command, you need" line "to attach Energy cards to your" line "Pokémon." @@ -1073,21 +1073,21 @@ Text01c0: ; 3a8f1 (e:68f1) line "select a Water Energy card." done -Text01c1: ; 3a97b (e:697b) +Turn1DrMason2PracticeDuelText: ; 3a97b (e:697b) text "Next, choose your Active Pokémon," line "Goldeen, and press the A Button." line "Then the Water Energy card will" line "be attached to Goldeen." done -Text01c2: ; 3a9f7 (e:69f7) +Turn1DrMason3PracticeDuelText: ; 3a9f7 (e:69f7) text "Finally, attack your opponent by" line "selecting an attack command." line "Choose Attack from the Menu, and" line "select Horn Attack." done -Text01c3: ; 3aa6b (e:6a6b) +Turn2DrMason1PracticeDuelText: ; 3aa6b (e:6a6b) text "Your Goldeen's gonna get Knocked" line "Out. Let's evolve it!" line "Choose Seaking from your hand and" @@ -1096,7 +1096,7 @@ Text01c3: ; 3aa6b (e:6a6b) line "Its HP increases from 40 to 70." done -Text01c4: ; 3ab08 (e:6b08) +Turn2DrMason2PracticeDuelText: ; 3ab08 (e:6b08) text "Your Seaking doesn't have enough" line "Energy to use Waterfall." line "You need to attach a Psychic Energy" @@ -1107,12 +1107,12 @@ Text01c4: ; 3ab08 (e:6b08) line "other Pokémon." done -Text01c5: ; 3abdb (e:6bdb) +Turn2DrMason3PracticeDuelText: ; 3abdb (e:6bdb) text "Now let's attack your opponent with" line "Seaking's Waterfall!" done -Text01c6: ; 3ac15 (e:6c15) +Turn3DrMason1PracticeDuelText: ; 3ac15 (e:6c15) text "Seaking's got enough Energy, so" line "you don't need to attach any more." line "Attach Energy cards to your Benched" @@ -1123,7 +1123,7 @@ Text01c6: ; 3ac15 (e:6c15) line "Benched Staryu." done -Text01c7: ; 3acd7 (e:6cd7) +Turn3DrMason2PracticeDuelText: ; 3acd7 (e:6cd7) text "Next, select the attack command." line "Machop has 10 HP left." line "Seaking's Horn Attack will be" @@ -1132,7 +1132,7 @@ Text01c7: ; 3acd7 (e:6cd7) line "Horn Attack." done -Text01c8: ; 3ad6d (e:6d6d) +Turn3DrMason3PracticeDuelText: ; 3ad6d (e:6d6d) text "Now Machop's HP is 0 and it is" line "Knocked Out." line "When you Knock Out the Defending" @@ -1140,7 +1140,7 @@ Text01c8: ; 3ad6d (e:6d6d) line "Prize." done -Text01c9: ; 3addd (e:6ddd) +Turn4DrMason1PracticeDuelText: ; 3addd (e:6ddd) text "When all your Pokémon are Knocked" line "Out and there are no Pokémon on your" line "Bench, you lose the game." @@ -1149,19 +1149,19 @@ Text01c9: ; 3addd (e:6ddd) line "you just drew, on your Bench." done -Text01ca: ; 3ae7d (e:6e7d) +Turn4DrMason2PracticeDuelText: ; 3ae7d (e:6e7d) text "Attach a Water Energy card to" line "Drowzee to get it ready to" line "attack." done -Text01cb: ; 3aebf (e:6ebf) +Turn4DrMason3PracticeDuelText: ; 3aebf (e:6ebf) text "Choose your Active Seaking and" line "attack your opponent with" line "Waterfall." done -Text01cc: ; 3af04 (e:6f04) +Turn5DrMason1PracticeDuelText: ; 3af04 (e:6f04) text "Staryu evolves into Starmie!" line "" line "Let's get Staryu ready to use" @@ -1172,51 +1172,51 @@ Text01cc: ; 3af04 (e:6f04) line "your hand and attach it to Staryu." done -Text01cd: ; 3afbc (e:6fbc) +Turn5DrMason2PracticeDuelText: ; 3afbc (e:6fbc) text "Attack your opponent with Staryu's" line "Slap." done -Text01ce: ; 3afe6 (e:6fe6) +Turn6DrMason1PracticeDuelText: ; 3afe6 (e:6fe6) text "Now, recover Staryu with a Trainer" line "card." line "Choose Potion from your hand." done -Text01cf: ; 3b02e (e:702e) +Turn6DrMason2PracticeDuelText: ; 3b02e (e:702e) text "Now let's get ready to evolve" line "it to Starmie." line "Also, attach a Water Energy card to" line "Staryu." done -Text01d0: ; 3b088 (e:7088) +Turn6DrMason3PracticeDuelText: ; 3b088 (e:7088) text "Attack your opponent with Staryu's" line "Slap to end your turn." done -Text01d1: ; 3b0c3 (e:70c3) +Turn7DrMason1PracticeDuelText: ; 3b0c3 (e:70c3) text "Now you have finally drawn a" line "Starmie card!" line "Choose Starmie from your hand and" line "use it to evolve Staryu." done -Text01d2: ; 3b12a (e:712a) +Turn7DrMason2PracticeDuelText: ; 3b12a (e:712a) text "You've already attached enough" line "Energy to use Star Freeze." line "Attack your opponent with" line "Starmie's Star Freeze." done -Text01d3: ; 3b196 (e:7196) +Turn8DrMason1PracticeDuelText: ; 3b196 (e:7196) text "Now Machop has only 10 HP left." line "Let's finish the battle!" line "Attack with Starmie's Star Freeze." line "" done -Text01d4: ; 3b1f4 (e:71f4) +Turn8DrMason2PracticeDuelText: ; 3b1f4 (e:71f4) text "You've Knocked Out your opponent!" line "" line "Pick up the last Prize." @@ -1224,7 +1224,7 @@ Text01d4: ; 3b1f4 (e:71f4) text " is the winner!" done -Text01d5: ; 3b242 (e:7242) +SamTurn4DrMason1PracticeDuelText: ; 3b242 (e:7242) text "Choose a Benched Pokémon to replace" line "your Knocked Out Pokémon." line "You now have Drowzee and Staryu" @@ -1233,14 +1233,14 @@ Text01d5: ; 3b242 (e:7242) line "for this practice duel." done -Text01d6: ; 3b2ec (e:72ec) +SamTurn4DrMason2PracticeDuelText: ; 3b2ec (e:72ec) text "Here, press SELECT to" line "check Pokémon data." line "It is important to know your cards" line "and the status of your Pokémon." done -Text01d7: ; 3b35a (e:735a) +SelectStaryuPracticeDuelText: ; 3b35a (e:735a) text "Select Staryu for this practice," line "OK?" done @@ -1253,7 +1253,7 @@ NeedPracticeAgainPracticeDuelText: ; 3b39b (e:739b) text "Do you need to practice again?" done -ThisIsPracticeModePracticeDuelText: ; 3b3bb (e:73bb) +FollowMyGuidancePracticeDuelText: ; 3b3bb (e:73bb) text "This is Practice Mode, so" line "please follow my guidance." line "Do it again." diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 0a18aa5..bd1da35 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -426,56 +426,56 @@ TextOffsets:: ; 34000 (d:4000) textpointer PutPokemonOnBenchPracticeDuelText ; 0x01a6 textpointer ChooseStaryuPracticeDuelText ; 0x01a7 textpointer PressBToFinishPracticeDuelText ; 0x01a8 - textpointer Text01a9 ; 0x01a9 - textpointer Text01aa ; 0x01aa - textpointer Text01ab ; 0x01ab - textpointer Text01ac ; 0x01ac - textpointer Text01ad ; 0x01ad - textpointer Text01ae ; 0x01ae - textpointer Text01af ; 0x01af - textpointer Text01b0 ; 0x01b0 - textpointer Text01b1 ; 0x01b1 - textpointer Text01b2 ; 0x01b2 - textpointer Text01b3 ; 0x01b3 - textpointer Text01b4 ; 0x01b4 - textpointer Text01b5 ; 0x01b5 - textpointer Text01b6 ; 0x01b6 - textpointer Text01b7 ; 0x01b7 - textpointer Text01b8 ; 0x01b8 - textpointer Text01b9 ; 0x01b9 - textpointer Text01ba ; 0x01ba - textpointer Text01bb ; 0x01bb - textpointer Text01bc ; 0x01bc - textpointer Text01bd ; 0x01bd - textpointer Text01be ; 0x01be - textpointer Text01bf ; 0x01bf - textpointer Text01c0 ; 0x01c0 - textpointer Text01c1 ; 0x01c1 - textpointer Text01c2 ; 0x01c2 - textpointer Text01c3 ; 0x01c3 - textpointer Text01c4 ; 0x01c4 - textpointer Text01c5 ; 0x01c5 - textpointer Text01c6 ; 0x01c6 - textpointer Text01c7 ; 0x01c7 - textpointer Text01c8 ; 0x01c8 - textpointer Text01c9 ; 0x01c9 - textpointer Text01ca ; 0x01ca - textpointer Text01cb ; 0x01cb - textpointer Text01cc ; 0x01cc - textpointer Text01cd ; 0x01cd - textpointer Text01ce ; 0x01ce - textpointer Text01cf ; 0x01cf - textpointer Text01d0 ; 0x01d0 - textpointer Text01d1 ; 0x01d1 - textpointer Text01d2 ; 0x01d2 - textpointer Text01d3 ; 0x01d3 - textpointer Text01d4 ; 0x01d4 - textpointer Text01d5 ; 0x01d5 - textpointer Text01d6 ; 0x01d6 - textpointer Text01d7 ; 0x01d7 + textpointer Turn1Instr1PracticeDuelText ; 0x01a9 + textpointer Turn1Instr2PracticeDuelText ; 0x01aa + textpointer Turn1Instr3PracticeDuelText ; 0x01ab + textpointer Turn2Instr1PracticeDuelText ; 0x01ac + textpointer Turn2Instr2PracticeDuelText ; 0x01ad + textpointer Turn2Instr3PracticeDuelText ; 0x01ae + textpointer Turn3Instr1PracticeDuelText ; 0x01af + textpointer Turn3Instr2PracticeDuelText ; 0x01b0 + textpointer Turn3Instr3PracticeDuelText ; 0x01b1 + textpointer Turn4Instr1PracticeDuelText ; 0x01b2 + textpointer Turn4Instr2PracticeDuelText ; 0x01b3 + textpointer Turn4Instr3PracticeDuelText ; 0x01b4 + textpointer Turn5Instr1PracticeDuelText ; 0x01b5 + textpointer Turn5Instr2PracticeDuelText ; 0x01b6 + textpointer Turn6Instr1PracticeDuelText ; 0x01b7 + textpointer Turn6Instr2PracticeDuelText ; 0x01b8 + textpointer Turn6Instr3PracticeDuelText ; 0x01b9 + textpointer Turn7Instr1PracticeDuelText ; 0x01ba + textpointer Turn7Instr2PracticeDuelText ; 0x01bb + textpointer Turn8Instr1PracticeDuelText ; 0x01bc + textpointer Turn8Instr2PracticeDuelText ; 0x01bd + textpointer SamTurn4Instr1PracticeDuelText ; 0x01be + textpointer SamTurn4Instr2PracticeDuelText ; 0x01bf + textpointer Turn1DrMason1PracticeDuelText ; 0x01c0 + textpointer Turn1DrMason2PracticeDuelText ; 0x01c1 + textpointer Turn1DrMason3PracticeDuelText ; 0x01c2 + textpointer Turn2DrMason1PracticeDuelText ; 0x01c3 + textpointer Turn2DrMason2PracticeDuelText ; 0x01c4 + textpointer Turn2DrMason3PracticeDuelText ; 0x01c5 + textpointer Turn3DrMason1PracticeDuelText ; 0x01c6 + textpointer Turn3DrMason2PracticeDuelText ; 0x01c7 + textpointer Turn3DrMason3PracticeDuelText ; 0x01c8 + textpointer Turn4DrMason1PracticeDuelText ; 0x01c9 + textpointer Turn4DrMason2PracticeDuelText ; 0x01ca + textpointer Turn4DrMason3PracticeDuelText ; 0x01cb + textpointer Turn5DrMason1PracticeDuelText ; 0x01cc + textpointer Turn5DrMason2PracticeDuelText ; 0x01cd + textpointer Turn6DrMason1PracticeDuelText ; 0x01ce + textpointer Turn6DrMason2PracticeDuelText ; 0x01cf + textpointer Turn6DrMason3PracticeDuelText ; 0x01d0 + textpointer Turn7DrMason1PracticeDuelText ; 0x01d1 + textpointer Turn7DrMason2PracticeDuelText ; 0x01d2 + textpointer Turn8DrMason1PracticeDuelText ; 0x01d3 + textpointer Turn8DrMason2PracticeDuelText ; 0x01d4 + textpointer SamTurn4DrMason1PracticeDuelText ; 0x01d5 + textpointer SamTurn4DrMason2PracticeDuelText ; 0x01d6 + textpointer SelectStaryuPracticeDuelText ; 0x01d7 textpointer LetsPlayTheGamePracticeDuelText ; 0x01d8 textpointer NeedPracticeAgainPracticeDuelText ; 0x01d9 - textpointer ThisIsPracticeModePracticeDuelText ; 0x01da + textpointer FollowMyGuidancePracticeDuelText ; 0x01da textpointer PlayersTurnPracticeDuelText ; 0x01db textpointer ReplaceDueToKnockoutPracticeDuelText ; 0x01dc textpointer Text01dd ; 0x01dd -- cgit v1.2.3 From 6ca10ce0a94bd705080425f0cc9ba0efebc476e8 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 21 Sep 2018 19:38:04 +0200 Subject: Forgot a constant --- src/engine/bank01.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index c612498..1fca015 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -331,9 +331,9 @@ HandleTurn: ; 4225 (1:4225) ; fallthrough ; when a practice duel turn needs to be restarted because the player did not -; follow the instructions correctly, the game jumps here +; follow the instructions correctly, the game loops back here RestartPracticeDuelTurn: ; 4268 (1:4268) - ld a, $06 + ld a, PRACTICEDUEL_PRINT_TURN_INSTRUCTIONS call DoPracticeDuelAction ; fallthrough -- cgit v1.2.3