summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/engine/bank02.asm124
-rw-r--r--src/text/text2.asm2
-rw-r--r--src/text/text_offsets.asm2
-rw-r--r--src/wram.asm5
4 files changed, 125 insertions, 8 deletions
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm
index 9566659..b24ed7e 100644
--- a/src/engine/bank02.asm
+++ b/src/engine/bank02.asm
@@ -358,7 +358,8 @@ PlayAreaDrawPositions: ; 81e3 (2:41e3)
; loads the turn holders
; input:
-; a = turn player
+; h = turn holder 1
+; l = turn holder 2
DrawYourOrOppPlayArea_LoadTurnHolders: ; 8209 (2:4209)
ld a, h
ld [wTurnHolder1], a
@@ -504,7 +505,7 @@ _DrawInPlayArea: ; 82ce (2:42ce)
call DrawYourOrOppPlayArea_BenchCards
ld hl, PlayAreaIconCoordinates.player2
- call Func_864d
+ call DrawInPlayArea_Icons
call SwapTurn
ldh a, [hWhoseTurn]
@@ -522,7 +523,7 @@ _DrawInPlayArea: ; 82ce (2:42ce)
call SwapTurn
ld hl, PlayAreaIconCoordinates.opponent2
- call Func_864d
+ call DrawInPlayArea_Icons
call SwapTurn
call DrawActiveCardGfx_InPlayArea
@@ -1288,7 +1289,116 @@ DrawCursor_OppPlayArea: ; 8760 (2:4760)
jr DrawByteInCursor_OppPlayArea
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
+
+.loop1
+ call DoFrame
+ call HandleMenuInput ; await input
+ jr nc, .loop1
+ cp $ff ; test if input was to cancel
+ jr z, .loop1
+
+ 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, .asm_87bc
+
+; switch the play area to draw
+ ld h, a
+ ld l, a
+ call DrawYourOrOppPlayArea_LoadTurnHolders
+ xor a
+ ld [$ce56], a
+
+.asm_87bc
+ call DrawWideTextBox
+ lb de, $01, $0e
+ call InitTextPrinting
+ ldtx hl, WhichCardWouldYouLikeToSeeText
+ call ProcessTextFromID
+
+ xor a
+ ld [$ce52], a
+ lb de, $48, $c2
+ ld hl, wce53
+ ld [hl], e
+ inc hl
+ ld [hl], d
+
+.loop2
+ ld a, $01
+ ld [wVBlankOAMCopyToggle], a
+ call DoFrame
+ call Func_89ae
+ jr c, .asm_87e7
+ jr .loop2
+.asm_87e7
+ cp $ff
+ jr nz, .asm_87f0
+ call Func_8aa1
+ jr .swap
+.asm_87f0
+ ld hl, $47f8
+ call JumpToFunctionInTable
+ jr .loop2
+
+ INCROM $87f8, $8808
+
+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
+
+ INCROM $8819, $8883
+
+Func_8883: ; 8883 (2:4883)
+ INCROM $8883, $8932
Func_8932: ; 8932 (2:4932)
INCROM $8932, $8992
@@ -1304,7 +1414,11 @@ LoadCursorTile: ; 8992 (2:4992)
db $e0, $c0, $98, $b0, $84, $8c, $83, $82
db $86, $8f, $9d, $be, $f4, $f8, $50, $60
- INCROM $89ae, $8aaa
+Func_89ae: ; 89ae (2:49ae)
+ INCROM $89ae, $8aa1
+
+Func_8aa1: ; 8aa1 (2:4aa1)
+ INCROM $8aa1, $8aaa
Func_8aaa: ; 8aaa (2:4aaa)
INCROM $8aaa, $8b85
diff --git a/src/text/text2.asm b/src/text/text2.asm
index 3c46d8d..a7e4ee1 100644
--- a/src/text/text2.asm
+++ b/src/text/text2.asm
@@ -1767,7 +1767,7 @@ 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 f8c547d..b933222 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -589,7 +589,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer OppPlayAreaText ; 0x0249
textpointer InPlayAreaText ; 0x024a
textpointer GlossaryText ; 0x024b
- textpointer Text024c ; 0x024c
+ textpointer WhichCardWouldYouLikeToSeeText ; 0x024c
textpointer Text024d ; 0x024d
textpointer HandText2 ; 0x024e
textpointer Text024f ; 0x024f
diff --git a/src/wram.asm b/src/wram.asm
index 79ea9ed..1838a3e 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1291,7 +1291,10 @@ wTurnHolder1:: ; ce50
wTurnHolder2:: ; ce51
ds $1
- ds $3
+ ds $1
+
+wce53:: ; ce51
+ ds $2
; same as wDuelInitialPrizes but
; with upper 2 bits set