summaryrefslogtreecommitdiff
path: root/src/engine/menus/booster_pack.asm
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2021-09-27 11:56:10 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2021-09-27 11:56:10 +0100
commit7825b5ef0f09a877142ea1eb221e895bb60a0253 (patch)
tree9d46dfebd219919f5144786caf3ebfdf7cdab3a7 /src/engine/menus/booster_pack.asm
parent48f83527c769441b6c123f3382d90e2e962ef9a0 (diff)
Split bank 6
Diffstat (limited to 'src/engine/menus/booster_pack.asm')
-rw-r--r--src/engine/menus/booster_pack.asm42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/engine/menus/booster_pack.asm b/src/engine/menus/booster_pack.asm
new file mode 100644
index 0000000..934b730
--- /dev/null
+++ b/src/engine/menus/booster_pack.asm
@@ -0,0 +1,42 @@
+_OpenBoosterPack:
+ ld a, PLAYER_TURN
+ ldh [hWhoseTurn], a
+; clears DECK_SIZE bytes starting from wPlayerDuelVariables
+ ld h, a
+ ld l, $00
+.loop_clear
+ xor a
+ ld [hli], a
+ ld a, l
+ cp DECK_SIZE
+ jr c, .loop_clear
+
+; fills wDuelTempList with 0, 1, 2, 3, ...
+; up to the number of cards received in Boster Pack
+ xor a
+ ld hl, wBoosterCardsDrawn
+ ld de, wDuelTempList
+ ld c, $00
+.loop_index_sequence
+ ld a, [hli]
+ or a
+ jr z, .done_index_sequence
+ ld a, c
+ ld [de], a
+ inc de
+ inc c
+ jr .loop_index_sequence
+.done_index_sequence
+ ld a, $ff ; terminator byte
+ ld [de], a
+
+ lb de, $38, $9f
+ call SetupText
+ bank1call InitAndDrawCardListScreenLayout
+ ldtx hl, ChooseTheCardYouWishToExamineText
+ ldtx de, BoosterPackText
+ bank1call SetCardListHeaderText
+ ld a, A_BUTTON | START
+ ld [wNoItemSelectionMenuKeys], a
+ bank1call DisplayCardList
+ ret