summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-06 21:10:22 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-06 21:10:22 +0100
commitf7362f9c484afc6486e8e309f194a196bd233908 (patch)
tree8797bd576f5b1b7c48acf0a7b2facbb5df2ad7dd /src
parent7749ebd22d28a67db2f1a9208e254da6b8e29ef0 (diff)
Work on Func_8464
Diffstat (limited to 'src')
-rw-r--r--src/engine/bank02.asm105
-rw-r--r--src/engine/bank06.asm2
-rw-r--r--src/wram.asm9
3 files changed, 110 insertions, 6 deletions
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm
index d8cc194..381e9b4 100644
--- a/src/engine/bank02.asm
+++ b/src/engine/bank02.asm
@@ -164,14 +164,14 @@ Func_8211: ; 8211 (2:4211)
call SwapTurn
call PrintTextNoDelay
call SwapTurn
-
+
.asm_8275
ld a, [wTurnHolder1]
ld b, a
ld a, [wTurnHolder2]
cp b
jr nz, .not_equal
- lb hl, $44, $b4
+ ld hl, PrizeCardsCoordinateData.player
call Func_8464
lb de, $06, 02
call Func_837e
@@ -182,7 +182,7 @@ Func_8211: ; 8211 (2:4211)
call Func_85aa
jr .lcd
.not_equal
- lb hl, $44, $c0
+ ld hl, PrizeCardsCoordinateData.opponent
call Func_8464
lb de, $06, $05
call Func_837e
@@ -206,7 +206,104 @@ Func_837e: ; 837e (2:437e)
INCROM $837e, $8464
Func_8464: ; 8464 (2:4464)
- INCROM $8464, $8511
+ push hl
+ call Func_84fc
+ ld a, [wTurnHolder1]
+ ld h, a
+ ld l, DUELVARS_PRIZES
+ ld a, [hl]
+
+ pop hl
+ ld b, 0
+ push af
+; loop each prize card + 1
+.loop
+ inc b
+ ld a, [wDuelInitialPrizes]
+ inc a
+ cp b
+ jr z, .done
+
+ pop af
+ srl a ; right shift prize cards left
+ push af
+ jr c, .not_taken
+ ld a, $e0 ; tile byte for empty slot
+ jr .draw
+.not_taken
+ ld a, $dc ; tile byte for card
+.draw
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ inc hl
+
+ push hl
+ push bc
+ lb hl, $01, $02 ; card tile gfx
+ lb bc, 2, 2 ; rectangle size
+ call FillRectangle
+
+ ld a, [wConsole]
+ cp CONSOLE_CGB
+ jr nz, .not_cgb
+ ld a, $02 ; blue colour
+ lb bc, 2, 2
+ lb hl, $00, $00
+ call BankswitchVRAM1
+ call FillRectangle
+ call BankswitchVRAM0
+.not_cgb
+ pop bc
+ pop hl
+ jr .loop
+.done
+ pop af
+ ret
+; 0x84b4
+
+PrizeCardsCoordinateData:
+; x and y coordinates for player prize cards
+.player
+ db 2, 1
+ db 2, 3
+ db 4, 1
+ db 4, 3
+ db 6, 1
+ db 6, 3
+; x and y coordinates for opponent prize cards
+.opponent
+ db 9, 17
+ db 9, 15
+ db 7, 17
+ db 7, 15
+ db 5, 17
+ db 5, 15
+
+ INCROM $84cc, $84fc
+
+; returns in a bits set up to the number of
+; initial prizes, with upper 2 bits set, i.e:
+; 6 prizes: a = %11111111
+; 4 prizes: a = %11001111
+; 3 prizes: a = %11000111
+; 2 prizes: a = %11000011
+Func_84fc: ; 84fc (2:44fc)
+ ld a, [wDuelInitialPrizes]
+ ld b, $01
+.loop
+ or a
+ jr z, .done
+ sla b
+ dec a
+ jr .loop
+.done
+ dec b
+ ld a, b
+ or %11000000
+ ld [wDuelInitialPrizesUpperBitsSet], a
+ ret
+; 0x8511
Func_8511: ; 8511 (2:4511)
INCROM $8511, $85aa
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index d25dccb..2feb1e3 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -580,7 +580,7 @@ Func_006_44c8: ; 184c8 (6:44c8)
inc hl
ld [hl], d
ld a, $ff
- ld [$ce55], a
+ ld [wDuelInitialPrizesUpperBitsSet], a
xor a
ld [wDuelCursorBlinkCounter], a
.asm_006_44e5
diff --git a/src/wram.asm b/src/wram.asm
index 9468724..a9887c4 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1291,7 +1291,14 @@ wTurnHolder1:: ; ce50
wTurnHolder2:: ; ce51
ds $1
- ds $7
+ ds $3
+
+; same as wDuelInitialPrizes but
+; with upper 2 bits set
+wDuelInitialPrizesUpperBitsSet:: ; ce55
+ ds $1
+
+ ds $3
wce59:: ; ce59
ds $1