Disassemble duel menus

mostly the same as in tcg1
This commit is contained in:
earthoul
2026-03-20 15:48:58 +09:00
parent 171981661c
commit 309f0b3052
11 changed files with 1747 additions and 82 deletions

View File

@@ -5,6 +5,7 @@ DEF MAX_HP EQU 120
DEF HP_BAR_LENGTH EQU MAX_HP / 10
DEF STARTING_HAND_SIZE EQU 7
DEF MAX_PRIZE_CARDS EQU 6
; coin result constants
DEF TAILS EQU 0

View File

@@ -50,3 +50,61 @@ DEF CHECK_PLAY_AREA EQU $0a
;NONE EQU $00
DEF PLAY_CHECK EQU $01
DEF SELECT_CHECK EQU $02
; play area screen constants
DEF DUELIST_PLAYER EQU $0
DEF DUELIST_OPPONENT EQU $1
DEF ARENA_CARD_PLAYER EQU 1 << DUELIST_PLAYER ; $1
DEF ARENA_CARD_OPPONENT EQU 1 << DUELIST_OPPONENT ; $2
const_def 6 ; PLAY_AREA_BENCH_5 + PRIZES_1
const INPLAYAREA_PRIZE_1 ; $6
const INPLAYAREA_PRIZE_2 ; $7
const INPLAYAREA_PRIZE_3 ; $8
const INPLAYAREA_PRIZE_4 ; $9
const INPLAYAREA_PRIZE_5 ; $a
const INPLAYAREA_PRIZE_6 ; $b
const_def
const PLAYAREA_PLAYER_POKEMON ; $0
const PLAYAREA_PLAYER_HAND ; $1
const PLAYAREA_PLAYER_DISCARD_PILE ; $2
const PLAYAREA_PLAYER_PRIZES ; $3
const PLAYAREA_OPPONENT_POKEMON ; $4
const PLAYAREA_OPPONENT_HAND ; $5
const PLAYAREA_OPPONENT_DISCARD_PILE ; $6
const PLAYAREA_OPPONENT_PRIZES ; $7
const_def
const INPLAYAREA_PLAYER_BENCH_1 ; $00
const INPLAYAREA_PLAYER_BENCH_2 ; $01
const INPLAYAREA_PLAYER_BENCH_3 ; $02
const INPLAYAREA_PLAYER_BENCH_4 ; $03
const INPLAYAREA_PLAYER_BENCH_5 ; $04
const INPLAYAREA_PLAYER_ACTIVE ; $05
const INPLAYAREA_PLAYER_HAND ; $06
const INPLAYAREA_PLAYER_DISCARD_PILE ; $07
const INPLAYAREA_OPP_ACTIVE ; $08
const INPLAYAREA_OPP_HAND ; $09
const INPLAYAREA_OPP_DISCARD_PILE ; $0a
const INPLAYAREA_OPP_BENCH_1 ; $0b
const INPLAYAREA_OPP_BENCH_2 ; $0c
const INPLAYAREA_OPP_BENCH_3 ; $0d
const INPLAYAREA_OPP_BENCH_4 ; $0e
const INPLAYAREA_OPP_BENCH_5 ; $0f
const INPLAYAREA_PLAYER_PRIZE_1 ; $10
const INPLAYAREA_PLAYER_PRIZE_2 ; $11
const INPLAYAREA_PLAYER_PRIZE_3 ; $12
const INPLAYAREA_PLAYER_PRIZE_4 ; $13
const INPLAYAREA_PLAYER_PRIZE_5 ; $14
const INPLAYAREA_PLAYER_PRIZE_6 ; $15
const INPLAYAREA_OPP_PRIZE_1 ; $16
const INPLAYAREA_OPP_PRIZE_2 ; $17
const INPLAYAREA_OPP_PRIZE_3 ; $18
const INPLAYAREA_OPP_PRIZE_4 ; $19
const INPLAYAREA_OPP_PRIZE_5 ; $1a
const INPLAYAREA_OPP_PRIZE_6 ; $1b
DEF NUM_INPLAYAREA_POSITIONS EQU const_value
const_def $80
const INPLAYAREA_PLAYER_PLAY_AREA ; $80
const INPLAYAREA_OPP_PLAY_AREA ; $81

View File

@@ -142,6 +142,20 @@ DEF NUM_COIN_PAGES EQU const_value
DEF MENU_CANCEL EQU -1
DEF MENU_CONFIRM EQU 1 ; != -1, but uses 1 most of the time
; cursor
; cursor_transition macro args
RSRESET
DEF CURSOR_TRANSITION_STRUCT_X RB ; 0
DEF CURSOR_TRANSITION_STRUCT_Y RB ; 1
DEF CURSOR_TRANSITION_STRUCT_ATTR RB ; 2
DEF CURSOR_TRANSITION_STRUCT_DIR_INDICES EQU _RS
DEF CURSOR_TRANSITION_STRUCT_INDEX_UP RB ; 3
DEF CURSOR_TRANSITION_STRUCT_INDEX_DOWN RB ; 4
DEF CURSOR_TRANSITION_STRUCT_INDEX_RIGHT RB ; 5
DEF CURSOR_TRANSITION_STRUCT_INDEX_LEFT RB ; 6
DEF CURSOR_TRANSITION_STRUCT_LENGTH EQU _RS ; 7
; filter types for CardTypeFilters
; used to categorise the different cards
; i.e. in the deck building screen

View File

@@ -451,9 +451,22 @@ DuelMenuShortcut_PlayerDiscardPile:
call OpenTurnHolderDiscardPileScreen
jp c, PrintDuelMenuAndHandleInput
jp DuelMainInterface
; 0x439d
SECTION "Bank 1@43be", ROMX[$43be], BANK[$1]
OpenNonTurnHolderPrizeCardsScreen:
call SwapTurn
call OpenTurnHolderPrizeCardsScreen
call SwapTurn
ret
OpenTurnHolderPrizeCardsScreen:
call CreatePrizeCardList
call InitAndDrawCardListScreenLayout
ldtx hl, ChooseCardToCheckText
ldtx de, DuelistPrizeCardsText
call SetCardListHeaderAndInfoText
ld a, PAD_A | PAD_START
ld [wNoItemSelectionMenuKeys], a
jp DisplayCardList
; draw the non-turn holder's play area screen
OpenNonTurnHolderPlayAreaScreen:
@@ -493,7 +506,7 @@ OpenTurnHolderHandScreen_Simple:
jp DrawWideTextBox_WaitForInput
.got_cards_in_hand
call InitAndDrawCardListScreenLayout
ld a, PAD_START + PAD_A
ld a, PAD_A | PAD_START
ld [wNoItemSelectionMenuKeys], a
jp DisplayCardList
@@ -2563,7 +2576,7 @@ OpenDiscardPileScreen:
ldtx hl, ChooseCardToCheckText
ldtx de, DuelistDiscardPileText
call SetCardListHeaderAndInfoText
ld a, PAD_START + PAD_A
ld a, PAD_A | PAD_START
ld [wNoItemSelectionMenuKeys], a
call DisplayCardList
or a
@@ -3093,7 +3106,7 @@ TurnDuelistTakePrizes:
ld h, $00
call LoadTxRam3
.asm_587e
farcall Func_82b6
farcall Func_83b3
ldtx hl, DrewXPrizesText
call DrawWideTextBox_WaitForInput
jr .return_has_prizes
@@ -3345,7 +3358,7 @@ CardPageSwitch_TrainerEnd:
ZeroObjectPositionsAndToggleOAMCopy:
call ZeroObjectPositions
ld a, $01
ld a, TRUE
ld [wVBlankOAMCopyToggle], a
ret
; 0x5647
@@ -4080,7 +4093,7 @@ _HasAlivePokemonInPlayArea:
ret
OpenPlayAreaScreenForViewing:
ld a, PAD_START + PAD_A
ld a, PAD_A | PAD_START
jr DisplayPlayAreaScreen
OpenPlayAreaScreenForSelection:
@@ -6831,9 +6844,28 @@ ShuffleDeck:
ld a, b ; a = number of cards in the deck
call ShuffleCards
ret
; 0x6a7c
SECTION "Bank 1@6a96", ROMX[$6a96], BANK[$1]
CreatePrizeCardList:
ld a, DUELVARS_PRIZES
get_turn_duelist_var
ld c, a
ld l, DUELVARS_PRIZE_CARDS
ld de, wDuelTempList
.loop_cards
ld b, [hl]
inc hl
rr c
jr nc, .next_card
ld a, b
ld [de], a
inc de
.next_card
ld a, c
or a
jr nz, .loop_cards
ld a, $ff ; terminating byte
ld [de], a
ret
SortCardsInDuelTempListByID:
ld hl, hTempListPtr_ff99

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
SECTION "Bank 6@46a6", ROMX[$46a6], BANK[$6]
INCLUDE "engine/play_area_menu.asm"
INCLUDE "engine/glossary.asm"
; 0x1897e
@@ -5347,7 +5347,7 @@ DisplayBoosterContent:
ldtx hl, ChooseCardToCheckText
ldtx de, BoosterPackCardsText
bank1call SetCardListHeaderAndInfoText
ld a, PAD_START + PAD_A
ld a, PAD_A | PAD_START
ld [wNoItemSelectionMenuKeys], a
bank1call DisplayCardList
ret

View File

@@ -4538,7 +4538,7 @@ Poltergeist_10DamagePerTrainerEffect:
ldtx hl, ChooseCardToCheckText
ldtx de, DuelistHandText
bank1call SetCardListHeaderAndInfoText
ld a, PAD_START + PAD_A
ld a, PAD_A | PAD_START
ld [wNoItemSelectionMenuKeys], a
bank1call DisplayCardList

View File

@@ -5,6 +5,8 @@ Glossary:
lb de, $38, $9f
call SetupText
jr .asm_186ba
.OpenScreen
ld a, $01
ld [wd0d2], a
@@ -62,7 +64,7 @@ Glossary:
xor a
ld de, GlossaryTransitionTable_10Topics
.got_transition_table
ld [wd0c1], a
ld [wMultiDirectionalMenuCursorPosition], a
ld hl, wTransitionTablePtr
ld [hl], e
inc hl
@@ -83,13 +85,13 @@ Glossary:
jr nc, .topic_menu
cp $ff
jr nz, .selected_topic
farcall ZeroObjectPositionsWithCopyToggleOn
farcall ZeroObjectPositionsAndToggleOAMCopy_Bank02
ldh a, [hCurScrollMenuItem]
jp .main_menu
.selected_topic
push af
farcall ZeroObjectPositionsWithCopyToggleOn
farcall ZeroObjectPositionsAndToggleOAMCopy_Bank02
pop af
call .ShowExplanation
call .ShowMenuContent

View File

@@ -0,0 +1,755 @@
; accessed from select btn (DuelMenuShortcut_BothActivePokemon)
; or from check menu (DuelCheckMenu_InPlayArea)
OpenInPlayAreaScreen::
ld a, INPLAYAREA_PLAYER_ACTIVE
ld [wMultiDirectionalMenuCursorPosition], a
.start
xor a
ld [wScrollMenuCursorBlinkCounter], a
farcall DrawInPlayAreaScreen
call EnableLCD
bank1call IsClairvoyanceActive
jr c, .clairvoyance_on
ld a, [wPrizeCardsFaceUp]
or a
jr z, .default
; here comes team rocket on
ld de, OpenInPlayAreaScreen_TransitionTable_WithPrizes
jr .got_transition_table
.default
ld de, OpenInPlayAreaScreen_TransitionTable
jr .got_transition_table
.clairvoyance_on
ld de, OpenInPlayAreaScreen_TransitionTable_WithHand
.got_transition_table
ld hl, wTransitionTablePtr
ld [hl], e
inc hl
ld [hl], d
ld a, [wMultiDirectionalMenuCursorPosition]
call .PrintAssociatedText
.on_frame
ld a, TRUE
ld [wVBlankOAMCopyToggle], a
call DoFrame
ldh a, [hDPadHeld]
and PAD_START
jr nz, .selection
; handle input if called from check menu
; skip input if called from select btn
ld a, [wInPlayAreaFromSelectButton]
or a
jr z, .handle_input
ldh a, [hDPadHeld]
and PAD_SELECT
jr nz, .skip_input
.handle_input
ld a, [wMultiDirectionalMenuCursorPosition]
ld [wTempInPlayAreaCursorPosition], a
call OpenInPlayAreaScreen_HandleInput
jr c, .pressed
ld a, [wMultiDirectionalMenuCursorPosition]
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
ld hl, wTempInPlayAreaCursorPosition
cp [hl]
call nz, .PrintAssociatedText
jr .on_frame
.pressed
cp MENU_CANCEL
jr nz, .selection
; cancelled
call ZeroObjectPositionsAndToggleOAMCopy_Bank06
lb de, $38, $9f
call SetupText
scf
ret
.skip_input
call ZeroObjectPositionsAndToggleOAMCopy_Bank06
lb de, $38, $9f
call SetupText
or a
ret
.selection
call ZeroObjectPositionsAndToggleOAMCopy_Bank06
xor a
ld [wd0d2], a
ld a, [wMultiDirectionalMenuCursorPosition]
ld [wPreservedInPlayAreaCursorPosition], a
ld hl, .PositionsJumpTable
call JumpToFunctionInTable
ld a, [wd0d2]
or a
jr nz, .on_frame
ld a, [wPreservedInPlayAreaCursorPosition]
ld [wMultiDirectionalMenuCursorPosition], a
jp .start
.PrintAssociatedText:
push af
lb de, 1, 17
call InitTextPrinting
ldtx hl, EmptyLineText
call ProcessTextFromID
ld hl, hffbb
ld [hl], $01
ldtx hl, HandText_2
call ProcessTextFromID
ld hl, hffbb
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
ld a, [hli]
ld h, [hl]
ld l, a
ld a, h
or a
jr nz, .hand_or_discard_pile
ld a, l
cp MAX_PLAY_AREA_POKEMON + MAX_PRIZE_CARDS
jr nc, .hand_or_discard_pile
cp MAX_PLAY_AREA_POKEMON
jr nc, .prize_cards
ld a, [wMultiDirectionalMenuCursorPosition]
cp INPLAYAREA_PLAYER_HAND
jr nc, .opponent_side
ld a, l
add DUELVARS_ARENA_CARD
get_turn_duelist_var
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
.prize_cards
sub INPLAYAREA_PRIZE_1
ld b, a
ld a, [wMultiDirectionalMenuCursorPosition]
cp INPLAYAREA_OPP_PRIZE_1
jr nc, .opp_side_prize_cards
push bc
ld a, b
call IsCurPrizeCardRemaining
pop bc
ret z
ld a, b
add DUELVARS_PRIZE_CARDS
get_turn_duelist_var
call GetCardIDFromDeckIndex
call LoadCardDataToBuffer1_FromCardID
jr .display_card_name
.opp_side_prize_cards
push bc
ld a, b
call SwapTurn
call IsCurPrizeCardRemaining
call SwapTurn
pop bc
ret z
ld a, b
add DUELVARS_PRIZE_CARDS
call GetNonTurnDuelistVariable
call SwapTurn
call GetCardIDFromDeckIndex
call LoadCardDataToBuffer1_FromCardID
call SwapTurn
jr .display_card_name
.hand_or_discard_pile
ld a, [wMultiDirectionalMenuCursorPosition]
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, [wPreservedInPlayAreaCursorPosition]
ld [wMultiDirectionalMenuCursorPosition], 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, [wPreservedInPlayAreaCursorPosition]
ld [wMultiDirectionalMenuCursorPosition], a
jp .start
.PositionsJumpTable:
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_BENCH_1
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_BENCH_2
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_BENCH_3
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_BENCH_4
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_BENCH_5
dw OpenInPlayAreaScreen_TurnHolderPlayArea ; INPLAYAREA_PLAYER_ACTIVE
dw OpenInPlayAreaScreen_TurnHolderHand ; INPLAYAREA_PLAYER_HAND
dw OpenInPlayAreaScreen_TurnHolderDiscardPile ; INPLAYAREA_PLAYER_DISCARD_PILE
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_ACTIVE
dw OpenInPlayAreaScreen_NonTurnHolderHand ; INPLAYAREA_OPP_HAND
dw OpenInPlayAreaScreen_NonTurnHolderDiscardPile ; INPLAYAREA_OPP_DISCARD_PILE
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_BENCH_1
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_BENCH_2
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_BENCH_3
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_BENCH_4
dw OpenInPlayAreaScreen_NonTurnHolderPlayArea ; INPLAYAREA_OPP_BENCH_5
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_1
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_2
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_3
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_4
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_5
dw OpenInPlayAreaScreen_TurnHolderPrizeCards ; INPLAYAREA_PLAYER_PRIZE_6
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_1
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_2
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_3
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_4
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_5
dw OpenInPlayAreaScreen_NonTurnHolderPrizeCards ; INPLAYAREA_OPP_PRIZE_6
OpenInPlayAreaScreen_TurnHolderPlayArea:
lb de, $38, $9f
call SetupText
; convert INPLAYAREA_PLAYER_* to PLAY_AREA_*
ld a, [wMultiDirectionalMenuCursorPosition]
inc a
cp INPLAYAREA_PLAYER_ACTIVE + 1
jr nz, .on_bench
xor a ; PLAY_AREA_ARENA
.on_bench
ld [wCurPlayAreaSlot], a
add DUELVARS_ARENA_CARD
get_turn_duelist_var
cp -1
ret z
call GetCardIDFromDeckIndex
call LoadCardDataToBuffer1_FromCardID
xor a
ld [wCurPlayAreaY], a
bank1call OpenCardPage_FromCheckPlayArea
ret
OpenInPlayAreaScreen_NonTurnHolderPlayArea:
lb de, $38, $9f
call SetupText
; convert INPLAYAREA_OPP_* to PLAY_AREA_*
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_OPP_ACTIVE
or a
jr z, .active
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_TurnHolderPrizeCards:
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_PLAYER_PRIZE_1
call IsCurPrizeCardRemaining
jr nz, .found
ld a, $01
ld [wd0d2], a
ret
.found
lb de, $38, $9f
call SetupText
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_PLAYER_PRIZE_1
add DUELVARS_PRIZE_CARDS
get_turn_duelist_var
call GetCardIDFromDeckIndex
call LoadCardDataToBuffer1_FromCardID
bank1call OpenCardPage_FromHand
ret
OpenInPlayAreaScreen_NonTurnHolderPrizeCards:
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_OPP_PRIZE_1
call SwapTurn
call IsCurPrizeCardRemaining
call SwapTurn
jr nz, .found
ld a, $01
ld [wd0d2], a
ret
.found
lb de, $38, $9f
call SetupText
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_OPP_PRIZE_1
add DUELVARS_PRIZE_CARDS
call GetNonTurnDuelistVariable
call SwapTurn
call GetCardIDFromDeckIndex
call LoadCardDataToBuffer1_FromCardID
bank1call OpenCardPage_FromHand
call SwapTurn
ret
OpenInPlayAreaScreen_TurnHolderHand:
lb de, $38, $9f
call SetupText
ldh a, [hWhoseTurn]
push af
bank1call OpenTurnHolderHandScreen_Simple
pop af
ldh [hWhoseTurn], a
ret
OpenInPlayAreaScreen_NonTurnHolderHand:
lb de, $38, $9f
call SetupText
ldh a, [hWhoseTurn]
push af
bank1call OpenNonTurnHolderHandScreen_Simple
pop af
ldh [hWhoseTurn], a
ret
OpenInPlayAreaScreen_TurnHolderDiscardPile:
lb de, $38, $9f
call SetupText
ldh a, [hWhoseTurn]
push af
bank1call OpenTurnHolderDiscardPileScreen
pop af
ldh [hWhoseTurn], a
ret
OpenInPlayAreaScreen_NonTurnHolderDiscardPile:
lb de, $38, $9f
call SetupText
ldh a, [hWhoseTurn]
push af
bank1call OpenNonTurnHolderDiscardPileScreen
pop af
ldh [hWhoseTurn], a
ret
; only hand and discard pile slots have text id
OpenInPlayAreaScreen_TextTable:
dw PLAY_AREA_BENCH_1 ; INPLAYAREA_PLAYER_BENCH_1
dw PLAY_AREA_BENCH_2 ; INPLAYAREA_PLAYER_BENCH_2
dw PLAY_AREA_BENCH_3 ; INPLAYAREA_PLAYER_BENCH_3
dw PLAY_AREA_BENCH_4 ; INPLAYAREA_PLAYER_BENCH_4
dw PLAY_AREA_BENCH_5 ; INPLAYAREA_PLAYER_BENCH_5
dw PLAY_AREA_ARENA ; INPLAYAREA_PLAYER_ACTIVE
tx DuelistHandText_2 ; INPLAYAREA_PLAYER_HAND
tx DuelistDiscardPileText_2 ; INPLAYAREA_PLAYER_DISCARD_PILE
dw PLAY_AREA_ARENA ; INPLAYAREA_OPP_ACTIVE
tx DuelistHandText_2 ; INPLAYAREA_OPP_HAND
tx DuelistDiscardPileText_2 ; INPLAYAREA_OPP_DISCARD_PILE
dw PLAY_AREA_BENCH_1 ; INPLAYAREA_OPP_BENCH_1
dw PLAY_AREA_BENCH_2 ; INPLAYAREA_OPP_BENCH_2
dw PLAY_AREA_BENCH_3 ; INPLAYAREA_OPP_BENCH_3
dw PLAY_AREA_BENCH_4 ; INPLAYAREA_OPP_BENCH_4
dw PLAY_AREA_BENCH_5 ; INPLAYAREA_OPP_BENCH_5
dw INPLAYAREA_PRIZE_1 ; INPLAYAREA_PLAYER_PRIZE_1
dw INPLAYAREA_PRIZE_2 ; INPLAYAREA_PLAYER_PRIZE_2
dw INPLAYAREA_PRIZE_3 ; INPLAYAREA_PLAYER_PRIZE_3
dw INPLAYAREA_PRIZE_4 ; INPLAYAREA_PLAYER_PRIZE_4
dw INPLAYAREA_PRIZE_5 ; INPLAYAREA_PLAYER_PRIZE_5
dw INPLAYAREA_PRIZE_6 ; INPLAYAREA_PLAYER_PRIZE_6
dw INPLAYAREA_PRIZE_1 ; INPLAYAREA_OPP_PRIZE_1
dw INPLAYAREA_PRIZE_2 ; INPLAYAREA_OPP_PRIZE_2
dw INPLAYAREA_PRIZE_3 ; INPLAYAREA_OPP_PRIZE_3
dw INPLAYAREA_PRIZE_4 ; INPLAYAREA_OPP_PRIZE_4
dw INPLAYAREA_PRIZE_5 ; INPLAYAREA_OPP_PRIZE_5
dw INPLAYAREA_PRIZE_6 ; INPLAYAREA_OPP_PRIZE_6
MACRO in_play_area_cursor_transition
cursor_transition \1, \2, \3, INPLAYAREA_\4, INPLAYAREA_\5, INPLAYAREA_\6, INPLAYAREA_\7
ENDM
OpenInPlayAreaScreen_TransitionTable:
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, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE
in_play_area_cursor_transition $30, $20, OAM_XFLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $30, $38, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $90, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
in_play_area_cursor_transition $78, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
in_play_area_cursor_transition $60, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
in_play_area_cursor_transition $48, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
in_play_area_cursor_transition $30, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
OpenInPlayAreaScreen_TransitionTable_WithHand:
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, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_DISCARD_PILE, OPP_DISCARD_PILE
in_play_area_cursor_transition $30, $20, OAM_XFLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $30, $38, OAM_XFLIP, OPP_HAND, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $90, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
in_play_area_cursor_transition $78, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
in_play_area_cursor_transition $60, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
in_play_area_cursor_transition $48, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
in_play_area_cursor_transition $30, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
OpenInPlayAreaScreen_TransitionTable_WithPrizes:
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_PRIZE_1
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, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_DISCARD_PILE
in_play_area_cursor_transition $30, $20, OAM_XFLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $30, $38, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $90, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
in_play_area_cursor_transition $78, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
in_play_area_cursor_transition $60, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
in_play_area_cursor_transition $48, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
in_play_area_cursor_transition $30, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
in_play_area_cursor_transition $08, $5c, $00, OPP_ACTIVE, PLAYER_PRIZE_3, PLAYER_PRIZE_2, PLAYER_PRIZE_1
in_play_area_cursor_transition $30, $5c, OAM_XFLIP, OPP_ACTIVE, PLAYER_PRIZE_4, PLAYER_ACTIVE, PLAYER_PRIZE_1
in_play_area_cursor_transition $08, $6c, $00, PLAYER_PRIZE_1, PLAYER_PRIZE_5, PLAYER_PRIZE_4, PLAYER_PRIZE_3
in_play_area_cursor_transition $30, $6c, OAM_XFLIP, PLAYER_PRIZE_2, PLAYER_PRIZE_6, PLAYER_ACTIVE, PLAYER_PRIZE_3
in_play_area_cursor_transition $08, $7c, $00, PLAYER_PRIZE_3, PLAYER_BENCH_1, PLAYER_PRIZE_6, PLAYER_PRIZE_5
in_play_area_cursor_transition $30, $7c, OAM_XFLIP, PLAYER_PRIZE_4, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_PRIZE_5
in_play_area_cursor_transition $a0, $44, OAM_XFLIP, OPP_PRIZE_3, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_PRIZE_2
in_play_area_cursor_transition $78, $44, $00, OPP_PRIZE_4, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_ACTIVE
in_play_area_cursor_transition $a0, $34, OAM_XFLIP, OPP_PRIZE_5, OPP_PRIZE_1, OPP_PRIZE_3, OPP_PRIZE_4
in_play_area_cursor_transition $78, $34, $00, OPP_PRIZE_6, OPP_PRIZE_2, OPP_PRIZE_3, OPP_ACTIVE
in_play_area_cursor_transition $a0, $24, OAM_XFLIP, OPP_BENCH_1, OPP_PRIZE_3, OPP_PRIZE_5, OPP_PRIZE_6
in_play_area_cursor_transition $78, $24, $00, OPP_BENCH_1, OPP_PRIZE_4, OPP_PRIZE_5, OPP_ACTIVE
OpenInPlayAreaScreen_TransitionTable_WithHandAndPrizes:
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_PRIZE_1
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, OAM_XFLIP, OPP_BENCH_1, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_DISCARD_PILE
in_play_area_cursor_transition $30, $20, OAM_XFLIP, OPP_BENCH_1, OPP_DISCARD_PILE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $30, $38, OAM_XFLIP, OPP_HAND, PLAYER_ACTIVE, OPP_ACTIVE, OPP_ACTIVE
in_play_area_cursor_transition $90, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_5, OPP_BENCH_2
in_play_area_cursor_transition $78, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_1, OPP_BENCH_3
in_play_area_cursor_transition $60, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_2, OPP_BENCH_4
in_play_area_cursor_transition $48, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_3, OPP_BENCH_5
in_play_area_cursor_transition $30, $14, OAM_XFLIP, OPP_PLAY_AREA, OPP_ACTIVE, OPP_BENCH_4, OPP_BENCH_1
in_play_area_cursor_transition $08, $5c, $00, OPP_ACTIVE, PLAYER_PRIZE_3, PLAYER_PRIZE_2, PLAYER_PRIZE_1
in_play_area_cursor_transition $30, $5c, OAM_XFLIP, OPP_ACTIVE, PLAYER_PRIZE_4, PLAYER_ACTIVE, PLAYER_PRIZE_1
in_play_area_cursor_transition $08, $6c, $00, PLAYER_PRIZE_1, PLAYER_PRIZE_5, PLAYER_PRIZE_4, PLAYER_PRIZE_3
in_play_area_cursor_transition $30, $6c, OAM_XFLIP, PLAYER_PRIZE_2, PLAYER_PRIZE_6, PLAYER_ACTIVE, PLAYER_PRIZE_3
in_play_area_cursor_transition $08, $7c, $00, PLAYER_PRIZE_3, PLAYER_BENCH_1, PLAYER_PRIZE_6, PLAYER_PRIZE_5
in_play_area_cursor_transition $30, $7c, OAM_XFLIP, PLAYER_PRIZE_4, PLAYER_BENCH_1, PLAYER_ACTIVE, PLAYER_PRIZE_5
in_play_area_cursor_transition $a0, $44, OAM_XFLIP, OPP_PRIZE_3, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_PRIZE_2
in_play_area_cursor_transition $78, $44, $00, OPP_PRIZE_4, PLAYER_ACTIVE, OPP_PRIZE_1, OPP_ACTIVE
in_play_area_cursor_transition $a0, $34, OAM_XFLIP, OPP_PRIZE_5, OPP_PRIZE_1, OPP_PRIZE_3, OPP_PRIZE_4
in_play_area_cursor_transition $78, $34, $00, OPP_PRIZE_6, OPP_PRIZE_2, OPP_PRIZE_3, OPP_ACTIVE
in_play_area_cursor_transition $a0, $24, OAM_XFLIP, OPP_BENCH_1, OPP_PRIZE_3, OPP_PRIZE_5, OPP_PRIZE_6
in_play_area_cursor_transition $78, $24, $00, OPP_BENCH_1, OPP_PRIZE_4, OPP_PRIZE_5, OPP_ACTIVE
; variant of HandleMultiDirectionalMenu
OpenInPlayAreaScreen_HandleInput:
xor a
ld [wMenuInputSFX], a
ld hl, wTransitionTablePtr
ld e, [hl]
inc hl
ld d, [hl]
ld a, [wMultiDirectionalMenuCursorPosition]
ld l, a
ld h, CURSOR_TRANSITION_STRUCT_LENGTH
call HtimesL
add hl, de
ldh a, [hDPadHeld]
or a
jp z, .check_button
; check d-pad
REPT CURSOR_TRANSITION_STRUCT_DIR_INDICES
inc hl
ENDR
bit B_PAD_UP, a
jr z, .elif_down
; up
ld a, [hl]
jr .process_dpad
.elif_down
inc hl
bit B_PAD_DOWN, a
jr z, .elif_right
; down
ld a, [hl]
jr .process_dpad
.elif_right
inc hl
bit B_PAD_RIGHT, a
jr z, .elif_left
; right
ld a, [hl]
jr .process_dpad
.elif_left
inc hl
bit B_PAD_LEFT, a
jp z, .check_button
; left
ld a, [hl]
.process_dpad
push af
ld a, [wMultiDirectionalMenuCursorPosition]
ld [wPreservedInPlayAreaCursorPosition], a
pop af
ld [wMultiDirectionalMenuCursorPosition], a
cp INPLAYAREA_PLAYER_ACTIVE
jr c, .player_area
cp INPLAYAREA_OPP_BENCH_1
jr c, .next
cp INPLAYAREA_PLAYER_PRIZE_1
jr c, .opponent_area
cp INPLAYAREA_OPP_PRIZE_1
jr c, .player_prize_cards
cp NUM_INPLAYAREA_POSITIONS
jr c, .opponent_prize_cards
jr .next
.player_area
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
get_turn_duelist_var
dec a
jr nz, .player_has_benched_pkmn
; no benched pkmn, so move to play area
ld a, INPLAYAREA_PLAYER_PLAY_AREA
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.player_has_benched_pkmn
ld b, a
ld a, [wMultiDirectionalMenuCursorPosition]
cp b
jr c, .next
; check wrap
ldh a, [hDPadHeld]
bit B_PAD_RIGHT, a
jr z, .on_left
xor a
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.on_left
ld a, b
dec a
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.opponent_area
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
call GetNonTurnDuelistVariable
dec a
jr nz, .opponent_has_benched_pkmn
; no benched pkmn, so move to play area
ld a, INPLAYAREA_OPP_PLAY_AREA
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.opponent_has_benched_pkmn
ld b, a
ld a, [wMultiDirectionalMenuCursorPosition]
sub INPLAYAREA_OPP_BENCH_1
cp b
jr c, .next
; check wrap
ldh a, [hDPadHeld]
bit B_PAD_LEFT, a
jr z, .on_right
ld a, INPLAYAREA_OPP_BENCH_1
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.on_right
ld a, b
add INPLAYAREA_OPP_BENCH_1 - 1
ld [wMultiDirectionalMenuCursorPosition], a
jr .next
.player_prize_cards
sub INPLAYAREA_PLAYER_PRIZE_1
ld hl, wDuelInitialPrizes
cp [hl]
jp nc, OpenInPlayAreaScreen_HandleInput
jr .next
.opponent_prize_cards
sub INPLAYAREA_OPP_PRIZE_1
ld hl, wDuelInitialPrizes
cp [hl]
jp nc, OpenInPlayAreaScreen_HandleInput
.next
ld a, SFX_CURSOR
ld [wMenuInputSFX], a
; reset cursor blink
xor a
ld [wScrollMenuCursorBlinkCounter], a
.check_button
ldh a, [hKeysPressed]
and PAD_A | PAD_B
jr z, .no_btns
and PAD_A
jr nz, .a_btn
; b btn
ld a, MENU_CANCEL
farcall PlaySFXConfirmOrCancel
scf
ret
.a_btn
call .DrawCursor
ld a, MENU_CONFIRM
farcall PlaySFXConfirmOrCancel
ld a, [wMultiDirectionalMenuCursorPosition]
scf
ret
.no_btns
ld a, [wMenuInputSFX]
or a
jr z, .skip_sfx
call PlaySFX
.skip_sfx
ld hl, wScrollMenuCursorBlinkCounter
ld a, [hl]
inc [hl]
and $0f
ret nz
bit 4, [hl]
jr nz, ZeroObjectPositionsAndToggleOAMCopy_Bank06
.DrawCursor:
call ZeroObjectPositions
ld hl, wTransitionTablePtr
ld e, [hl]
inc hl
ld d, [hl]
ld a, [wMultiDirectionalMenuCursorPosition]
ld l, a
ld h, CURSOR_TRANSITION_STRUCT_LENGTH
call HtimesL
add hl, de
; for table = [wTransitionTablePtr] and i = wMultiDirectionalMenuCursorPosition,
; hl = table[i]
ld d, [hl] ; CURSOR_TRANSITION_STRUCT_X
inc hl
ld e, [hl] ; CURSOR_TRANSITION_STRUCT_Y
inc hl
ld b, [hl] ; CURSOR_TRANSITION_STRUCT_ATTR
ld c, $00 ; cursor tile
call SetOneObjectAttributes
or a
ret
ZeroObjectPositionsAndToggleOAMCopy_Bank06:
call ZeroObjectPositions
ld a, TRUE
ld [wVBlankOAMCopyToggle], a
ret
; a = prize card index
; get bit a, DUELVARS_PRIZES
IsCurPrizeCardRemaining:
ld b, 1
.loop_bitmask
or a
jr z, .get_bit
sla b
dec a
jr .loop_bitmask
.get_bit
ld a, DUELVARS_PRIZES
get_turn_duelist_var
and b
ret

View File

@@ -1,9 +1,9 @@
OpenDuelCheckMenu::
ldh a, [hBankROM]
push af
ld a, $02 ; BANK(_OpenDuelCheckMenu)
ld a, BANK(_OpenDuelCheckMenu)
call BankswitchROM
call $4000 ; _OpenDuelCheckMenu
call _OpenDuelCheckMenu
pop af
call BankswitchROM
ret
@@ -11,11 +11,11 @@ OpenDuelCheckMenu::
OpenInPlayAreaScreen_FromSelectButton::
ldh a, [hBankROM]
push af
ld a, $06 ; BANK(OpenInPlayAreaScreen)
ld a, BANK(OpenInPlayAreaScreen)
call BankswitchROM
ld a, $1
ld a, TRUE
ld [wInPlayAreaFromSelectButton], a
call $4000 ; OpenInPlayAreaScreen
call OpenInPlayAreaScreen
pop bc
ld a, b
call BankswitchROM
@@ -34,9 +34,9 @@ DrawYourOrOppPlayAreaScreen_Bank0::
ld [wCheckMenuPlayAreaWhichLayout], a
ldh a, [hBankROM]
push af
ld a, $02 ; BANK(_DrawYourOrOppPlayAreaScreen)
ld a, BANK(_DrawYourOrOppPlayAreaScreen)
call BankswitchROM
call $4321 ; _DrawYourOrOppPlayAreaScreen
call _DrawYourOrOppPlayAreaScreen
call DrawWideTextBox
pop af
call BankswitchROM
@@ -45,9 +45,9 @@ DrawYourOrOppPlayAreaScreen_Bank0::
DrawPlayersPrizeAndBenchCards:
ldh a, [hBankROM]
push af
ld a, $02 ; BANK(_DrawPlayersPrizeAndBenchCards)
ld a, BANK(_DrawPlayersPrizeAndBenchCards)
call BankswitchROM
call $4453 ; _DrawPlayersPrizeAndBenchCards
call _DrawPlayersPrizeAndBenchCards
pop af
call BankswitchROM
ret

View File

@@ -1834,7 +1834,7 @@ wCheckMenuPlayAreaWhichDuelist:: ; d0bf
wCheckMenuPlayAreaWhichLayout:: ; d0c0
ds $1
wd0c1:: ; d0c1
wMultiDirectionalMenuCursorPosition:: ; d0c1
ds $1
; pointer to transition table data
@@ -1847,22 +1847,33 @@ wDuelInitialPrizesUpperBitsSet:: ; d0c4
wd0c4:: ; d0c4
ds $1
ds $3
ds $1
wPreservedInPlayAreaCursorPosition:: ; d0c6
ds $1
wTempInPlayAreaCursorPosition:: ; d0c7
ds $1
; number of prize cards still to be
; picked by the player
wNumberOfPrizeCardsToSelect:: ; d0c8
ds $1
ds $4
ds $3
; stores ARENA_CARD_PLAYER/ARENA_CARD_OPPONENT flag
wArenaCardsInPlayArea:: ; d0cc
ds $1
wd0cd:: ; d0cd
ds $1
wYourOrOppPlayAreaLastCursorPosition:: ; d0ce
ds $1
; $00 when the "In Play Area" screen has been opened from the Check menu
; $01 when the "In Play Area" screen has been opened by pressing the select button
; FALSE when the "In Play Area" screen has been opened from the Check menu
; TRUE when the "In Play Area" screen has been opened by pressing the select button
wInPlayAreaFromSelectButton:: ; d0cf
ds $1