summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2016-01-26 12:00:40 +0100
committerxCrystal <rgr.crystal@gmail.com>2016-01-26 12:00:40 +0100
commitffbb12fb97e689c20872ef3d1817e7d3ac3a95ba (patch)
tree6608475108f79ec196f7a04d1de47d359d1b48d1
parent55cb5ea7c908aec3778e5c8b72197e81969272e7 (diff)
more incbins and labels
-rwxr-xr-xsrc/engine/bank1.asm54
-rwxr-xr-xsrc/engine/bank2.asm8
-rwxr-xr-xsrc/engine/home.asm63
-rwxr-xr-xsrc/wram.asm16
4 files changed, 108 insertions, 33 deletions
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm
index 77c9d3e..ad84579 100755
--- a/src/engine/bank1.asm
+++ b/src/engine/bank1.asm
@@ -128,7 +128,7 @@ Duel_Start: ; 409f (1:409f)
ld a, $3
call $2167
ld hl, $0076
- call Func_2aab
+ call DrawWideTextBox_WaitForInput
call Func_04a2
ld a, [hWhoseTurn]
push af
@@ -179,7 +179,7 @@ Duel_Start: ; 409f (1:409f)
call PlaySong
ld a, $c3
ld [hWhoseTurn], a
- call Func_2a59
+ call DrawWideTextBox_PrintText
call EnableLCD
.asm_41a7
call Func_053f
@@ -190,7 +190,7 @@ Duel_Start: ; 409f (1:409f)
cp $3
jr z, .asm_41c8
call Func_39fc
- call $2aae
+ call WaitForWideTextBoxInput
call $3b31
call ResetSerial
ld a, $c2
@@ -198,12 +198,12 @@ Duel_Start: ; 409f (1:409f)
ret
.asm_41c8
- call $2aae
+ call WaitForWideTextBoxInput
call $3b31
ld a, [wDuelTheme]
call PlaySong
ld hl, $007a
- call Func_2aab
+ call DrawWideTextBox_WaitForInput
ld a, $1
ld [$cc08], a
call $70aa
@@ -237,7 +237,49 @@ Func_5aeb: ; 5aeb (1:5aeb)
INCBIN "baserom.gbc",$5aeb,$6785 - $5aeb
Func_6785: ; 6785 (1:6785)
-INCBIN "baserom.gbc",$6785,$7354 - $6785
+INCBIN "baserom.gbc",$6785,$7107 - $6785
+
+InitializeDuelVariables: ; 7107 (1:7107)
+ ld a, [hWhoseTurn]
+ ld h, a
+ ld l, wPlayerDuelistType & $ff
+ ld a, [hl]
+ push hl
+ push af
+ xor a
+ ld l, a
+.zeroDuelVariablesLoop
+ ld [hl], a
+ inc l
+ jr nz, .zeroDuelVariablesLoop
+ pop af
+ pop hl
+ ld [hl], a
+ ld bc, DECK_SIZE ; lb bc, wPlayerCardLocations & $ff, DECK_SIZE
+ ld l, wPlayerDeckCards & $ff
+.initDuelVariablesLoop
+; zero card locations and cards in hand, and init order of cards in deck
+ push hl
+ ld [hl], b
+ ld l, b
+ ld [hl], $0
+ pop hl
+ inc l
+ inc b
+ dec c
+ jr nz, .initDuelVariablesLoop
+ ld l, wPlayerArenaCard & $ff
+ ld c, 1 + BENCH_SIZE + 1
+.initPlayArea
+; initialize to $ff card in arena as well as cards in bench (plus a terminator?)
+ ld [hl], $ff
+ inc l
+ dec c
+ jr nz, .initPlayArea
+ ret
+; 0x7133
+
+INCBIN "baserom.gbc",$7133,$7354 - $7133
BuildVersion: ; 7354 (1:7354)
db "VER 12/20 09:36",TX_END
diff --git a/src/engine/bank2.asm b/src/engine/bank2.asm
index 3a65ee2..a250c5c 100755
--- a/src/engine/bank2.asm
+++ b/src/engine/bank2.asm
@@ -80,9 +80,9 @@ Func_8db0: ; 8db0 (2:4db0)
Func_8dbc: ; 8dbc (2:4dbc)
ld hl, Unknown_8de2
- call Func_2636
+ call InitializeCursorParameters
ld hl, $0224
- call Func_2a59
+ call DrawWideTextBox_PrintText
.asm_8dc8
call Func_053f
jr c, Func_8dbc
@@ -349,13 +349,13 @@ Func_8f9d: ; 8f9d (2:4f9d)
ld [$ce3f], a
ld [$ce40], a
ld hl, $022a
- call Func_2aab
+ call DrawWideTextBox_WaitForInput
ld a, [$ceb1]
jp Func_8dbc
Func_8fe8: ; 8fe8 (2:4fe8)
ld hl, $022f
- call Func_2aab
+ call DrawWideTextBox_WaitForInput
ld a, [$ceb1]
ret
diff --git a/src/engine/home.asm b/src/engine/home.asm
index ba80865..fa33edb 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -3251,7 +3251,8 @@ Func_256d: ; 256d (0:256d)
INCBIN "baserom.gbc",$2589,$2636 - $2589
-Func_2636: ; 2636 (0:2636)
+; initializes cursor parameters from the 8 bytes starting at hl
+InitializeCursorParameters: ; 2636 (0:2636)
ld [wCurMenuItem], a
ld [$ffb1], a
ld de, wCursorXPosition
@@ -3295,7 +3296,7 @@ Func_264b: ; 264b (0:264b)
push af
ld a, $1
ld [$cd99], a
- call Func_26e9
+ call EraseCursor
pop af
ld [wCurMenuItem], a
xor a
@@ -3364,10 +3365,10 @@ HandleTextBoxInput: ; 26da (0:26da)
ret nz
ld a, [wCursorTileNumber]
bit 4, [hl]
- jr z, asm_26ec
-Func_26e9: ; 26e9 (0:26e9)
+ jr z, drawCursor
+EraseCursor: ; 26e9 (0:26e9)
ld a, [wTileBehindCursor]
-asm_26ec
+drawCursor
ld c, a
ld a, [wYDisplacementBetweenMenuItems]
ld l, a
@@ -3390,7 +3391,7 @@ asm_26ec
Func_270b: ; 270b (0:270b)
ld a, [wCursorTileNumber]
- jr asm_26ec
+ jr drawCursor
; 0x2710
INCBIN "baserom.gbc",$2710,$2a1a - $2710
@@ -3416,7 +3417,7 @@ Func_2a1a: ; 2a1a (0:2a1a)
INCBIN "baserom.gbc",$2a30,$2a3e - $2a30
-Func_2a3e: ; 2a3e (0:2a3e)
+DrawNarrowTextBox_PrintText: ; 2a3e (0:2a3e)
push hl
call DrawNarrowTextBox
ld a, $b
@@ -3430,7 +3431,7 @@ Func_2a3e: ; 2a3e (0:2a3e)
ld hl, $c590
jp Func_21c5
-Func_2a59: ; 2a59 (0:2a59)
+DrawWideTextBox_PrintText: ; 2a59 (0:2a59)
push hl
call DrawWideTextBox
ld a, $13
@@ -3450,7 +3451,23 @@ DrawNarrowTextBox: ; 2a6f (0:2a6f)
ret
; 0x2a7c
-INCBIN "baserom.gbc",$2a7c,$2a9e - $2a7c
+DrawNarrowTextBox_WaitForInput: ; 2a7c (0:2a7c)
+ call DrawNarrowTextBox_PrintText
+ xor a
+ ld hl, NarrowTextBoxPromptCursorData
+ call InitializeCursorParameters
+ call EnableLCD
+.waitAorBLoop
+ call Func_053f
+ call HandleTextBoxInput
+ ld a, [hButtonsPressed]
+ and $3
+ jr z, .waitAorBLoop
+ ret
+; 0x2a96
+
+NarrowTextBoxPromptCursorData: ; 2a96 (0:2a96)
+ db $a, $11, $1, $1, $2f, $1d, $0, $0
; draws a 20x6 text box aligned to the bottom of the screen
DrawWideTextBox: ; 2a9e (0:2a9e)
@@ -3460,31 +3477,35 @@ DrawWideTextBox: ; 2a9e (0:2a9e)
call DrawRegularTextBox
ret
-Func_2aab: ; 2aab (0:2aab)
- call Func_2a59
+DrawWideTextBox_WaitForInput: ; 2aab (0:2aab)
+ call DrawWideTextBox_PrintText
+
+WaitForWideTextBoxInput: ; 2aae (0:2aae)
xor a
- ld hl, Unknown_2ac8
- call Func_2636
+ ld hl, WideTextBoxPromptCursorData
+ call InitializeCursorParameters
call EnableLCD
-.asm_2ab8
+.waitAorBLoop
call Func_053f
call HandleTextBoxInput
ld a, [hButtonsPressed]
and $3
- jr z, .asm_2ab8
- call Func_26e9
+ jr z, .waitAorBLoop
+ call EraseCursor
ret
-Unknown_2ac8: ; 2ac8 (0:2ac8)
-INCBIN "baserom.gbc",$2ac8,$2af0 - $2ac8
+WideTextBoxPromptCursorData: ; 2ac8 (0:2ac8)
+ db $12, $11, $1, $1, $2f, $1d, $0, $0
+
+INCBIN "baserom.gbc",$2ad0,$2af0 - $2ad0
Func_2af0: ; 2af0 (0:2af0)
- call Func_2a59
+ call DrawWideTextBox_PrintText
ld de, $0710
call Func_2b66
ld de, $0610
jr .asm_2b0a
- call Func_2a3e
+ call DrawNarrowTextBox_PrintText
ld de, $0310
call Func_2b66
ld de, $0210
@@ -3508,7 +3529,7 @@ Func_2af0: ; 2af0 (0:2af0)
jr z, .asm_2b1f
ld a, $1
call Func_3796
- call Func_26e9
+ call EraseCursor
.asm_2b39
ld a, [$cd98]
ld c, a
diff --git a/src/wram.asm b/src/wram.asm
index 7fd0798..ffcc81b 100755
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -69,7 +69,13 @@ wPlayerNumberOfPokemonInPlay:: ; c2ef
wPlayerArenaCardStatus:: ; c2f0
ds $1
- ds $f
+
+; $00 - player
+; $01 - link
+; other - AI controlled
+wPlayerDuelistType:: ; c2f1
+ ds $1
+ ds $e
wOpponentDuelVariables:: ; c300
@@ -115,7 +121,13 @@ wOpponentNumberOfPokemonInPlay:: ; c3ef
wOpponentArenaCardStatus:: ; c3f0
ds $1
- ds $f
+
+; $00 - player
+; $01 - link
+; other - AI controlled
+wOpponentDuelistType:: ; c3f1
+ ds $1
+ ds $e
wPlayerDeck:: ; c400
ds $80