summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-07 15:14:04 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-07 15:14:04 +0100
commitbbac07ad938c578dda414ed4c5496d35e24c6a38 (patch)
tree7ae15d3e4ebc7ff9d1c212bb609b82ee6be72cab /src/engine
parent4b2be5326433a1a1cedfc8d16ca310529e48e5f1 (diff)
Work on Opponent's Play Area menu
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/bank02.asm90
1 files changed, 88 insertions, 2 deletions
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm
index d11ed8b..86acc6d 100644
--- a/src/engine/bank02.asm
+++ b/src/engine/bank02.asm
@@ -137,8 +137,84 @@ OpenDuelScreen: ; 809e (2:409e)
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)
- INCROM $80da, $8158
+ call ResetCursorPosAndBlink
+ call IsClairvoyanceActive
+ jr c, .clairvoyance1
+
+ ld a, $80
+ 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 LoadTurnHolders
+ ld a, [wCursorDuelYPosition]
+ sla a
+ ld b, a
+ ld a, [wCursorDuelXPosition]
+ add b
+ add $03
+ ld [wLastCursorPosition_YourPlayArea], a
+
+ ld b, $f8 ; black arrow tile
+ call DrawByteToTabulatedPositions
+ call DrawWideTextBox
+
+ xor a
+ ld [wDuelCursorBlinkCounter], a
+
+ call IsClairvoyanceActive
+ jr c, .clairvoyance2
+ ld hl, OppPlayAreaMenuData
+ call PlaceTextItems
+ jr .loop
+.clairvoyance2
+ ld hl, OppPlayAreaMenuData_WithClairvoyance
+ call PlaceTextItems
+
+.loop
+ call DoFrame
+ ld a, $01
+ call DrawArrowsToTabulatedPositions
+ call Func_86ac
+ jr nc, .loop
+
+ call EraseByteFromTabulatedPositions
+ cp $ff
+ ret z
+
+ ld a, [wCursorDuelYPosition]
+ sla a
+ ld b, a
+ ld a, [wCursorDuelXPosition]
+ add b
+ ld hl, .table
+ call JumpToFunctionInTable
+ jr .turns
+
+.table
+ dw OpenDuelScreen.non_turn_holder_play_area
+ dw OpenDuelScreen.non_turn_holder_hand
+ dw OpenDuelScreen.non_turn_holder_discard_pile
CheckMenuData: ; (2:4158)
textitem 2, 14, InPlayAreaText
@@ -153,7 +229,16 @@ YourPlayAreaMenuData: ; (2:4169)
textitem 2, 16, YourDiscardPileText2
db $ff
- INCROM $8176, $818c
+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
@@ -198,6 +283,7 @@ EraseByteFromTabulatedPositions: ; 81af (2:41af)
; 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