summaryrefslogtreecommitdiff
path: root/src/engine/menus
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2021-09-27 11:56:10 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2021-09-27 11:56:10 +0100
commit7825b5ef0f09a877142ea1eb221e895bb60a0253 (patch)
tree9d46dfebd219919f5144786caf3ebfdf7cdab3a7 /src/engine/menus
parent48f83527c769441b6c123f3382d90e2e962ef9a0 (diff)
Split bank 6
Diffstat (limited to 'src/engine/menus')
-rw-r--r--src/engine/menus/booster_pack.asm42
-rw-r--r--src/engine/menus/common.asm8
-rw-r--r--src/engine/menus/glossary.asm221
-rw-r--r--src/engine/menus/play_area.asm570
-rw-r--r--src/engine/menus/unknown.asm103
5 files changed, 940 insertions, 4 deletions
diff --git a/src/engine/menus/booster_pack.asm b/src/engine/menus/booster_pack.asm
new file mode 100644
index 0000000..934b730
--- /dev/null
+++ b/src/engine/menus/booster_pack.asm
@@ -0,0 +1,42 @@
+_OpenBoosterPack:
+ ld a, PLAYER_TURN
+ ldh [hWhoseTurn], a
+; clears DECK_SIZE bytes starting from wPlayerDuelVariables
+ ld h, a
+ ld l, $00
+.loop_clear
+ xor a
+ ld [hli], a
+ ld a, l
+ cp DECK_SIZE
+ jr c, .loop_clear
+
+; fills wDuelTempList with 0, 1, 2, 3, ...
+; up to the number of cards received in Boster Pack
+ xor a
+ ld hl, wBoosterCardsDrawn
+ ld de, wDuelTempList
+ ld c, $00
+.loop_index_sequence
+ ld a, [hli]
+ or a
+ jr z, .done_index_sequence
+ ld a, c
+ ld [de], a
+ inc de
+ inc c
+ jr .loop_index_sequence
+.done_index_sequence
+ ld a, $ff ; terminator byte
+ ld [de], a
+
+ lb de, $38, $9f
+ call SetupText
+ bank1call InitAndDrawCardListScreenLayout
+ ldtx hl, ChooseTheCardYouWishToExamineText
+ ldtx de, BoosterPackText
+ bank1call SetCardListHeaderText
+ ld a, A_BUTTON | START
+ ld [wNoItemSelectionMenuKeys], a
+ bank1call DisplayCardList
+ ret
diff --git a/src/engine/menus/common.asm b/src/engine/menus/common.asm
index 069d168..60ad0a9 100644
--- a/src/engine/menus/common.asm
+++ b/src/engine/menus/common.asm
@@ -19,8 +19,8 @@ DoCardPop:
farcall _DoCardPop
ret
-Func_7576:
- farcall Func_1991f
+AddStarterDeck:
+ farcall _AddStarterDeck
ret
PreparePrinterConnection:
@@ -43,8 +43,8 @@ SetUpAndStartLinkDuel:
farcall _SetUpAndStartLinkDuel
ret
-Func_7594:
- farcall Func_1a61f
+ShowPromotionalCardScreen:
+ farcall _ShowPromotionalCardScreen
ret
OpenBoosterPack:
diff --git a/src/engine/menus/glossary.asm b/src/engine/menus/glossary.asm
new file mode 100644
index 0000000..78f44dd
--- /dev/null
+++ b/src/engine/menus/glossary.asm
@@ -0,0 +1,221 @@
+OpenGlossaryScreen:
+ xor a
+ ld [wGlossaryPageNo], a
+ call .display_menu
+
+ xor a
+ ld [wInPlayAreaCurPosition], a
+ ld de, OpenGlossaryScreen_TransitionTable ; this data is stored in bank 2.
+ ld hl, wMenuInputTablePointer
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld a, $ff
+ ld [wDuelInitialPrizesUpperBitsSet], a
+ xor a
+ ld [wCheckMenuCursorBlinkCounter], a
+.next
+ ld a, $01
+ ld [wVBlankOAMCopyToggle], a
+ call DoFrame
+ ldh a, [hKeysPressed]
+ and SELECT
+ jr nz, .on_select
+
+ farcall YourOrOppPlayAreaScreen_HandleInput
+ jr nc, .next
+
+ cp -1 ; b button
+ jr nz, .check_button
+
+ farcall ZeroObjectPositionsWithCopyToggleOn
+ ret
+
+.check_button
+ push af
+ farcall ZeroObjectPositionsWithCopyToggleOn
+ pop af
+
+ cp $09 ; $09: next page or prev page
+ jr z, .change_page
+
+ call .print_description
+ call .display_menu
+ xor a
+ ld [wCheckMenuCursorBlinkCounter], a
+ jr .next
+
+.on_select
+ ld a, $01
+ farcall PlaySFXConfirmOrCancel
+.change_page
+ ld a, [wGlossaryPageNo]
+ xor $01 ; swap page
+ ld [wGlossaryPageNo], a
+ call .print_menu
+ jr .next
+
+; display glossary menu.
+.display_menu ; 1852b (6:452b)
+ xor a
+ ld [wTileMapFill], a
+ call ZeroObjectPositions
+ ld a, $01
+ ld [wVBlankOAMCopyToggle], a
+ call DoFrame
+ call EmptyScreen
+ call Set_OBJ_8x8
+ farcall LoadCursorTile
+
+ lb de, 5, 0
+ call InitTextPrinting
+ ldtx hl, PokemonCardGlossaryText
+ call ProcessTextFromID
+ call .print_menu
+ ldtx hl, ChooseWordAndPressAButtonText
+ call DrawWideTextBox_PrintText
+ ret
+
+; print texts in glossary menu.
+.print_menu ; 1855a (6:455a)
+ ld hl, wDefaultText
+
+ ld a, TX_SYMBOL
+ ld [hli], a
+
+ ld a, [wGlossaryPageNo]
+ add SYM_1
+ ld [hli], a
+
+ ld a, TX_SYMBOL
+ ld [hli], a
+
+ ld a, SYM_SLASH
+ ld [hli], a
+
+ ld a, TX_SYMBOL
+ ld [hli], a
+
+ ld a, SYM_2
+ ld [hli], a
+
+ ld [hl], TX_END
+
+ lb de, 16, 1
+ call InitTextPrinting
+ ld hl, wDefaultText
+ call ProcessText
+
+ lb de, 1, 3
+ call InitTextPrinting
+ ld a, [wGlossaryPageNo]
+ or a
+ jr nz, .page_two
+
+ ldtx hl, GlossaryMenuPage1Text
+ jr .page_one
+
+.page_two
+ ldtx hl, GlossaryMenuPage2Text
+.page_one
+ call ProcessTextFromID
+ ret
+
+; display glossary description.
+.print_description ; 18598 (6:4598)
+ push af
+ xor a
+ ld [wTileMapFill], a
+ call EmptyScreen
+ lb de, 5, 0
+ call InitTextPrinting
+ ldtx hl, PokemonCardGlossaryText
+ call ProcessTextFromID
+ lb de, 0, 4
+ lb bc, 20, 14
+ call DrawRegularTextBox
+
+ ld a, [wGlossaryPageNo]
+ or a
+ jr nz, .back_page
+
+ ld hl, GlossaryData1
+ jr .front_page
+
+.back_page
+ ld hl, GlossaryData2
+.front_page
+ pop af
+ ; hl += (a + (a << 2)).
+ ; that is,
+ ; hl += (5 * a).
+ ld c, a
+ ld b, 0
+ add hl, bc
+ sla a
+ sla a
+ ld c, a
+ add hl, bc
+ ld a, [hli]
+ push hl
+ ld d, a
+ ld e, $02
+ call InitTextPrinting
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call ProcessTextFromID
+ pop hl
+ lb de, 1, 5
+ call InitTextPrinting
+ inc hl
+ inc hl
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, $01
+ ld [wLineSeparation], a
+ call ProcessTextFromID
+ xor a
+ ld [wLineSeparation], a
+ call EnableLCD
+.loop
+ call DoFrame
+ ldh a, [hKeysPressed]
+ and B_BUTTON
+ jr z, .loop
+
+ ld a, -1
+ farcall PlaySFXConfirmOrCancel
+ ret
+
+; unit: 5 bytes.
+; [structure]
+; horizontal align (1) / title text id (2) / desc. text id (2)
+glossary_entry: MACRO
+ db \1
+ tx \2
+ tx \3
+ENDM
+
+GlossaryData1:
+ glossary_entry 7, AboutTheDeckText, DeckDescriptionText
+ glossary_entry 5, AboutTheDiscardPileText, DiscardPileDescriptionText
+ glossary_entry 7, AboutTheHandText, HandDescriptionText
+ glossary_entry 6, AboutTheArenaText, ArenaDescriptionText
+ glossary_entry 6, AboutTheBenchText, BenchDescriptionText
+ glossary_entry 4, AboutTheActivePokemonText, ActivePokemonDescriptionText
+ glossary_entry 5, AboutBenchPokemonText, BenchPokemonDescriptionText
+ glossary_entry 7, AboutPrizesText, PrizesDescriptionText
+ glossary_entry 5, AboutDamageCountersText, DamageCountersDescriptionText
+
+GlossaryData2:
+ glossary_entry 5, AboutEnergyCardsText, EnergyCardsDescriptionText
+ glossary_entry 5, AboutTrainerCardsText, TrainerCardsDescriptionText
+ glossary_entry 5, AboutBasicPokemonText, BasicPokemonDescriptionText
+ glossary_entry 5, AboutEvolutionCardsText, EvolutionCardsDescriptionText
+ glossary_entry 6, AboutAttackingText, AttackingDescriptionText
+ glossary_entry 5, AboutPokemonPowerText, PokemonPowerDescriptionText
+ glossary_entry 6, AboutWeaknessText, WeaknessDescriptionText
+ glossary_entry 6, AboutResistanceText, ResistanceDescriptionText
+ glossary_entry 6, AboutRetreatingText, RetreatingDescriptionText
diff --git a/src/engine/menus/play_area.asm b/src/engine/menus/play_area.asm
new file mode 100644
index 0000000..047d24f
--- /dev/null
+++ b/src/engine/menus/play_area.asm
@@ -0,0 +1,570 @@
+; this function is called when the player is shown the "In Play Area" screen.
+; it can be called with either the select button (DuelMenuShortcut_BothActivePokemon),
+; or via the "In Play Area" item of the Check menu (DuelCheckMenu_InPlayArea)
+OpenInPlayAreaScreen:
+ ld a, INPLAYAREA_PLAYER_ACTIVE
+ ld [wInPlayAreaCurPosition], a
+.start
+ xor a
+ ld [wCheckMenuCursorBlinkCounter], a
+ farcall DrawInPlayAreaScreen
+ call EnableLCD
+ call IsClairvoyanceActive
+ jr c, .clairvoyance_on
+
+ ld de, OpenInPlayAreaScreen_TransitionTable1
+ jr .clairvoyance_off
+
+.clairvoyance_on
+ ld de, OpenInPlayAreaScreen_TransitionTable2
+.clairvoyance_off
+ ld hl, wMenuInputTablePointer
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld a, [wInPlayAreaCurPosition]
+ call .print_associated_text
+.on_frame
+ ld a, $01
+ ld [wVBlankOAMCopyToggle], a
+ call DoFrame
+
+ ldh a, [hDPadHeld]
+ and START
+ jr nz, .selection
+
+ ; if this function's been called from 'select' button,
+ ; wInPlayAreaFromSelectButton is on.
+ ld a, [wInPlayAreaFromSelectButton]
+ or a
+ jr z, .handle_input ; if it's from the Check menu, jump.
+
+ ldh a, [hDPadHeld]
+ and SELECT
+ jr nz, .skip_input
+
+.handle_input
+ ld a, [wInPlayAreaCurPosition]
+ ld [wInPlayAreaTemporaryPosition], a
+ call OpenInPlayAreaScreen_HandleInput
+ jr c, .pressed
+
+ ld a, [wInPlayAreaCurPosition]
+ cp INPLAYAREA_PLAYER_PLAY_AREA
+ jp z, .show_turn_holder_play_area
+ cp INPLAYAREA_OPP_PLAY_AREA
+ jp z, .show_non_turn_holder_play_area
+
+ ; check if the cursor moved.
+ ld hl, wInPlayAreaTemporaryPosition
+ cp [hl]
+ call nz, .print_associated_text
+
+ jr .on_frame
+
+.pressed
+ cp -1
+ jr nz, .selection
+
+ ; pressed b button.
+ call ZeroObjectPositionsAndToggleOAMCopy_Bank6
+ lb de, $38, $9f
+ call SetupText
+ scf
+ ret
+
+.skip_input
+ call ZeroObjectPositionsAndToggleOAMCopy_Bank6
+ lb de, $38, $9f
+ call SetupText
+ or a
+ ret
+
+.selection ; pressed a button or start button.
+ call ZeroObjectPositionsAndToggleOAMCopy_Bank6
+ lb de, $38, $9f
+ call SetupText
+ ld a, [wInPlayAreaCurPosition]
+ ld [wInPlayAreaPreservedPosition], a
+ ld hl, .jump_table
+ call JumpToFunctionInTable
+ ld a, [wInPlayAreaPreservedPosition]
+ ld [wInPlayAreaCurPosition], a
+
+ jp .start
+
+.print_associated_text ; 18171 (6:4171)
+; each position has a text associated to it,
+; which is printed at the bottom of the screen
+ push af
+ lb de, 1, 17
+ call InitTextPrinting
+ ldtx hl, EmptyLineText
+ call ProcessTextFromID
+
+ ld hl, hffb0
+ ld [hl], $01
+ ldtx hl, HandText_2
+ call ProcessTextFromID
+
+ ld hl, hffb0
+ ld [hl], $00
+ lb de, 1, 17
+ call InitTextPrinting
+ pop af
+ ld hl, OpenInPlayAreaScreen_TextTable
+ ld b, 0
+ sla a
+ ld c, a
+ add hl, bc
+
+ ; hl = OpenInPlayAreaScreen_TextTable + 2 * (wInPlayAreaCurPosition)
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, h
+
+ ; jump ahead if entry does not contain null text (it's not active pokemon)
+ or a
+ jr nz, .print_hand_or_discard_pile
+
+ ld a, l
+ ; bench slots have dummy text IDs assigned to them, which are never used.
+ ; these are secretly not text id's, but rather, 2-byte PLAY_AREA_BENCH_* constants
+ ; check if the value at register l is one of those, and jump ahead if not
+ cp PLAY_AREA_BENCH_5 + $01
+ jr nc, .print_hand_or_discard_pile
+
+; if we make it here, we need to print a Pokemon card name.
+; wInPlayAreaCurPosition determines which duelist
+; and l contains the PLAY_AREA_* location of the card.
+ ld a, [wInPlayAreaCurPosition]
+ cp INPLAYAREA_PLAYER_HAND
+ jr nc, .opponent_side
+
+ ld a, l
+ add DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ cp -1
+ ret z
+
+ call GetCardIDFromDeckIndex
+ call LoadCardDataToBuffer1_FromCardID
+ jr .display_card_name
+
+.opponent_side
+ ld a, l
+ add DUELVARS_ARENA_CARD
+ call GetNonTurnDuelistVariable
+ cp -1
+ ret z
+
+ call SwapTurn
+ call GetCardIDFromDeckIndex
+ call LoadCardDataToBuffer1_FromCardID
+ call SwapTurn
+
+.display_card_name
+ ld a, 18
+ call CopyCardNameAndLevel
+ ld hl, wDefaultText
+ call ProcessText
+ ret
+
+.print_hand_or_discard_pile
+; if we make it here, cursor position is to Hand or Discard Pile
+; so DuelistHandText_2 or DuelistDiscardPileText will be printed
+
+ ld a, [wInPlayAreaCurPosition]
+ cp INPLAYAREA_OPP_ACTIVE
+ jr nc, .opp_side_print_hand_or_discard_pile
+ call PrintTextNoDelay
+ ret
+
+.opp_side_print_hand_or_discard_pile
+ call SwapTurn
+ call PrintTextNoDelay
+ call SwapTurn
+ ret
+
+.show_turn_holder_play_area
+ lb de, $38, $9f
+ call SetupText
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenTurnHolderPlayAreaScreen
+ pop af
+ ldh [hWhoseTurn], a
+ ld a, [wInPlayAreaPreservedPosition]
+ ld [wInPlayAreaCurPosition], a
+ jp .start
+
+.show_non_turn_holder_play_area
+ lb de, $38, $9f
+ call SetupText
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenNonTurnHolderPlayAreaScreen
+ pop af
+ ldh [hWhoseTurn], a
+ ld a, [wInPlayAreaPreservedPosition]
+ ld [wInPlayAreaCurPosition], a
+ jp .start
+
+.jump_table ; (6:4228)
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x00: INPLAYAREA_PLAYER_BENCH_1
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x01: INPLAYAREA_PLAYER_BENCH_2
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x02: INPLAYAREA_PLAYER_BENCH_3
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x03: INPLAYAREA_PLAYER_BENCH_4
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x04: INPLAYAREA_PLAYER_BENCH_5
+ dw OpenInPlayAreaScreen_TurnHolderPlayArea ; 0x05: INPLAYAREA_PLAYER_ACTIVE
+ dw OpenInPlayAreaScreen_TurnHolderHand ; 0x06: INPLAYAREA_PLAYER_HAND
+ dw OpenInPlayAreaScreen_TurnHolderDiscardPile ; 0x07: INPLAYAREA_PLAYER_DISCARD_PILE
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x08: INPLAYAREA_OPP_ACTIVE
+ dw OpenInPlayAreaScreen_NonTurnHolderHand ; 0x09: INPLAYAREA_OPP_HAND
+ dw OpenInPlayAreaScreen_NonTurnHolderDiscardPile ; 0x0a: INPLAYAREA_OPP_DISCARD_PILE
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0b: INPLAYAREA_OPP_BENCH_1
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0c: INPLAYAREA_OPP_BENCH_2
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0d: INPLAYAREA_OPP_BENCH_3
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0e: INPLAYAREA_OPP_BENCH_4
+ dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; 0x0f: INPLAYAREA_OPP_BENCH_5
+
+OpenInPlayAreaScreen_TurnHolderPlayArea:
+ ; wInPlayAreaCurPosition constants conveniently map to (PLAY_AREA_* constants - 1)
+ ; for bench locations. this mapping is taken for granted in the following code.
+ ld a, [wInPlayAreaCurPosition]
+ inc a
+ cp INPLAYAREA_PLAYER_ACTIVE + $01
+ jr nz, .on_bench
+ xor a ; PLAY_AREA_ARENA
+.on_bench
+ ld [wCurPlayAreaSlot], a
+ add DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ cp -1
+ ret z
+ call GetCardIDFromDeckIndex
+ call LoadCardDataToBuffer1_FromCardID
+ xor a
+ ld [wCurPlayAreaY], a
+ bank1call OpenCardPage_FromCheckPlayArea
+ ret
+
+OpenInPlayAreaScreen_NonTurnHolderPlayArea:
+ ld a, [wInPlayAreaCurPosition]
+ sub INPLAYAREA_OPP_ACTIVE
+ or a
+ jr z, .active
+ ; convert INPLAYAREA_OPP_BENCH_* constant to PLAY_AREA_BENCH_* constant
+ sub INPLAYAREA_OPP_BENCH_1 - INPLAYAREA_OPP_ACTIVE - PLAY_AREA_BENCH_1
+.active
+ ld [wCurPlayAreaSlot], a
+ add DUELVARS_ARENA_CARD
+ call GetNonTurnDuelistVariable
+ cp -1
+ ret z
+ call SwapTurn
+ call GetCardIDFromDeckIndex
+ call LoadCardDataToBuffer1_FromCardID
+ xor a
+ ld [wCurPlayAreaY], a
+ bank1call OpenCardPage_FromCheckPlayArea
+ call SwapTurn
+ ret
+
+OpenInPlayAreaScreen_TurnHolderHand:
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenTurnHolderHandScreen_Simple
+ pop af
+ ldh [hWhoseTurn], a
+ ret
+
+OpenInPlayAreaScreen_NonTurnHolderHand:
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenNonTurnHolderHandScreen_Simple
+ pop af
+ ldh [hWhoseTurn], a
+ ret
+
+OpenInPlayAreaScreen_TurnHolderDiscardPile:
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenTurnHolderDiscardPileScreen
+ pop af
+ ldh [hWhoseTurn], a
+ ret
+
+OpenInPlayAreaScreen_NonTurnHolderDiscardPile:
+ ldh a, [hWhoseTurn]
+ push af
+ bank1call OpenNonTurnHolderDiscardPileScreen
+ pop af
+ ldh [hWhoseTurn], a
+ ret
+
+OpenInPlayAreaScreen_TextTable:
+; note that for bench slots, the entries are
+; PLAY_AREA_BENCH_* constants in practice
+ tx HandText ; INPLAYAREA_PLAYER_BENCH_1
+ tx CheckText ; INPLAYAREA_PLAYER_BENCH_2
+ tx AttackText ; INPLAYAREA_PLAYER_BENCH_3
+ tx PKMNPowerText ; INPLAYAREA_PLAYER_BENCH_4
+ tx DoneText ; INPLAYAREA_PLAYER_BENCH_5
+ dw NULL ; INPLAYAREA_PLAYER_ACTIVE
+ tx DuelistHandText_2 ; INPLAYAREA_PLAYER_HAND
+ tx DuelistDiscardPileText ; INPLAYAREA_PLAYER_DISCARD_PILE
+ dw NULL ; INPLAYAREA_OPP_ACTIVE
+ tx DuelistHandText_2 ; INPLAYAREA_OPP_HAND
+ tx DuelistDiscardPileText ; INPLAYAREA_OPP_DISCARD_PILE
+ tx HandText ; INPLAYAREA_OPP_BENCH_1
+ tx CheckText ; INPLAYAREA_OPP_BENCH_2
+ tx AttackText ; INPLAYAREA_OPP_BENCH_3
+ tx PKMNPowerText ; INPLAYAREA_OPP_BENCH_4
+ tx DoneText ; INPLAYAREA_OPP_BENCH_5
+
+in_play_area_cursor_transition: MACRO
+ cursor_transition \1, \2, \3, INPLAYAREA_\4, INPLAYAREA_\5, INPLAYAREA_\6, INPLAYAREA_\7
+ENDM
+
+; it's related to wMenuInputTablePointer.
+; with this table, the cursor moves into the proper location by the input.
+; note that the unit of the position is not a 8x8 tile.
+OpenInPlayAreaScreen_TransitionTable1:
+ in_play_area_cursor_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5
+ in_play_area_cursor_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1
+ in_play_area_cursor_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2
+ in_play_area_cursor_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3
+ in_play_area_cursor_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4
+ in_play_area_cursor_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE
+ in_play_area_cursor_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE
+ in_play_area_cursor_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE
+ in_play_area_cursor_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE
+ in_play_area_cursor_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
+ in_play_area_cursor_transition $30, $38, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
+ in_play_area_cursor_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
+ in_play_area_cursor_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
+ in_play_area_cursor_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
+ in_play_area_cursor_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
+ in_play_area_cursor_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
+
+OpenInPlayAreaScreen_TransitionTable2:
+ in_play_area_cursor_transition $18, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_2, PLAYER_BENCH_5
+ in_play_area_cursor_transition $30, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_3, PLAYER_BENCH_1
+ in_play_area_cursor_transition $48, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_4, PLAYER_BENCH_2
+ in_play_area_cursor_transition $60, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_5, PLAYER_BENCH_3
+ in_play_area_cursor_transition $78, $8c, $00, PLAYER_ACTIVE, PLAYER_PLAY_AREA, PLAYER_BENCH_1, PLAYER_BENCH_4
+ in_play_area_cursor_transition $30, $6c, $00, OPP_ACTIVE, PLAYER_BENCH_1, PLAYER_DISCARD_PILE, PLAYER_DISCARD_PILE
+ in_play_area_cursor_transition $78, $80, $00, PLAYER_DISCARD_PILE, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_ACTIVE
+ in_play_area_cursor_transition $78, $70, $00, OPP_ACTIVE, PLAYER_HAND, PLAYER_ACTIVE, PLAYER_ACTIVE
+ in_play_area_cursor_transition $78, $34, 1 << OAM_X_FLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE
+ in_play_area_cursor_transition $30, $20, 1 << OAM_X_FLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
+ in_play_area_cursor_transition $30, $38, 1 << OAM_X_FLIP, OPP_HAND, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
+ in_play_area_cursor_transition $90, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
+ in_play_area_cursor_transition $78, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
+ in_play_area_cursor_transition $60, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
+ in_play_area_cursor_transition $48, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
+ in_play_area_cursor_transition $30, $14, 1 << OAM_X_FLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
+
+OpenInPlayAreaScreen_HandleInput:
+ xor a
+ ld [wPlaysSfx], a
+ ld hl, wMenuInputTablePointer
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ld a, [wInPlayAreaCurPosition]
+ ld l, a
+ ld h, $07
+ call HtimesL
+ add hl, de
+
+ ldh a, [hDPadHeld]
+ or a
+ jp z, .check_button
+
+ inc hl
+ inc hl
+ inc hl
+
+ ; check d-pad
+ bit D_UP_F, a
+ jr z, .else_if_down
+
+ ; up
+ ld a, [hl]
+ jr .process_dpad
+
+.else_if_down
+ inc hl
+ bit D_DOWN_F, a
+ jr z, .else_if_right
+
+ ; down
+ ld a, [hl]
+ jr .process_dpad
+
+.else_if_right
+ inc hl
+ bit D_RIGHT_F, a
+ jr z, .else_if_left
+
+ ; right
+ ld a, [hl]
+ jr .process_dpad
+
+.else_if_left
+ inc hl
+ bit D_LEFT_F, a
+ jr z, .check_button
+
+ ; left
+ ld a, [hl]
+.process_dpad
+ push af
+ ld a, [wInPlayAreaCurPosition]
+ ld [wInPlayAreaPreservedPosition], a
+ pop af
+
+ ld [wInPlayAreaCurPosition], a
+ cp INPLAYAREA_PLAYER_ACTIVE
+ jr c, .player_area
+ cp INPLAYAREA_OPP_BENCH_1
+ jr c, .next
+ cp INPLAYAREA_PLAYER_PLAY_AREA
+ jr c, .opponent_area
+
+ jr .next
+
+.player_area
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ dec a
+ jr nz, .bench_pokemon_exists
+
+ ; no pokemon in player's bench.
+ ; then move to player's play area.
+ ld a, INPLAYAREA_PLAYER_PLAY_AREA
+ ld [wInPlayAreaCurPosition], a
+ jr .next
+
+.bench_pokemon_exists
+ ld b, a
+ ld a, [wInPlayAreaCurPosition]
+ cp b
+ jr c, .next
+
+ ; handle index overflow
+ ldh a, [hDPadHeld]
+ bit D_RIGHT_F, a
+ jr z, .on_left
+
+ xor a
+ ld [wInPlayAreaCurPosition], a
+ jr .next
+
+.on_left
+ ld a, b
+ dec a
+ ld [wInPlayAreaCurPosition], a
+ jr .next
+
+.opponent_area
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetNonTurnDuelistVariable
+ dec a
+ jr nz, .bench_pokemon_exists_2
+
+ ld a, INPLAYAREA_OPP_PLAY_AREA
+ ld [wInPlayAreaCurPosition], a
+ jr .next
+
+.bench_pokemon_exists_2
+ ld b, a
+ ld a, [wInPlayAreaCurPosition]
+ sub INPLAYAREA_OPP_BENCH_1
+ cp b
+ jr c, .next
+
+ ldh a, [hDPadHeld]
+ bit D_LEFT_F, a
+ jr z, .on_right
+
+ ld a, INPLAYAREA_OPP_BENCH_1
+ ld [wInPlayAreaCurPosition], a
+ jr .next
+
+.on_right
+ ld a, b
+ add INPLAYAREA_OPP_DISCARD_PILE
+ ld [wInPlayAreaCurPosition], a
+.next
+ ld a, $01
+ ld [wPlaysSfx], a
+ xor a
+ ld [wCheckMenuCursorBlinkCounter], a
+.check_button
+ ldh a, [hKeysPressed]
+ and A_BUTTON | B_BUTTON
+ jr z, .return
+
+ and A_BUTTON
+ jr nz, .a_button
+
+ ; pressed b button
+ ld a, -1
+ farcall PlaySFXConfirmOrCancel
+ scf
+ ret
+
+.a_button
+ call .draw_cursor
+ ld a, $01
+ farcall PlaySFXConfirmOrCancel
+ ld a, [wInPlayAreaCurPosition]
+ scf
+ ret
+
+.return
+ ld a, [wPlaysSfx]
+ or a
+ jr z, .skip_sfx
+ call PlaySFX
+.skip_sfx
+ ld hl, wCheckMenuCursorBlinkCounter
+ ld a, [hl]
+ inc [hl]
+ and $10 - 1
+ ret nz
+
+ bit 4, [hl] ; = and $10
+ jr nz, ZeroObjectPositionsAndToggleOAMCopy_Bank6
+
+.draw_cursor ; 184a0 (6:44a0)
+ call ZeroObjectPositions
+ ld hl, wMenuInputTablePointer
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ld a, [wInPlayAreaCurPosition]
+ ld l, a
+ ld h, $07
+ call HtimesL
+ add hl, de
+
+ ld d, [hl] ; x position.
+ inc hl
+ ld e, [hl] ; y position.
+ inc hl
+ ld b, [hl] ; attribute.
+ ld c, $00
+ call SetOneObjectAttributes
+ or a
+ ret
+
+ZeroObjectPositionsAndToggleOAMCopy_Bank6:
+ call ZeroObjectPositions
+ ld a, $01
+ ld [wVBlankOAMCopyToggle], a
+ ret
diff --git a/src/engine/menus/unknown.asm b/src/engine/menus/unknown.asm
new file mode 100644
index 0000000..c6f04fa
--- /dev/null
+++ b/src/engine/menus/unknown.asm
@@ -0,0 +1,103 @@
+Func_18661: ; unreferenced
+ xor a
+ ld [wPlaysSfx], a
+ ld a, [wCheckMenuCursorXPosition]
+ ld d, a
+ ld a, [wCheckMenuCursorYPosition]
+ ld e, a
+ ldh a, [hDPadHeld]
+ or a
+ jr z, .check_button
+; check input from dpad
+ bit D_LEFT_F, a
+ jr nz, .left_or_right
+ bit D_RIGHT_F, a
+ jr z, .check_up_and_down
+.left_or_right
+; swap the lsb of x position value.
+ ld a, d
+ xor $1
+ ld d, a
+ jr .cursor_moved
+
+.check_up_and_down
+ bit D_UP_F, a
+ jr nz, .up_or_down
+ bit D_DOWN_F, a
+ jr z, .check_button
+.up_or_down
+ ld a, e
+ xor $1
+ ld e, a
+.cursor_moved
+ ld a, $1
+ ld [wPlaysSfx], a
+ push de
+ call .draw_blank_cursor
+ pop de
+ ld a, d
+ ld [wCheckMenuCursorXPosition], a
+ ld a, e
+ ld [wCheckMenuCursorYPosition], a
+ xor a
+ ld [wCheckMenuCursorBlinkCounter], a
+.check_button
+ ldh a, [hKeysPressed]
+ and A_BUTTON | B_BUTTON
+ jr z, .check_cursor_moved
+ and A_BUTTON
+ jr nz, .a_button
+
+; b button
+ ld a, -1
+ call Func_190fb
+ scf
+ ret
+
+; a button
+.a_button
+ call .draw_cursor
+ ld a, 1
+ call Func_190fb
+ scf
+ ret
+
+.check_cursor_moved
+ ld a, [wPlaysSfx]
+ or a
+ jr z, .check_cursor_blink
+ call PlaySFX
+.check_cursor_blink
+ ld hl, wCheckMenuCursorBlinkCounter
+ ld a, [hl]
+ inc [hl]
+ and %00001111
+ ret nz
+ ld a, SYM_CURSOR_R
+ bit D_RIGHT_F, [hl]
+ jr z, .draw_tile
+.draw_blank_cursor ; 186d4 (6:46d4)
+ ld a, SYM_SPACE
+.draw_tile
+ ld e, a
+ ld a, 10
+ ld l, a
+ ld a, [wCheckMenuCursorXPosition]
+ ld h, a
+ call HtimesL
+ ld a, l
+ add 1
+ ld b, a
+ ld a, [wCheckMenuCursorYPosition]
+ sla a
+ add 14
+ ld c, a
+ ld a, e
+ ; b = 11, c = y_pos * 2 + 14
+ ; h = x_pos * 10, l = 10
+ call WriteByteToBGMap0
+ or a
+ ret
+.draw_cursor ; 186f3 (6:46f3)
+ ld a, SYM_CURSOR_R
+ jr .draw_tile