diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/bank01.asm | 6 | ||||
-rw-r--r-- | src/engine/bank02.asm | 1999 | ||||
-rw-r--r-- | src/engine/bank06.asm | 99 | ||||
-rw-r--r-- | src/engine/home.asm | 27 | ||||
-rw-r--r-- | src/text/text2.asm | 24 | ||||
-rw-r--r-- | src/text/text_offsets.asm | 34 | ||||
-rw-r--r-- | src/wram.asm | 49 |
7 files changed, 2054 insertions, 184 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 792b235..868d284 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -811,7 +811,7 @@ UsePokemonCard: ; 44db (1:44db) ; triggered by selecting the "Check" item in the duel menu DuelMenu_Check: ; 4585 (1:4585) call Func_3b31 - call Func_3096 + call OpenDuelCheckMenu jp DuelMainInterface ; triggered by pressing SELECT in the duel menu @@ -5198,7 +5198,7 @@ Func_60dd: ; 60dd (1:60dd) jr z, .asm_6119 or a jr z, .asm_6132 - call Func_3096 + call OpenDuelCheckMenu jr .asm_60f2 .asm_6132 call OpenTurnHolderHandScreen_Simple @@ -6296,7 +6296,7 @@ Func_67fb: ; 67fb (1:67fb) ld a, [wCurrentDuelMenuItem] or a jr z, .asm_6839 - call Func_3096 + call OpenDuelCheckMenu jr .asm_6829 .asm_6839 call OpenTurnHolderHandScreen_Simple diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index f22d584..2b4d598 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -1,17 +1,1774 @@ -Func_8000: ; 8000 (2:4000) - INCROM $8000, $8211 +_OpenDuelCheckMenu: ; 8000 (2:4000) + call ResetCursorPositionAndBlink + xor a + ld [wce5e], a + call DrawWideTextBox + +; reset cursor blink + xor a + ld [wCheckMenuCursorBlinkCounter], a + ld hl, CheckMenuData + call PlaceTextItems +.loop + call DoFrame + call HandleCheckMenuInput + jr nc, .loop + cp $ff + ret z ; B pressed + +; A was pressed + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + ld hl, .table + call JumpToFunctionInTable + jr _OpenDuelCheckMenu + +.table: ; 8031 (2:4031) + dw DuelCheckMenu_InPlayArea + dw DuelCheckMenu_Glossary + dw DuelCheckMenu_YourPlayArea + dw DuelCheckMenu_OppPlayArea + +DuelCheckMenu_InPlayArea: ; 8039 (2:4039) + xor a + ld [wce60], a + farcall Func_180d5 + ret + +DuelCheckMenu_Glossary: ; 8042 (2:4042) + farcall Func_006_44c8 + ret + +DuelCheckMenu_YourPlayArea: ; 8047 (2:4047) + call ResetCursorPositionAndBlink + xor a + ld [wce5e], a + ldh a, [hWhoseTurn] +.draw + ld h, a + ld l, a + call DrawYourOrOppPlayArea_LoadTurnHolders + + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + ld [wLastCursorPosition_YourOrOppPlayArea], a + ld b, $f8 ; black arrow tile + call DrawByteToTabulatedPositions + + call DrawWideTextBox + +; reset cursor blink + xor a + ld [wCheckMenuCursorBlinkCounter], a + ld hl, YourPlayAreaMenuData + call PlaceTextItems + +.loop + call DoFrame + xor a + call DrawArrowsToTabulatedPositions + call HandleCheckMenuInput_YourOrOppPlayArea + jr nc, .loop + + call EraseByteFromTabulatedPositions + cp $ff + ret z + + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + ld hl, .table + call JumpToFunctionInTable + jr .draw + +.table ; 8098 (2:4098) + dw OpenDuelScreen_TurnHolderPlayArea + dw OpenDuelScreen_TurnHolderHand + dw OpenDuelScreen_TurnHolderDiscardPile + +OpenDuelScreen_TurnHolderPlayArea: ; 809e (2:409e) + ldh a, [hWhoseTurn] + push af + bank1call OpenTurnHolderPlayAreaScreen + pop af + ldh [hWhoseTurn], a + ret + +OpenDuelScreen_NonTurnHolderPlayArea + ldh a, [hWhoseTurn] + push af + bank1call OpenNonTurnHolderPlayAreaScreen + pop af + ldh [hWhoseTurn], a + ret + +OpenDuelScreen_TurnHolderHand + ldh a, [hWhoseTurn] + push af + bank1call OpenTurnHolderHandScreen_Simple + pop af + ldh [hWhoseTurn], a + ret + +OpenDuelScreen_NonTurnHolderHand + ldh a, [hWhoseTurn] + push af + bank1call OpenNonTurnHolderHandScreen_Simple + pop af + ldh [hWhoseTurn], a + ret + +OpenDuelScreen_TurnHolderDiscardPile + ldh a, [hWhoseTurn] + push af + bank1call OpenTurnHolderDiscardPileScreen + pop af + ldh [hWhoseTurn], a + ret + +OpenDuelScreen_NonTurnHolderDiscardPile + ldh a, [hWhoseTurn] + push af + bank1call OpenNonTurnHolderDiscardPileScreen + pop af + ldh [hWhoseTurn], a + ret + +; handles the menu when in the Opponent's Play Area submenu +; if clairvoyance is active, add the option to check +; opponent's hand +DuelCheckMenu_OppPlayArea: ; 80da (2:40da) + call ResetCursorPositionAndBlink + call IsClairvoyanceActive + jr c, .clairvoyance1 + + ld a, %10000000 + ld [wce5e], a + jr .begin +.clairvoyance1 + xor a + ld [wce5e], a + +.begin + ldh a, [hWhoseTurn] +.turns + ld l, a + cp PLAYER_TURN + jr nz, .opponent + ld a, OPPONENT_TURN + ld h, a + jr .cursor +.opponent + ld a, PLAYER_TURN + ld h, a + +.cursor + call DrawYourOrOppPlayArea_LoadTurnHolders + +; convert cursor position and +; store it in wLastCursorPosition_YourOrOppPlayArea + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + add 3 + ld [wLastCursorPosition_YourOrOppPlayArea], a + +; draw black arrows in the Play Area + ld b, $f8 ; black arrow tile + call DrawByteToTabulatedPositions + call DrawWideTextBox + + +; reset cursor blink + xor a + ld [wCheckMenuCursorBlinkCounter], a + +; place text items depending on clairvoyance +; when active, allows to look at opp. hand + call IsClairvoyanceActive + jr c, .clairvoyance2 + ld hl, OppPlayAreaMenuData + call PlaceTextItems + jr .loop +.clairvoyance2 + ld hl, OppPlayAreaMenuData_WithClairvoyance + call PlaceTextItems + +; handle input +.loop + call DoFrame + ld a, 1 + call DrawArrowsToTabulatedPositions + call HandleCheckMenuInput_YourOrOppPlayArea + jr nc, .loop + call EraseByteFromTabulatedPositions + cp $ff + ret z ; B was pressed + +; A was pressed +; jump to function corresponding to cursor position + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + ld hl, .table + call JumpToFunctionInTable + jr .turns + +.table + dw OpenDuelScreen_NonTurnHolderPlayArea + dw OpenDuelScreen_NonTurnHolderHand + dw OpenDuelScreen_NonTurnHolderDiscardPile + +CheckMenuData: ; (2:4158) + textitem 2, 14, InPlayAreaText + textitem 2, 16, YourPlayAreaText + textitem 12, 14, GlossaryText + textitem 12, 16, OppPlayAreaText + db $ff + +YourPlayAreaMenuData: ; (2:4169) + textitem 2, 14, YourPokemonText + textitem 12, 14, YourHandText + textitem 2, 16, YourDiscardPileText2 + db $ff + +OppPlayAreaMenuData: ; (2:4176) + textitem 2, 14, OpponentsPokemonText + textitem 2, 16, OpponentsDiscardPileText2 + db $ff + +OppPlayAreaMenuData_WithClairvoyance: ; (2:4176) + textitem 2, 14, OpponentsPokemonText + textitem 12, 14, OpponentsHandText + textitem 2, 16, OpponentsDiscardPileText2 + db $ff + +; checks if arrows need to be erased in Play Area +; and draws new arrows upon cursor position change +; input: +; a = an initial offset applied to the cursor position +DrawArrowsToTabulatedPositions: ; 818c (2:418c) + push af + ld b, a + add b + add b + ld c, a + ld a, [wCheckMenuCursorYPosition] + sla a + ld b, a + ld a, [wCheckMenuCursorXPosition] + add b + add c +; a = 2 * cursor ycoord + cursor xcoord + 3*a + +; if cursor position is different than +; last position, then update arrows + ld hl, wLastCursorPosition_YourOrOppPlayArea + cp [hl] + jr z, .unchanged + +; erase and draw arrows + call EraseByteFromTabulatedPositions + ld [wLastCursorPosition_YourOrOppPlayArea], a + ld b, $f8 ; black arrow tile byte + call DrawByteToTabulatedPositions + +.unchanged + pop af + ret + +; load white tile in b to erase +; the bytes drawn previously +EraseByteFromTabulatedPositions: ; 81af (2:41af) + push af + ld a, [wLastCursorPosition_YourOrOppPlayArea] + ld b, SYM_SPACE ; white tile + call DrawByteToTabulatedPositions + pop af + ret + +; writes tile in b to positions tabulated in +; PlayAreaDrawPositionsPointerTable, with offset calculated from the +; cursor x and y positions in a +; input: +; a = cursor position (2*y + x) +; b = byte to draw +DrawByteToTabulatedPositions: ; 81ba (2:41ba) + push bc + ld hl, PlayAreaDrawPositionsPointerTable + sla a + ld c, a + ld b, $00 + add hl, bc +; hl points to PlayAreaDrawPositionsPointerTable +; plus offset corresponding to a + +; load hl with draw position pointer + ld a, [hli] + ld h, [hl] + ld l, a + pop de + +.loop + ld a, [hli] + cp $ff + jr z, .done + ld b, a + ld a, [hli] + ld c, a + ld a, d + call WriteByteToBGMap0 + jr .loop +.done + ret + +PlayAreaDrawPositionsPointerTable: ; 81d7 (2:41d7) + dw PlayAreaDrawPositions.player_pokemon + dw PlayAreaDrawPositions.player_hand + dw PlayAreaDrawPositions.player_discard_pile + dw PlayAreaDrawPositions.opponent_pokemon + dw PlayAreaDrawPositions.opponent_hand + dw PlayAreaDrawPositions.opponent_discard_pile + +PlayAreaDrawPositions: ; 81e3 (2:41e3) +; x and y coordinates to draw byte +.player_pokemon: + db 5, 5 + db 0, 10 + db 4, 10 + db 8, 10 + db 12, 10 + db 16, 10 + db $ff + +.player_hand: + db 14, 7 + db $ff + +.player_discard_pile: + db 14, 5 + db $ff + +.opponent_pokemon: + db 5, 7 + db 0, 3 + db 4, 3 + db 8, 3 + db 12, 3 + db 16, 3 + db $ff + +.opponent_hand: + db 0, 5 + db $ff + +.opponent_discard_pile: + db 0, 8 + db $ff + +; loads tiles and icons to display your/opp play area +; and draws the screen according to the turn player +; h = turn holder 1 +; l = turn holder 2 +DrawYourOrOppPlayArea_LoadTurnHolders: ; 8209 (2:4209) +; loads the turn holders + ld a, h + ld [wTurnHolder1], a + ld a, l + ld [wTurnHolder2], a +; fallthrough + +; loads tiles and icons to display your/opp play area +; and draws the screen according to the turn player +_DrawYourOrOppPlayArea: ; 8211 (2:4211) + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + + ld a, $01 + ld [wVBlankOAMCopyToggle], a + + call DoFrame + call EmptyScreen + call Set_OBJ_8x8 + call LoadCursorTile + call LoadSymbolsFont + call LoadDeckAndDiscardPileIcons + + ld a, [wTurnHolder1] + cp PLAYER_TURN + jr nz, .opp_turn1 + +; print <RAMNAME>'s Play Area + ld de, wDefaultText + call CopyPlayerName + jr .get_text_length +.opp_turn1 + ld de, wDefaultText + call CopyOpponentName +.get_text_length + ld hl, wDefaultText + + call GetTextLengthInTiles + ld a, 6 ; max name size in tiles + sub b + srl a + add 4 +; a = (6 - name text in tiles) / 2 + 4 + ld d, a ; text horizontal alignment + + ld e, $00 + call InitTextPrinting + ldtx hl, DuelistsPlayAreaText + ldh a, [hWhoseTurn] + cp PLAYER_TURN + jr nz, .opp_turn2 + ld a, [wTurnHolder1] + cp PLAYER_TURN + jr nz, .swap +.opp_turn2 + call PrintTextNoDelay + jr .draw +.swap + call SwapTurn + call PrintTextNoDelay + call SwapTurn + +.draw + ld a, [wTurnHolder1] + ld b, a + ld a, [wTurnHolder2] + cp b + jr nz, .not_equal + + ld hl, PrizeCardsCoordinateData_1.player + call DrawPrizeCards + lb de, 6, 2 ; coordinates of player's active card + call DrawActiveCardGfx_YourOrOppPlayArea + lb de, 1, 9 ; coordinates of player's bench cards + ld c, 4 ; spacing + call DrawYourOrOppPlayArea_BenchCards + xor a + call DrawYourOrOppPlayArea_Icons + jr .lcd +.not_equal + ld hl, PrizeCardsCoordinateData_1.opponent + call DrawPrizeCards + lb de, 6, 5 ; coordinates of opponent's active card + call DrawActiveCardGfx_YourOrOppPlayArea + lb de, 1, 2 ; coordinates of opponent's bench cards + ld c, 4 ; spacing + call DrawYourOrOppPlayArea_BenchCards + ld a, $01 + call DrawYourOrOppPlayArea_Icons + +.lcd + call EnableLCD + ret + +DrawTurnHolderPrizeCards: ; 82b6 (2:42b6) + ld a, [wTurnHolder1] + ld b, a + ld a, [wTurnHolder2] + cp b + jr nz, .not_equal + + ld hl, PrizeCardsCoordinateData_1.player + call DrawPrizeCards + ret + +.not_equal + ld hl, PrizeCardsCoordinateData_1.opponent + call DrawPrizeCards + ret + +; draws icons and cards to the In Play Area screen +_DrawInPlayArea: ; 82ce (2:42ce) + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call DoFrame + call EmptyScreen + + ld a, $0a + ld [wDuelDisplayedScreen], a + call Set_OBJ_8x8 + call LoadCursorTile + call LoadSymbolsFont + call LoadDeckAndDiscardPileIcons + + lb de, $80, $9f + call SetupText + +; reset turn holders + ldh a, [hWhoseTurn] + ld [wTurnHolder1], a + ld [wTurnHolder2], a + +; player prize cards + ld hl, PrizeCardsCoordinateData_3.player + call DrawPrizeCards + +; player bench cards + lb de, 3, 15 + ld c, 3 + call DrawYourOrOppPlayArea_BenchCards + + ld hl, PlayAreaIconCoordinates.player2 + call DrawInPlayArea_Icons + + call SwapTurn + ldh a, [hWhoseTurn] + ld [wTurnHolder1], a + call SwapTurn + +; opponent prize cards + ld hl, PrizeCardsCoordinateData_3.opponent + call DrawPrizeCards + +; opponent bench cards + lb de, 3, 0 + ld c, 3 + call DrawYourOrOppPlayArea_BenchCards + + call SwapTurn + ld hl, PlayAreaIconCoordinates.opponent2 + call DrawInPlayArea_Icons + + call SwapTurn + call DrawActiveCardGfx_InPlayArea + ret + +; draws players prize cards +; and bench cards +_DrawPlayersPrizeAndBenchCards: ; 833c (2:433c) + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call DoFrame + call EmptyScreen + call LoadSymbolsFont + call LoadDeckAndDiscardPileIcons + +; player cards + ld a, PLAYER_TURN + ld [wTurnHolder1], a + ld [wTurnHolder2], a + ld hl, PrizeCardsCoordinateData_2.player + call DrawPrizeCards + lb de, 5, 10 ; coordinates + ld c, 3 ; spacing + call DrawYourOrOppPlayArea_BenchCards + +; opponent cards + ld a, OPPONENT_TURN + ld [wTurnHolder1], a + ld hl, PrizeCardsCoordinateData_2.opponent + call DrawPrizeCards + lb de, 1, 0 ; coordinates + ld c, 3 ; spacing + call DrawYourOrOppPlayArea_BenchCards + ret + +; draws the active card gfx at coordinates de +; of the player (or opponent) depending on wTurnHolder1 +; input: +; de = coordinates +DrawActiveCardGfx_YourOrOppPlayArea: ; 837e (2:437e) + push de + ld a, DUELVARS_ARENA_CARD + ld l, a + ld a, [wTurnHolder1] + ld h, a + ld a, [hl] + cp -1 + jr z, .no_pokemon + + ld d, a + ld a, [wTurnHolder1] + ld b, a + ldh a, [hWhoseTurn] + cp b + jr nz, .swap + ld a, d + call LoadCardDataToBuffer1_FromDeckIndex + jr .draw +.swap + call SwapTurn + ld a, d + call LoadCardDataToBuffer1_FromDeckIndex + call SwapTurn + +.draw + lb de, $8a, $00 ; destination offset of loaded gfx + ld hl, wLoadedCard1Gfx + ld a, [hli] + ld h, [hl] + ld l, a + lb bc, $30, TILE_SIZE + call LoadCardGfx + bank1call SetBGP6OrSGB3ToCardPalette + bank1call FlushAllPalettesOrSendPal23Packet + pop de + +; draw card gfx + ld a, $a0 + lb hl, 6, 1 + lb bc, 8, 6 + call FillRectangle + bank1call ApplyBGP6OrSGB3ToCardImage + ret + +.no_pokemon + pop de + ret + +; draws player and opponent arena card graphics +; in the play area screen +DrawActiveCardGfx_InPlayArea: ; 83cc (2:43cc) + xor a + ld [wArenaCardsInPlayArea], a + + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + cp -1 ; no pokemon + jr z, .opponent1 + + push af + ld a, [wArenaCardsInPlayArea] + or %00000001 ; set the player arena Pokemon bit + ld [wArenaCardsInPlayArea], a + pop af + +; load card gfx + call LoadCardDataToBuffer1_FromDeckIndex + lb de, $8a, $00 + ld hl, wLoadedCard1Gfx + ld a, [hli] + ld h, [hl] + ld l, a + lb bc, $30, TILE_SIZE + call LoadCardGfx + bank1call SetBGP6OrSGB3ToCardPalette + +.opponent1 + ld a, DUELVARS_ARENA_CARD + call GetNonTurnDuelistVariable + cp -1 ; no pokemon + jr z, .draw + + push af + ld a, [wArenaCardsInPlayArea] + or %00000010 ; set the opponent arena Pokemon bit + ld [wArenaCardsInPlayArea], a + pop af + +; load card gfx + call SwapTurn + call LoadCardDataToBuffer1_FromDeckIndex + lb de, $95, $00 + ld hl, wLoadedCard1Gfx + ld a, [hli] + ld h, [hl] + ld l, a + lb bc, $30, TILE_SIZE + call LoadCardGfx + bank1call SetBGP7OrSGB2ToCardPalette + call SwapTurn + +.draw + ld a, [wArenaCardsInPlayArea] + or a + ret z ; no arena cards in play + + bank1call FlushAllPalettesOrSendPal23Packet + ld a, [wArenaCardsInPlayArea] + and %00000001 ; test player arena card bit + jr z, .opponent2 + +; draw player arena card + ld a, $a0 + lb de, 6, 9 + lb hl, 6, 1 + lb bc, 8, 6 + call FillRectangle + bank1call ApplyBGP6OrSGB3ToCardImage + +.opponent2 + ld a, [wArenaCardsInPlayArea] + and %00000010 ; test opponent arena card bit + ret z + +; draw opponent arena card + call SwapTurn + ld a, $50 + lb de, 6, 2 + lb hl, 6, 1 + lb bc, 8, 6 + call FillRectangle + bank1call ApplyBGP7OrSGB2ToCardImage + call SwapTurn + ret + +; draws prize cards depending on the turn +; loaded in wTurnHolder1 +; input: +; hl = pointer to coordinates +DrawPrizeCards: ; 8464 (2:4464) + push hl + call GetDuelInitialPrizesUpperBitsSet + ld a, [wTurnHolder1] + ld h, a + ld l, DUELVARS_PRIZES + ld a, [hl] + + pop hl + ld b, 0 + push af +; loop each prize card +.loop + inc b + ld a, [wDuelInitialPrizes] + inc a + cp b + jr z, .done + + pop af + srl a ; right shift prize cards left + push af + jr c, .not_taken + ld a, $e0 ; tile byte for empty slot + jr .draw +.not_taken + ld a, $dc ; tile byte for card +.draw + ld e, [hl] + inc hl + ld d, [hl] + inc hl + + push hl + push bc + lb hl, $01, $02 ; card tile gfx + lb bc, 2, 2 ; rectangle size + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .not_cgb + ld a, $02 ; blue colour + lb bc, 2, 2 + lb hl, 0, 0 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 +.not_cgb + pop bc + pop hl + jr .loop +.done + pop af + ret + +PrizeCardsCoordinateData_1: ; 0x84b4 (2:44b4) +; x and y coordinates for player prize cards +.player + db 2, 1 + db 2, 3 + db 4, 1 + db 4, 3 + db 6, 1 + db 6, 3 +; x and y coordinates for opponent prize cards +.opponent + db 9, 17 + db 9, 15 + db 7, 17 + db 7, 15 + db 5, 17 + db 5, 15 + +PrizeCardsCoordinateData_2: +; x and y coordinates for player prize cards +.player + db 6, 0 + db 6, 2 + db 8, 0 + db 8, 2 + db 10, 0 + db 10, 2 +; x and y coordinates for opponent prize cards +.opponent + db 4, 18 + db 4, 16 + db 2, 18 + db 2, 16 + db 0, 18 + db 0, 16 + +PrizeCardsCoordinateData_3: ; 0x84e4 (2:44e4) +; x and y coordinates for player prize cards +.player + db 9, 1 + db 9, 3 + db 11, 1 + db 11, 3 + db 13, 1 + db 13, 3 +; x and y coordinates for opponent prize cards +.opponent + db 6, 17 + db 6, 15 + db 4, 17 + db 4, 15 + db 2, 17 + db 2, 15 + +; calculates bits set up to the number of +; initial prizes, with upper 2 bits set, i.e: +; 6 prizes: a = %11111111 +; 4 prizes: a = %11001111 +; 3 prizes: a = %11000111 +; 2 prizes: a = %11000011 +GetDuelInitialPrizesUpperBitsSet: ; 84fc (2:44fc) + ld a, [wDuelInitialPrizes] + ld b, $01 +.loop + or a + jr z, .done + sla b + dec a + jr .loop +.done + dec b + ld a, b + or %11000000 + ld [wDuelInitialPrizesUpperBitsSet], a + ret + +; draws filled and empty bench slots depending +; on the turn loaded in wTurnHolder1 +; if wTurnHolder1 is different from wTurnHolder2 +; adjusts coordinates of the bench slots +; input: +; de = coordinates to draw bench +; c = spacing between slots +DrawYourOrOppPlayArea_BenchCards: ; 8511 (2:4511) + ld a, [wTurnHolder2] + ld b, a + ld a, [wTurnHolder1] + cp b + jr z, .skip + +; adjust the starting bench position for opponent + ld a, d + add c + add c + add c + add c + ld d, a + ; d = d + 4 * c + +; have the spacing go to the left instead of right + xor a + sub c + ld c, a + ; c = $ff - c + 1 + + ld a, [wTurnHolder1] +.skip + ld h, a + ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + ld b, [hl] + ld l, DUELVARS_BENCH1_CARD_STAGE +.loop_1 + dec b ; num of Bench Pokemon left + jr z, .done + + ld a, [hli] + push hl + push bc + sla a + sla a + add $e4 +; a holds the correct stage gfx tile + ld b, a + push bc + + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + pop bc + jr nz, .next + + ld a, b + cp $ec ; tile offset of 2 stage + jr z, .two_stage + cp $f0 ; tile offset of 2 stage with no 1 stage + jr z, .two_stage + + ld a, $02 ; blue colour + jr .palette +.two_stage + ld a, $01 ; red colour +.palette + lb bc, 2, 2 + lb hl, 0, 0 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 + +.next ; adjust coordinates for next card + pop bc + pop hl + ld a, d + add c + ld d, a + ; d = d + c + jr .loop_1 + +.done + ld a, [wTurnHolder1] + ld h, a + ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + ld b, [hl] + ld a, MAX_PLAY_AREA_POKEMON + sub b + ret z ; return if already full + + ld b, a + inc b +.loop_2 + dec b + ret z + + push bc + ld a, $f4 ; empty bench slot tile + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .not_cgb + + ld a, $02 ; colour + lb bc, 2, 2 + lb hl, 0, 0 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 + +.not_cgb + pop bc + ld a, d + add c + ld d, a + jr .loop_2 + +; draws Play Area icons depending on value in a +; input: +; a = $00: draws player icons +; a = $01: draws opponent icons +DrawYourOrOppPlayArea_Icons: ; 85aa (2:45aa) + or a + jr nz, .opponent + ld hl, PlayAreaIconCoordinates.player1 + jr .draw +.opponent + ld hl, PlayAreaIconCoordinates.opponent1 + +.draw +; hand icon and value + ld a, [wTurnHolder1] + ld d, a + ld e, DUELVARS_NUMBER_OF_CARDS_IN_HAND + ld a, [de] + ld b, a + ld a, $d0 ; hand icon, unused? + call PrintsHandTextAndValue + +; deck icon and value + ld a, [wTurnHolder1] + ld d, a + ld e, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + ld a, [de] + ld b, a + ld a, DECK_SIZE + sub b + ld b, a + ld a, $d4 ; deck icon + call DrawIconWithValue -Func_8211: ; 8211 (2:4211) - INCROM $8211, $833c +; discard pile icon and value + ld a, [wTurnHolder1] + ld d, a + ld e, DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE + ld a, [de] + ld b, a + ld a, $d8 ; discard pile icon + call DrawIconWithValue + ret + +; draws the interface icon corresponding to the gfx tile in a +; also prints the number in decimal corresponding to the value in b +; the coordinates in screen are given by [hl] +; input: +; a = tile for the icon +; b = value to print alongside icon +; hl = pointer to coordinates +DrawIconWithValue: ; 85e1 (2:45e1) +; drawing the icon + ld d, [hl] + inc hl + ld e, [hl] + inc hl + push hl + push bc + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .skip + + ld a, $02 + lb bc, 2, 2 + lb hl, 0, 0 + call BankswitchVRAM1 + call FillRectangle + call BankswitchVRAM0 + +.skip +; adjust coordinate to the lower right + inc d + inc d + inc e + call InitTextPrinting + pop bc + ld a, b + call CalculateOnesAndTensDigits + + ld hl, wOnesAndTensPlace + ld a, [hli] + ld b, a + ld a, [hl] + +; loading numerical and cross symbols + ld hl, wDefaultText + ld [hl], TX_SYMBOL + inc hl + ld [hl], SYM_CROSS + inc hl + ld [hl], TX_SYMBOL + inc hl + ld [hli], a ; tens place + ld [hl], TX_SYMBOL + inc hl + ld a, b + ld [hli], a ; ones place + ld [hl], TX_END + +; printing the decimal value + ld hl, wDefaultText + call ProcessText + pop hl + ret + +PlayAreaIconCoordinates ; 8635 (2:4635) +; used for "Your/Opp. Play Area" screen +.player1 + db 15, 7 ; hand + db 15, 2 ; deck + db 15, 4 ; discard pile +.opponent1 + db 1, 5 ; hand + db 1, 9 ; deck + db 1, 7 ; discard pile + +; used for "In Play Area" screen +.player2 + db 15, 14 + db 15, 9 + db 15, 11 +.opponent2 + db 0, 2 + db 0, 6 + db 0, 4 + +; draws In Play Area icons +DrawInPlayArea_Icons: ; 864d (2:464d) + ldh a, [hWhoseTurn] + ld d, a + ld e, DUELVARS_NUMBER_OF_CARDS_IN_HAND + ld a, [de] + ld b, a + ld a, $d0 ; hand icon, unused? + call PrintsHandTextAndValue + +; deck + ldh a, [hWhoseTurn] + ld d, a + ld e, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + ld a, [de] + ld b, a + ld a, DECK_SIZE + sub b + ld b, a + ld a, $d4 ; deck tile + call DrawIconWithValue + +; discard pile + ldh a, [hWhoseTurn] + ld d, a + ld e, $ed + ld a, [de] + ld b, a + ld a, $d8 ; discard pile tile + call DrawIconWithValue + ret -Func_833c: ; 833c (2:433c) - INCROM $833c, $8764 +; prints text HandText2 and a cross with +; decimal value of b +; input +; b = value to print alongside text +PrintsHandTextAndValue: ; 8676 (2:4676) + ld d, [hl] + inc hl + ld e, [hl] + inc hl + +; text + push hl + push bc + call InitTextPrinting + ldtx hl, HandText2 + call ProcessTextFromID + pop bc +; decimal value + ld a, b + call CalculateOnesAndTensDigits + ld hl, wOnesAndTensPlace + ld a, [hli] + ld b, a + ld a, [hl] + + ld hl, wDefaultText + ld [hl], TX_SYMBOL + inc hl + ld [hl], SYM_CROSS + inc hl + ld [hl], TX_SYMBOL + inc hl + ld [hli], a + ld [hl], TX_SYMBOL + inc hl + +; draw to screen + ld a, b + ld [hli], a + ld [hl], TX_END + ld hl, wDefaultText + call ProcessText + pop hl + ret + +; handle player input in menu in Your or Opp. Play Area +; works out which cursor coordinate to go to +; and sets carry flag if A or B are pressed +; returns a = $1 if A pressed +; returns a = $ff if B pressed +HandleCheckMenuInput_YourOrOppPlayArea: ; 86ac (2:46ac) + xor a + ld [wcfe3], a + ld a, [wCheckMenuCursorXPosition] + ld d, a + ld a, [wCheckMenuCursorYPosition] + ld e, a + +; d = cursor x position +; e = cursor y position + + ldh a, [hDPadHeld] + or a + jr z, .skip + +; pad is pressed + ld a, [wce5e] + and %10000000 + ldh a, [hDPadHeld] + jr nz, .check_vertical + bit D_LEFT_F, a ; test left button + jr nz, .horizontal + bit D_RIGHT_F, a ; test right button + jr z, .check_vertical + +; handle horizontal input +.horizontal + ld a, [wce5e] + and %01111111 + or a + jr nz, .asm_86dd ; jump if wce5e's lower 7 bits aren't set + ld a, e + or a + jr z, .flip_x ; jump if y is 0 + +; wce5e = %10000000 +; e = 1 + dec e ; change y position + jr .flip_x + +.asm_86dd + ld a, e + or a + jr nz, .flip_x ; jump if y is not 0 + inc e ; change y position +.flip_x + ld a, d + xor $01 ; flip x position + ld d, a + jr .erase + +.check_vertical + bit D_UP_F, a + jr nz, .vertical + bit D_DOWN_F, a + jr z, .skip + +; handle vertical input +.vertical + ld a, d + or a + jr z, .flip_y ; jump if x is 0 + dec d +.flip_y + ld a, e + xor $01 ; flip y position + ld e, a + +.erase + ld a, $01 + ld [wcfe3], a + push de + call EraseCheckMenuCursor_YourOrOppPlayArea + pop de + +;update x and y cursor positions + ld a, d + ld [wCheckMenuCursorXPosition], a + ld a, e + ld [wCheckMenuCursorYPosition], a + +; reset cursor blink + xor a + ld [wCheckMenuCursorBlinkCounter], a + +.skip + ldh a, [hKeysPressed] + and A_BUTTON | B_BUTTON + jr z, .sfx + and A_BUTTON + jr nz, .a_pressed + +; B pressed + ld a, $ff ; cancel + call PlaySFXConfirmOrCancel + scf + ret + +.a_pressed + call DisplayCheckMenuCursor_OppPlayArea + ld a, $01 + call PlaySFXConfirmOrCancel + scf + ret + +.sfx + ld a, [wcfe3] + or a + jr z, .draw_cursor + call PlaySFX + +.draw_cursor + ld hl, wCheckMenuCursorBlinkCounter + ld a, [hl] + inc [hl] + and %00001111 + ret nz ; only update cursor if blink's lower nibble is 0 + + ld a, SYM_CURSOR_R ; cursor byte + bit 4, [hl] ; only draw cursor if blink counter's fourth bit is not set + jr z, DrawCheckMenuCursor_YourOrOppPlayArea +; fallthrough + +; transforms cursor position into coordinates +; in order to draw byte on menu cursor +EraseCheckMenuCursor_YourOrOppPlayArea: ; 8741 (2:4741) + ld a, SYM_SPACE ; white tile +; fallthrough + +; draws in the cursor position +; input: +; a = tile byte to draw +DrawCheckMenuCursor_YourOrOppPlayArea: ; 8743 (2:4743) + ld e, a + ld a, 10 + ld l, a + ld a, [wCheckMenuCursorXPosition] + ld h, a + call HtimesL +; h = 10 * cursor x pos + + ld a, l + add 1 + ld b, a + ld a, [wCheckMenuCursorYPosition] + sla a + add 14 + ld c, a +; c = 11 + 2 * cursor y pos + 14 + +; draw tile loaded in e + ld a, e + call WriteByteToBGMap0 + or a + ret + +DisplayCheckMenuCursor_OppPlayArea: ; 8760 (2:4760) + ld a, SYM_CURSOR_R ; load cursor byte + jr DrawCheckMenuCursor_YourOrOppPlayArea +; fallthrough + +; seems to be function to deal with the Peek menu +; to select a prize card to view Func_8764: ; 8764 (2:4764) - INCROM $8764, $8932 + call Set_OBJ_8x8 + call LoadCursorTile +; reset ce5c and ce56 + xor a + ld [$ce5c], a + ld [$ce56], a + +; draw play area screen for the turn player + ldh a, [hWhoseTurn] + ld h, a + ld l, a + call DrawYourOrOppPlayArea_LoadTurnHolders + +.swap + ld a, [$ce56] + or a + jr z, .draw_menu +; if ce56 != 0, swap turn + call SwapTurn + xor a + ld [$ce56], a + +.draw_menu + xor a + ld hl, PlayAreaMenuParameters + call InitializeMenuParameters + call DrawWideTextBox + + ld hl, YourOrOppPlayAreaData + call PlaceTextItems + +.loop_1 + call DoFrame + call HandleMenuInput ; await input + jr nc, .loop_1 + cp $ff + jr z, .loop_1 + + call EraseCursor + ldh a, [hCurMenuItem] + or a + jp nz, Func_8883 ; jump if not first option + +; hCurMenuItem = 0 + ld a, [wTurnHolder1] + ld b, a + ldh a, [hWhoseTurn] + cp b + jr z, .text + +; switch the play area to draw + ld h, a + ld l, a + call DrawYourOrOppPlayArea_LoadTurnHolders + xor a + ld [$ce56], a + +.text + call DrawWideTextBox + lb de, $01, $0e + call InitTextPrinting + ldtx hl, WhichCardWouldYouLikeToSeeText + call ProcessTextFromID + + xor a + ld [wPrizeCardCursorPosition], a + ld de, Func_88c2 + ld hl, wce53 + ld [hl], e + inc hl + ld [hl], d + +.loop_2 + ld a, $01 + ld [wVBlankOAMCopyToggle], a + call DoFrame + call Func_89ae + jr c, .asm_87e7 + jr .loop_2 +.asm_87e7 + cp $ff + jr nz, .asm_87f0 + call Func_8aa1 + jr .swap +.asm_87f0 + ld hl, .asm_87f8 + call JumpToFunctionInTable + jr .loop_2 + +.asm_87f8 +rept 6 + dw Func_8819 +endr + dw Func_883c + dw Func_8849 + +YourOrOppPlayAreaData: ; 8808 (2:4808) + textitem 2, 14, YourPlayAreaText + textitem 2, 16, OppPlayAreaText + db $ff + +PlayAreaMenuParameters: ; 8811 (2:4811) + db 1, 14 ; cursor x, cursor y + db 2 ; y displacement between items + db 2 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw $0000 ; function pointer if non-0 + +Func_8819: ; 8819 (2:4819) + ld a, [wPrizeCardCursorPosition] + ld c, a + ld b, $01 + +; left-shift b a number of times +; corresponding to this prize card +.loop + or a + jr z, .asm_8827 + sla b + dec a + jr .loop + +.asm_8827 + ld a, DUELVARS_PRIZES + call GetTurnDuelistVariable + and b + ret z ; return if prize card taken + + ld a, c + add $40 + ld [$ce5c], a + ld a, c + add DUELVARS_PRIZE_CARDS + call GetTurnDuelistVariable + jr Func_8855 + +Func_883c: + call CreateHandCardList + ret c + ld hl, wDuelTempList + call ShuffleCards + ld a, [hl] + jr Func_8855 + +Func_8849: + call CreateDeckCardList + ret c + ld a, %01111111 + ld [$ce5c], a + ld a, [wDuelTempList] +; fallthrough + +; input: +; a = deck index of card to be loaded +; output: +; a = ce5c +; with upper bit set if turn was swapped +Func_8855: + ld b, a + ld a, [$ce5c] + or a + jr nz, .display + ld a, b + ld [$ce5c], a +.display + ld a, b + call LoadCardDataToBuffer1_FromDeckIndex + call Set_OBJ_8x16 + bank1call OpenCardPage_FromHand + ld a, $01 + ld [wVBlankOAMCopyToggle], a + pop af + +; if ce56 != 0, swap turn + ld a, [$ce56] + or a + jr z, .dont_swap + call SwapTurn + ld a, [$ce5c] + or %10000000 + ret +.dont_swap + ld a, [$ce5c] + ret + +Func_8883: ; 8883 (2:4883) + ld a, [wTurnHolder1] + ld b, a + ldh a, [hWhoseTurn] + cp b + jr nz, .text + + ld l, a + cp PLAYER_TURN + jr nz, .opponent + ld a, OPPONENT_TURN + jr .draw +.opponent + ld a, PLAYER_TURN + +.draw + ld h, a + call DrawYourOrOppPlayArea_LoadTurnHolders + +.text + call DrawWideTextBox + lb de, $01, $0e + call InitTextPrinting + ldtx hl, WhichCardWouldYouLikeToSeeText + call ProcessTextFromID + + xor a + ld [wPrizeCardCursorPosition], a + ld de, $48fa + ld hl, wce53 + ld [hl], e + inc hl + ld [hl], d + + call SwapTurn + ld a, $01 + ld [$ce56], a + jp Func_8764.loop_2 + +Func_88c2: ; 88c2 (2:48c2) + INCROM $88c2, $8932 Func_8932: ; 8932 (2:4932) - INCROM $8932, $8aaa + INCROM $8932, $8992 + +LoadCursorTile: ; 8992 (2:4992) + ld de, v0Tiles0 + ld hl, .tile_data + ld b, 16 + call SafeCopyDataHLtoDE + ret + +.tile_data: ; 899e (2:499e) + db $e0, $c0, $98, $b0, $84, $8c, $83, $82 + db $86, $8f, $9d, $be, $f4, $f8, $50, $60 + +Func_89ae: ; 89ae (2:49ae) + xor a + ld [wcfe3], a + + ld hl, wce53 + ld e, [hl] + inc hl + ld d, [hl] + + ld a, [wPrizeCardCursorPosition] + ld [wce61], a + ld l, a + ld h, 7 + call HtimesL + add hl, de +; hl = [wce53] + 7 * wce52 + + ldh a, [hDPadHeld] + or a + jp z, .asm_8a4f + + inc hl + inc hl + inc hl + bit D_UP_F, a + jr z, .asm_89d5 + ld a, [hl] + jr .asm_89eb + +.asm_89d5 + inc hl + bit D_DOWN_F, a + jr z, .asm_89dd + ld a, [hl] + jr .asm_89eb +.asm_89dd + inc hl + bit D_RIGHT_F, a + jr z, .asm_89e5 + ld a, [hl] + jr .asm_89eb +.asm_89e5 + inc hl + bit D_LEFT_F, a + jr z, .asm_8a4f + ld a, [hl] +.asm_89eb + ld [wPrizeCardCursorPosition], a + cp $08 + jr nc, .asm_8a46 + ld b, $01 +.asm_89f4 + or a + jr z, .asm_89fc + sla b + dec a + jr .asm_89f4 +.asm_89fc + ld a, [wDuelInitialPrizesUpperBitsSet] + and b + jr nz, .asm_8a46 + ld a, [wce61] + cp $06 + jr nz, Func_89ae + ldh a, [hDPadHeld] + bit 4, a + jr nz, .asm_8a13 + bit 5, a + jr z, Func_89ae +.asm_8a13 + ld a, [wDuelInitialPrizes] + cp $05 + jr nc, .asm_8a46 + ld a, [wPrizeCardCursorPosition] + cp $05 + jr nz, .asm_8a28 + ld a, $03 + ld [wPrizeCardCursorPosition], a + jr .asm_8a2d +.asm_8a28 + ld a, $02 + ld [wPrizeCardCursorPosition], a +.asm_8a2d + ld a, [wDuelInitialPrizes] + cp $03 + jr nc, .asm_8a3c + ld a, [wPrizeCardCursorPosition] + sub $02 + ld [wPrizeCardCursorPosition], a +.asm_8a3c + ld a, [wPrizeCardCursorPosition] + ld [wce61], a + ld b, $01 + jr .asm_89f4 +.asm_8a46 + ld a, $01 + ld [wcfe3], a + +; reset cursor blink + xor a + ld [wCheckMenuCursorBlinkCounter], a + +.asm_8a4f + ldh a, [hKeysPressed] + and A_BUTTON | B_BUTTON + jr z, .asm_8a6d + and A_BUTTON + jr nz, .asm_8a60 + ld a, $ff ; cancel + call PlaySFXConfirmOrCancel + scf + ret + +.asm_8a60 + call Func_8a82 + ld a, $01 + call PlaySFXConfirmOrCancel + ld a, [wPrizeCardCursorPosition] + scf + ret +.asm_8a6d + ld a, [wcfe3] + or a + jr z, .asm_8a76 + call PlaySFX +.asm_8a76 + ld hl, wCheckMenuCursorBlinkCounter + ld a, [hl] + inc [hl] + and $0f + ret nz + bit 4, [hl] + jr nz, Func_8aa1 + +Func_8a82 ; 8a82 (2:4a82) + call ZeroObjectPositions + ld hl, wce53 + ld e, [hl] + inc hl + ld d, [hl] + ld a, [wPrizeCardCursorPosition] + ld l, a + ld h, 7 + call HtimesL + add hl, de +; hl = [wce53] + 7 * wce52 + + ld d, [hl] + inc hl + ld e, [hl] + inc hl + ld b, [hl] + ld c, $00 + call SetOneObjectAttributes + or a + ret + +Func_8aa1: ; 8aa1 (2:4aa1) + call ZeroObjectPositions + ld a, $01 + ld [wVBlankOAMCopyToggle], a + ret +; 0x8aaa Func_8aaa: ; 8aaa (2:4aaa) INCROM $8aaa, $8b85 @@ -126,15 +1883,15 @@ Func_8dea: ; 8dea (2:4dea) ld [wceb1], a call Func_8ff2 jp nc, Func_8e05 - ld a, $ff - call Func_90fb + ld a, $ff ; cancel + call PlaySFXConfirmOrCancel call Func_8fe8 scf ret Func_8e05: ; 8e05 (2:4e05) ld a, $1 - call Func_90fb + call PlaySFXConfirmOrCancel call GetPointerToDeckCards push hl call GetPointerToDeckName @@ -167,21 +1924,21 @@ Func_8e42: ; 8e42 (2:4e42) call DrawWideTextBox ld hl, Unknown_9027 call PlaceTextItems - call Func_905a + call ResetCursorPositionAndBlink .asm_8e4e call DoFrame - call Func_9065 + call HandleCheckMenuInput jp nc, .asm_8e4e cp $ff jr nz, .asm_8e64 - call Func_90d8 + call EraseCheckMenuCursor ld a, [wceb1] jp Func_8dbc .asm_8e64 - ld a, [wceaf] + ld a, [wCheckMenuCursorXPosition] or a jp nz, Func_8f8a - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] or a jp nz, .asm_8ecf call GetPointerToDeckCards @@ -334,7 +2091,7 @@ Func_8f38: ; 8f38 (2:4f38) ret Func_8f8a: ; 8f8a (2:4f8a) - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] or a jp nz, Func_9026 call Func_8ff2 @@ -426,116 +2183,151 @@ GetPointerToDeckCards: ; 9048 (2:5048) pop af ret -Func_905a: ; 905a (2:505a) +ResetCursorPositionAndBlink: ; 905a (2:505a) xor a - ld [wceaf], a - ld [wceb0], a - ld [wcea3], a + ld [wCheckMenuCursorXPosition], a + ld [wCheckMenuCursorYPosition], a + ld [wCheckMenuCursorBlinkCounter], a ret -Func_9065: ; 9065 (2:5065) +; handle player input in check menu +; works out which cursor coordinate to go to +; and sets carry flag if A or B are pressed +; returns a = $1 if A pressed +; returns a = $ff if B pressed +HandleCheckMenuInput: ; 9065 (2:5065) xor a ld [wcfe3], a - ld a, [wceaf] + ld a, [wCheckMenuCursorXPosition] ld d, a - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] ld e, a + +; d = cursor x position +; e = cursor y position + ldh a, [hDPadHeld] or a - jr z, .asm_90a6 + jr z, .no_pad bit D_LEFT_F, a - jr nz, .asm_907e + jr nz, .horizontal bit D_RIGHT_F, a - jr z, .asm_9084 -.asm_907e + jr z, .check_vertical + +; handle horizontal input +.horizontal ld a, d - xor $1 + xor $1 ; flips x coordinate ld d, a - jr .asm_9090 -.asm_9084 + jr .okay +.check_vertical bit D_UP_F, a - jr nz, .asm_908c + jr nz, .vertical bit D_DOWN_F, a - jr z, .asm_90a6 -.asm_908c + jr z, .no_pad + +; handle vertical input +.vertical ld a, e - xor $1 + xor $01 ; flips y coordinate ld e, a -.asm_9090 - ld a, $1 + +.okay + ld a, $01 ld [wcfe3], a push de - call Func_90d8 + call EraseCheckMenuCursor pop de + +;update x and y cursor positions ld a, d - ld [wceaf], a + ld [wCheckMenuCursorXPosition], a ld a, e - ld [wceb0], a + ld [wCheckMenuCursorYPosition], a + +; reset cursor blink xor a - ld [wcea3], a -.asm_90a6 + ld [wCheckMenuCursorBlinkCounter], a +.no_pad ldh a, [hKeysPressed] and A_BUTTON | B_BUTTON - jr z, .asm_90c1 + jr z, .no_input and A_BUTTON - jr nz, .asm_90b7 - ld a, $ff - call Func_90fb + jr nz, .a_press + ld a, $ff ; cancel + call PlaySFXConfirmOrCancel scf ret -.asm_90b7 - call Func_90f7 - ld a, $1 - call Func_90fb + +.a_press + call DisplayCheckMenuCursor + ld a, $01 + call PlaySFXConfirmOrCancel scf ret -.asm_90c1 + +.no_input ld a, [wcfe3] or a - jr z, .asm_90ca + jr z, .check_blink call PlaySFX -.asm_90ca - ld hl, wcea3 + +.check_blink + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] - and $f - ret nz - ld a, $f - bit 4, [hl] - jr z, asm_90da -Func_90d8: ; 90d8 (2:50d8) - ld a, $0 -asm_90da + and %00001111 + ret nz ; only update cursor if blink's lower nibble is 0 + + ld a, SYM_CURSOR_R ; cursor byte + bit 4, [hl] ; only draw cursor if blink counter's fourth bit is not set + jr z, DrawCheckMenuCursor + +; draws in the cursor position +EraseCheckMenuCursor: ; 90d8 (2:50d8) + ld a, SYM_SPACE ; empty cursor +; fallthrough + +; draws in the cursor position +; input: +; a = tile byte to draw +DrawCheckMenuCursor: ld e, a - ld a, $a + ld a, 10 ld l, a - ld a, [wceaf] + ld a, [wCheckMenuCursorXPosition] ld h, a call HtimesL + ld a, l - add $1 + add 1 ld b, a - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] sla a - add $e + add 14 ld c, a + ld a, e call WriteByteToBGMap0 or a ret -Func_90f7: ; 90f7 (2:50f7) - ld a, $f - jr asm_90da +DisplayCheckMenuCursor: ; 90f7 (2:50f7) + ld a, SYM_CURSOR_R + jr DrawCheckMenuCursor -Func_90fb: ; 90fb (2:50fb) +; plays sound depending on value in a +; input: +; a = $ff: play cancel sound +; a != $ff: play confirm sound +PlaySFXConfirmOrCancel: ; 90fb (2:50fb) push af inc a jr z, .asm_9103 - ld a, SFX_02 + ld a, SFX_02 ; confirmation sfx jr .asm_9105 .asm_9103 - ld a, SFX_03 + ld a, SFX_03 ; cancellation sfx .asm_9105 call PlaySFX pop af @@ -784,7 +2576,48 @@ Func_9345: ; 9345 (2:5345) INCROM $9345, $9843 Func_9843: ; 9843 (2:5843) - INCROM $9843, $9e41 + INCROM $9843, $98a6 + +; determines the ones and tens digits in a for printing +; the ones place is added $20 so that it maps to a +; numerical character while if the tens is 0, +; it maps to an empty character +; a = value to calculate digits +CalculateOnesAndTensDigits: ; 98a6 (2:58a6) + push af + push bc + push de + push hl + ld c, -1 +.loop + inc c + sub 10 + jr nc, .loop + jr z, .zero1 + add 10 + ; a = a mod 10 + ; c = floor(a / 10) +.zero1 +; ones digit + add SYM_0 + ld hl, wOnesAndTensPlace + ld [hli], a + +; tens digit + ld a, c + or a + jr z, .zero2 + add SYM_0 +.zero2 + ld [hl], a + + pop hl + pop de + pop bc + pop af + ret + + INCROM $98c7, $9e41 Func_9e41: ; 9e41 (2:5e41) INCROM $9e41, $a288 @@ -824,12 +2657,12 @@ Func_b19d: ; b19d (2:719d) ld a, [wcea1] add b ld [wd088], a - call Func_905a + call ResetCursorPositionAndBlink call DrawWideTextBox ld hl, $7274 call PlaceTextItems call DoFrame - call Func_9065 + call HandleCheckMenuInput jp nc, $71e7 cp $ff jr nz, .asm_b1fa @@ -837,9 +2670,9 @@ Func_b19d: ; b19d (2:719d) jp $71b3 .asm_b1fa - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] sla a - ld hl, wceaf + ld hl, wCheckMenuCursorXPosition add [hl] or a jr nz, .asm_b22c @@ -972,7 +2805,7 @@ Func_ba04: ; ba04 (2:7a04) or a jr z, .asm_ba40 ld a, $1 - call Func_90fb + call PlaySFXConfirmOrCancel call $7653 call Func_8e1f call $7644 @@ -992,7 +2825,7 @@ Func_ba04: ; ba04 (2:7a04) cp $ff jp z, $7b0d ld [wd088], a - call Func_905a + call ResetCursorPositionAndBlink xor a ld [wce5e], a call DrawWideTextBox @@ -1007,9 +2840,9 @@ Func_ba04: ; ba04 (2:7a04) jp $7a25 .asm_badf - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] sla a - ld hl, wceaf + ld hl, wCheckMenuCursorXPosition add [hl] or a jr nz, .asm_bb09 @@ -1069,7 +2902,7 @@ Func_ba04: ; ba04 (2:7a04) or a jp z, $7a40 ld a, $1 - call Func_90fb + call PlaySFXConfirmOrCancel call $7653 xor a call $6dfe diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 9b1e54d..7a20b2f 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -154,10 +154,10 @@ _CopyCardNameAndLevel_HalfwidthText: Func_180d5: ; 180d5 (6:40d5) ld a, $05 - ld [$ce52], a + ld [wPrizeCardCursorPosition], a .asm_006_40da xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a farcall $2, $42ce call EnableLCD call IsClairvoyanceActive @@ -171,7 +171,7 @@ Func_180d5: ; 180d5 (6:40d5) ld [hl], e inc hl ld [hl], d - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] call .asm_006_4171 .asm_006_40fe ld a, $01 @@ -187,11 +187,11 @@ Func_180d5: ; 180d5 (6:40d5) and $04 jr nz, .asm_006_4148 .asm_006_4118 - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] ld [$ce58], a call Func_006_43bb jr c, .asm_006_4139 - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] cp $10 jp z, .asm_006_41f8 cp $11 @@ -218,12 +218,12 @@ Func_180d5: ; 180d5 (6:40d5) call Func_006_44bf lb de, $38, $9f call SetupText - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] ld [$ce57], a ld hl, .jump_table call JumpToFunctionInTable ld a, [$ce57] - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jp .asm_006_40da .asm_006_4171 ; 18171 (6:4171) push af @@ -254,7 +254,7 @@ Func_180d5: ; 180d5 (6:40d5) ld a, l cp $06 jr nc, .asm_006_41e3 - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] cp $06 jr nc, .asm_006_41c2 ld a, l @@ -282,7 +282,7 @@ Func_180d5: ; 180d5 (6:40d5) call ProcessText ret .asm_006_41e3 - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] cp $08 jr nc, .asm_006_41ee call PrintTextNoDelay @@ -301,7 +301,7 @@ Func_180d5: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [$ce57] - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jp .asm_006_40da .asm_006_4210 lb de, $38, $9f @@ -312,7 +312,7 @@ Func_180d5: ; 180d5 (6:40d5) pop af ldh [hWhoseTurn], a ld a, [$ce57] - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jp .asm_006_40da .jump_table ; (6:4228) dw Func_006_4248 @@ -333,7 +333,7 @@ Func_180d5: ; 180d5 (6:40d5) dw Func_006_426a Func_006_4248: - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] inc a cp PLAY_AREA_BENCH_5 + $01 jr nz, .asm_006_4251 @@ -352,7 +352,7 @@ Func_006_4248: ret Func_006_426a: - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] sub $08 or a jr z, .asm_006_4274 @@ -432,7 +432,7 @@ Func_006_43bb: ; 183bb (6:43bb) ld e, [hl] inc hl ld d, [hl] - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] ld l, a .asm_006_43c9 ld h, $07 @@ -468,10 +468,10 @@ Func_006_43bb: ; 183bb (6:43bb) ld a, [hl] .asm_006_43f5 push af - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] ld [$ce57], a pop af - ld [$ce52], a + ld [wPrizeCardCursorPosition], a cp $05 jr c, .asm_006_440e cp $0b @@ -485,23 +485,23 @@ Func_006_43bb: ; 183bb (6:43bb) dec a jr nz, .asm_006_441d ld a, $10 - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jr .asm_006_4462 .asm_006_441d ld b, a - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] cp b jr c, .asm_006_4462 ldh a, [hDPadHeld] bit D_RIGHT_F, a jr z, .asm_006_4430 xor a - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jr .asm_006_4462 .asm_006_4430: ld a, b dec a - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jr .asm_006_4462 .asm_006_4437: ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA @@ -509,11 +509,11 @@ Func_006_43bb: ; 183bb (6:43bb) dec a jr nz, .asm_006_4446 ld a, $11 - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jr .asm_006_4462 .asm_006_4446 ld b, a - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] sub $0b cp b jr c, .asm_006_4462 @@ -521,17 +521,17 @@ Func_006_43bb: ; 183bb (6:43bb) bit D_LEFT_F, a jr z, .asm_006_445c ld a, $0b - ld [$ce52], a + ld [wPrizeCardCursorPosition], a jr .asm_006_4462 .asm_006_445c ld a, b add $0a - ld [$ce52], a + ld [wPrizeCardCursorPosition], a .asm_006_4462 ld a, $01 ld [wcfe3], a xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a .asm_006_446b ldh a, [hKeysPressed] and $03 @@ -539,14 +539,14 @@ Func_006_43bb: ; 183bb (6:43bb) and $01 jr nz, .asm_006_447d ld a, $ff - farcall Func_90fb + farcall PlaySFXConfirmOrCancel scf ret .asm_006_447d call Func_006_44a0 ld a, $01 - farcall Func_90fb - ld a, [$ce52] + farcall PlaySFXConfirmOrCancel + ld a, [wPrizeCardCursorPosition] scf ret .asm_006_448b @@ -555,7 +555,7 @@ Func_006_43bb: ; 183bb (6:43bb) jr z, .asm_006_4494 call PlaySFX .asm_006_4494 - ld hl, wcea3 + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f @@ -569,7 +569,7 @@ Func_006_44a0: ; 184a0 (6:44a0) ld e, [hl] inc hl ld d, [hl] - ld a, [$ce52] + ld a, [wPrizeCardCursorPosition] ld l, a ld h, $07 call HtimesL @@ -590,20 +590,21 @@ Func_006_44bf: ; 184bf (6:44bf) ld [wVBlankOAMCopyToggle], a ret +Func_006_44c8: ; 184c8 (6:44c8) xor a ld [wGlossaryPageNo], a call Func_006_452b xor a - ld [$ce52], a + ld [wPrizeCardCursorPosition], a ld de, $4c8e ld hl, $ce53 ld [hl], e inc hl ld [hl], d ld a, $ff - ld [$ce55], a + ld [wDuelInitialPrizesUpperBitsSet], a xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a .asm_006_44e5 ld a, $01 ld [wVBlankOAMCopyToggle], a @@ -626,11 +627,11 @@ Func_006_44bf: ; 184bf (6:44bf) call Func_006_4598 call Func_006_452b xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a jr .asm_006_44e5 .asm_006_4518 ld a, $01 - farcall Func_90fb + farcall PlaySFXConfirmOrCancel .asm_006_451e ld a, [wGlossaryPageNo] xor $01 @@ -754,7 +755,7 @@ Func_006_4598: ; 18598 (6:4598) and B_BUTTON jr z, .asm_006_45f7 ld a, $ff - farcall Func_90fb + farcall PlaySFXConfirmOrCancel ret ; unit: 5 bytes. @@ -789,9 +790,9 @@ GlossaryData2: ; (6:4661) xor a ld [wcfe3], a - ld a, [wceaf] + ld a, [wCheckMenuCursorXPosition] ld d, a - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] ld e, a ldh a, [hDPadHeld] or a @@ -821,11 +822,11 @@ GlossaryData2: call .asm_006_46d4 pop de ld a, d - ld [wceaf], a + ld [wCheckMenuCursorXPosition], a ld a, e - ld [wceb0], a + ld [wCheckMenuCursorYPosition], a xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a .asm_006_46a2 ldh a, [hKeysPressed] and $03 @@ -848,7 +849,7 @@ GlossaryData2: jr z, .asm_006_46c6 call PlaySFX .asm_006_46c6 - ld hl, wcea3 + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f @@ -862,13 +863,13 @@ GlossaryData2: ld e, a ld a, $0a ld l, a - ld a, [wceaf] + ld a, [wCheckMenuCursorXPosition] ld h, a call HtimesL ld a, l add $01 ld b, a - ld a, [wceb0] + ld a, [wCheckMenuCursorYPosition] sla a add $0e ld c, a @@ -1121,7 +1122,7 @@ Func_006_50fb: ; 190fb (6:50fb) ld a, [wWhoseTurn] ld l, a .asm_006_5127 - call Func_30bc + call DrawYourOrOppPlayArea pop af ld [wDuelDisplayedScreen], a .asm_006_512e @@ -1904,7 +1905,7 @@ NamingScreen_CheckButtonState: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a ld a, $06 cp d jp z, NamingScreen_CheckButtonState @@ -1930,7 +1931,7 @@ NamingScreen_CheckButtonState: jr z, .asm_006_69f8 call PlaySFX .asm_006_69f8 - ld hl, wcea3 + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f @@ -2685,7 +2686,7 @@ Func_006_6efb: ld a, h ld [wNamingScreenCursorX], a xor a - ld [wcea3], a + ld [wCheckMenuCursorBlinkCounter], a ld a, $02 cp d jp z, Func_006_6efb @@ -2711,7 +2712,7 @@ Func_006_6efb: jr z, .asm_006_6f92 call PlaySFX .asm_006_6f92 - ld hl, wcea3 + ld hl, wCheckMenuCursorBlinkCounter ld a, [hl] inc [hl] and $0f diff --git a/src/engine/home.asm b/src/engine/home.asm index 84cabdd..40a1f85 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -6239,7 +6239,10 @@ LoadPlacingThePrizesScreenTiles: ; 20f0 (0:20f0) ld de, v0Tiles1 + $20 tiles ld b, $d call CopyFontsOrDuelGraphicsTiles - ; load the Deck and the Discard Pile icons +; fallthrough + +; load the Deck and the Discard Pile icons +LoadDeckAndDiscardPileIcons: ; 20fb (0:20fb) ld hl, DuelDmgSgbSymbolGraphics + $54 tiles - $4000 ld a, [wConsole] cp CONSOLE_CGB @@ -9277,12 +9280,12 @@ CompareDEtoBC: ; 3090 (0:3090) cp c ret -Func_3096: ; 3096 (0:3096) +OpenDuelCheckMenu: ; 3096 (0:3096) ldh a, [hBankROM] push af - ld a, BANK(Func_8000) + ld a, BANK(_OpenDuelCheckMenu) call BankswitchROM - call Func_8000 + call _OpenDuelCheckMenu pop af call BankswitchROM ret @@ -9300,27 +9303,27 @@ Func_30a6: ; 30a6 (0:30a6) call BankswitchROM ret -Func_30bc: ; 30bc (0:30bc) +DrawYourOrOppPlayArea: ; 30bc (0:30bc) ld a, h - ld [wce50], a + ld [wTurnHolder1], a ld a, l - ld [wce51], a + ld [wTurnHolder2], a ldh a, [hBankROM] push af - ld a, BANK(Func_8211) + ld a, BANK(_DrawYourOrOppPlayArea) call BankswitchROM - call Func_8211 + call _DrawYourOrOppPlayArea call DrawWideTextBox pop af call BankswitchROM ret -Func_30d7: ; 30d7 (0:30d7) +DrawPlayersPrizeAndBenchCards: ; 30d7 (0:30d7) ldh a, [hBankROM] push af - ld a, BANK(Func_833c) + ld a, BANK(_DrawPlayersPrizeAndBenchCards) call BankswitchROM - call Func_833c + call _DrawPlayersPrizeAndBenchCards pop af call BankswitchROM ret diff --git a/src/text/text2.asm b/src/text/text2.asm index 042dcd9..78fb6f9 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -1715,15 +1715,15 @@ Text023e: ; 3bbf8 (e:7bf8) text "No cards chosen." done -Text023f: ; 3bc0a (e:7c0a) +YourPokemonText: ; 3bc0a (e:7c0a) text "Your Pokémon" done -Text0240: ; 3bc18 (e:7c18) +YourDiscardPileText2: ; 3bc18 (e:7c18) text "Your Discard Pile" done -Text0241: ; 3bc2b (e:7c2b) +YourHandText: ; 3bc2b (e:7c2b) text "Your Hand" done @@ -1731,15 +1731,15 @@ Text0242: ; 3bc36 (e:7c36) text "To Your Play Area" done -Text0243: ; 3bc49 (e:7c49) +OpponentsPokemonText: ; 3bc49 (e:7c49) text "Opponent's Pokémon" done -Text0244: ; 3bc5d (e:7c5d) +OpponentsDiscardPileText2: ; 3bc5d (e:7c5d) text "Opponent's Discard Pile" done -Text0245: ; 3bc76 (e:7c76) +OpponentsHandText: ; 3bc76 (e:7c76) text "Opponent Hand" done @@ -1747,27 +1747,27 @@ Text0246: ; 3bc85 (e:7c85) text "To Opponent's Play Area" done -Text0247: ; 3bc9e (e:7c9e) +DuelistsPlayAreaText: ; 3bc9e (e:7c9e) text "<RAMNAME>'s Play Area" done -Text0248: ; 3bcad (e:7cad) +YourPlayAreaText: ; 3bcad (e:7cad) text "Your Play Area" done -Text0249: ; 3bcbd (e:7cbd) +OppPlayAreaText: ; 3bcbd (e:7cbd) text "Opp. Play Area" done -Text024a: ; 3bccd (e:7ccd) +InPlayAreaText: ; 3bccd (e:7ccd) text "In Play Area" done -Text024b: ; 3bcdb (e:7cdb) +GlossaryText: ; 3bcdb (e:7cdb) text "Glossary" done -Text024c: ; 3bce5 (e:7ce5) +WhichCardWouldYouLikeToSeeText: ; 3bce5 (e:7ce5) text "Which card would you like to see?" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index df61804..f1ca193 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -542,7 +542,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text021a ; 0x021a textpointer Text021b ; 0x021b textpointer Text021c ; 0x021c - textpointer EndText ; 0x021d + textpointer EndText ; 0x021d textpointer WhatIsYourNameText ; 0x021e textpointer Text021f ; 0x021f textpointer Text0220 ; 0x0220 @@ -576,25 +576,25 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text023c ; 0x023c textpointer Text023d ; 0x023d textpointer Text023e ; 0x023e - textpointer Text023f ; 0x023f - textpointer Text0240 ; 0x0240 - textpointer Text0241 ; 0x0241 + textpointer YourPokemonText ; 0x023f + textpointer YourDiscardPileText2 ; 0x0240 + textpointer YourHandText ; 0x0241 textpointer Text0242 ; 0x0242 - textpointer Text0243 ; 0x0243 - textpointer Text0244 ; 0x0244 - textpointer Text0245 ; 0x0245 + textpointer OpponentsPokemonText ; 0x0243 + textpointer OpponentsDiscardPileText2 ; 0x0244 + textpointer OpponentsHandText ; 0x0245 textpointer Text0246 ; 0x0246 - textpointer Text0247 ; 0x0247 - textpointer Text0248 ; 0x0248 - textpointer Text0249 ; 0x0249 - textpointer Text024a ; 0x024a - textpointer Text024b ; 0x024b - textpointer Text024c ; 0x024c + textpointer DuelistsPlayAreaText ; 0x0247 + textpointer YourPlayAreaText ; 0x0248 + textpointer OppPlayAreaText ; 0x0249 + textpointer InPlayAreaText ; 0x024a + textpointer GlossaryText ; 0x024b + textpointer WhichCardWouldYouLikeToSeeText ; 0x024c textpointer Text024d ; 0x024d - textpointer HandText_2 ; 0x024e - textpointer DuelistHandText_2 ; 0x024f - textpointer DuelistDiscardPileText ; 0x0250 - textpointer EmptyLineText ; 0x0251 + textpointer HandText_2 ; 0x024e + textpointer DuelistHandText_2 ; 0x024f + textpointer DuelistDiscardPileText ; 0x0250 + textpointer EmptyLineText ; 0x0251 textpointer Text0252 ; 0x0252 textpointer Text0253 ; 0x0253 textpointer Text0254 ; 0x0254 diff --git a/src/wram.asm b/src/wram.asm index 3af5361..3ded6e7 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -1283,22 +1283,46 @@ wTextBoxLabel:: ; ce4c wCoinTossScreenTextID:: ; ce4e ds $2 -wce50:: ; ce50 +; these hold either player or opponent turn +; for temporary calculations +wTurnHolder1:: ; ce50 ds $1 -wce51:: ; ce51 +wTurnHolder2:: ; ce51 ds $1 - ds $7 +; holds the position of the cursor +; when selecting a prize card +wPrizeCardCursorPosition:: + ds $1 + +wce53:: ; ce53 + ds $2 + +; same as wDuelInitialPrizes but +; with upper 2 bits set +wDuelInitialPrizesUpperBitsSet:: ; ce55 + ds $1 + + ds $3 wce59:: ; ce59 ds $1 - ds $4 + ds $3 + +; stores whether there are Pokemon in play area +; player arena Pokemon sets bit 0 +; opponent arena Pokemon sets bit 1 +wArenaCardsInPlayArea:: ; ce5d + ds $1 wce5e:: ; ce5e ds $1 +; this is used to store last cursor position +; in the Your Play Area screen +wLastCursorPosition_YourOrOppPlayArea:: ; ce5f ds $1 wce60:: ; ce60 @@ -1388,7 +1412,8 @@ wcea1:: ; cea1 ds $1 -wcea3:: ; cea3 +; used to blink the cursor in duel menu +wCheckMenuCursorBlinkCounter:: ; cea3 ds $1 wNamingScreenCursorY:: ; cea4 @@ -1406,10 +1431,10 @@ wceaa:: ; ceaa wceab:: ; ceab ds $4 -wceaf:: ; ceaf +wCheckMenuCursorXPosition:: ; ceaf ds $1 -wceb0:: ; ceb0 +wCheckMenuCursorYPosition:: ; ceb0 ds $1 wceb1:: ; ceb1 @@ -1427,7 +1452,15 @@ wceb4:: ; ceb4 wceb5:: ; ceb5 ds $1 - ds $5 +; used to store the tens digit and +; ones digit of a value for printing +; the ones digit is added $20 +; ceb6 = ones digit (+ $20) +; ceb7 = tens digit +wOnesAndTensPlace:: ; ceb6 + ds $2 + + ds $3 wcebb:: ; cebb ds $1 |