Document/label bank2 and WRAM related stuff, add menu related constants

This commit is contained in:
ElectroDeoxys
2021-05-03 00:28:20 +01:00
parent 32eeaa6163
commit 516cd6502e
10 changed files with 1094 additions and 801 deletions
+8 -3
View File
@@ -8,9 +8,14 @@ CARD_NOT_OWNED EQU 1 << CARD_NOT_OWNED_F
CARD_COUNT_MASK EQU $7f
; sDeck* and generic deck constants
NUM_DECKS EQU 4
DECK_NAME_SIZE EQU 24
DECK_SIZE EQU 60
NUM_DECKS EQU 4
DECK_NAME_SIZE EQU 24
DECK_NAME_SIZE_WO_SUFFIX EQU 21 ; name part before "deck"
DECK_SIZE EQU 60
DECK_STRUCT_SIZE EQU DECK_NAME_SIZE + DECK_SIZE
DECK_CONFIG_BUFFER_SIZE EQU 80
MAX_NUM_SAME_NAME_CARDS EQU 4
MAX_UNNAMED_DECK_NUM EQU 999
; card data offsets (data/cards.asm and card_data_struct)
+15
View File
@@ -12,3 +12,18 @@ FILTER_TRAINER EQUS "TYPE_TRAINER"
FILTER_ENERGY EQU $20
NUM_FILTERS EQU 9
MAX_DECK_CONFIRMATION_VISIBLE_CARDS EQU 7
MAX_FILTERED_LIST_VISIBLE_CARDS EQU 6
; deck flags
const_def
const DECK_1_F ; $0
const DECK_2_F ; $1
const DECK_3_F ; $2
const DECK_4_F ; $3
ALL_DECKS EQU $ff
NUM_DECK_SAVE_MACHINE_SLOTS EQU 60
NUM_DECK_MACHINE_SLOTS EQU 5
+903 -699
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1173,7 +1173,7 @@ Func_c7b8: ; c7b8 (3:47b8)
ldh [hSCY], a
call Set_OBJ_8x16
farcall Func_1288c
farcall Func_8db0
farcall DeckSelectionMenu
call Set_OBJ_8x8
ret
+33 -29
View File
@@ -2050,29 +2050,32 @@ Func_1996e: ; 1996e (6:596e)
ldh [hWhoseTurn], a
ld hl, sCardCollection
ld bc, $1607
.asm_1997b
.loop_clear
xor a
ld [hli], a
dec bc
ld a, c
or b
jr nz, .asm_1997b
ld a, $5
ld hl, s0a350
jr nz, .loop_clear
ld a, CHARMANDER_AND_FRIENDS_DECK
ld hl, sSavedDeck1
call Func_199e0
ld a, $7
ld hl, s0a3a4
ld a, SQUIRTLE_AND_FRIENDS_DECK
ld hl, sSavedDeck2
call Func_199e0
ld a, $9
ld hl, s0a3f8
ld a, BULBASAUR_AND_FRIENDS_DECK
ld hl, sSavedDeck3
call Func_199e0
call EnableSRAM
ld hl, sCardCollection
ld a, CARD_NOT_OWNED
.asm_199a2
.loop_collection
ld [hl], a
inc l
jr nz, .asm_199a2
jr nz, .loop_collection
ld hl, sCurrentDuel
xor a
ld [hli], a
@@ -2080,13 +2083,14 @@ Func_1996e: ; 1996e (6:596e)
ld [hl], a
ld hl, sCardPopNameList
ld c, $10
.asm_199b2
ld c, CARDPOP_NAME_LIST_MAX_ELEMS
.loop_card_pop_names
ld [hl], $0
ld de, $0010
ld de, NAME_BUFFER_LENGTH
add hl, de
dec c
jr nz, .asm_199b2
jr nz, .loop_card_pop_names
ld a, 2
ld [sPrinterContrastLevel], a
ld a, $2
@@ -3592,9 +3596,9 @@ InputPlayerName: ; 1a7a3 (6:67a3)
ld a, $06
ld [wNamingScreenKeyboardHeight], a
ld a, $0f
ld [wceaa], a
ld [wVisibleCursorTile], a
ld a, $00
ld [wceab], a
ld [wInvisibleCursorTile], a
.loop
ld a, $01
ld [wVBlankOAMCopyToggle], a
@@ -3950,12 +3954,12 @@ NamingScreen_CheckButtonState: ; 1a908 (6:6908)
inc [hl]
and $0f
ret nz
ld a, [wceaa]
ld a, [wVisibleCursorTile]
bit 4, [hl]
jr z, Func_1aa07.asm_6a0a
Func_1aa07: ; 1aa07 (6:6a07)
ld a, [wceab]
ld a, [wInvisibleCursorTile]
.asm_6a0a
ld e, a
ld a, [wNamingScreenCursorX]
@@ -3974,7 +3978,7 @@ Func_1aa07: ; 1aa07 (6:6a07)
ret
Func_1aa23: ; 1aa23 (6:6a23)
ld a, [wceaa]
ld a, [wVisibleCursorTile]
jr Func_1aa07.asm_6a0a
Func_1aa28: ; 1aa28 (6:6a28)
@@ -3986,7 +3990,7 @@ Func_1aa28: ; 1aa28 (6:6a28)
call ZeroObjectPositions
pop af
ld b, a
ld a, [wceab]
ld a, [wInvisibleCursorTile]
cp b
jr z, .asm_6a60
ld a, [wNamingScreenBufferLength]
@@ -4456,9 +4460,9 @@ InputDeckName: ; 1ad89 (6:6d89)
ld a, $07
ld [wNamingScreenKeyboardHeight], a
ld a, $0f
ld [wceaa], a
ld [wVisibleCursorTile], a
ld a, $00
ld [wceab], a
ld [wInvisibleCursorTile], a
.loop
ld a, $01
ld [wVBlankOAMCopyToggle], a
@@ -4748,12 +4752,12 @@ Func_1aefb: ; 1aefb (6:6efb)
inc [hl]
and $0f
ret nz
ld a, [wceaa]
ld a, [wVisibleCursorTile]
bit 4, [hl]
jr z, Func_1afa1.asm_6fa4
Func_1afa1: ; 1afa1 (6:6fa1)
ld a, [wceab]
ld a, [wInvisibleCursorTile]
.asm_6fa4
ld e, a
ld a, [wNamingScreenCursorX]
@@ -4772,7 +4776,7 @@ Func_1afa1: ; 1afa1 (6:6fa1)
ret
Func_1afbd: ; 1afbd (6:6fbd)
ld a, [wceaa]
ld a, [wVisibleCursorTile]
jr Func_1afa1.asm_6fa4
Func_1afc2: ; 1afc2 (6:6fc2)
@@ -4784,7 +4788,7 @@ Func_1afc2: ; 1afc2 (6:6fc2)
call ZeroObjectPositions
pop af
ld b, a
ld a, [wceab]
ld a, [wInvisibleCursorTile]
cp b
jr z, .asm_6ffb
ld a, [wNamingScreenBufferLength]
@@ -4963,9 +4967,9 @@ Func_1ba14: ; 1ba14 (6:7a14)
Func_1ba4c: ; 1ba4c (6:7a4c)
push hl
ld l, b
ld h, $54
ld h, DECK_STRUCT_SIZE
call HtimesL
ld de, s0a350
ld de, sSavedDecks
add hl, de
ld d, h
ld e, l
@@ -5080,7 +5084,7 @@ Func_1bae4: ; 1bae4 (6:7ae4)
push af
ld hl, wd088
ld b, [hl]
farcall Func_b625
farcall CheckIfCanBuildSavedDeck
jr c, .asm_7af5
pop af
ld [wd0a6], a
+5
View File
@@ -93,3 +93,8 @@ duel_anim_struct: MACRO
\1Unknown2:: ds 1
\1Bank:: ds 1
ENDM
deck_struct: MACRO
\1Name:: ds DECK_NAME_SIZE
\1Cards:: ds DECK_SIZE
ENDM
+72 -30
View File
@@ -44,47 +44,89 @@ sPlayerName:: ; a010
sCardCollection:: ; a100
ds $100
sDeck1Name:: ; a200
ds DECK_NAME_SIZE
sDeck1Cards:: ; a218
ds DECK_SIZE
sDeck1:: deck_struct sDeck1 ; a200
sDeck2:: deck_struct sDeck2 ; a254
sDeck3:: deck_struct sDeck3 ; a2a8
sDeck4:: deck_struct sDeck4 ; a2fc
sDeck2Name:: ; a254
ds DECK_NAME_SIZE
sDeck2Cards:: ; a26c
ds DECK_SIZE
sDeck3Name:: ; a2a8
ds DECK_NAME_SIZE
sDeck3Cards:: ; a2c0
ds DECK_SIZE
sDeck4Name:: ; a2fc
ds DECK_NAME_SIZE
sDeck4Cards:: ; a314
ds DECK_SIZE
s0a350:: ; a350
ds DECK_NAME_SIZE + DECK_SIZE
s0a3a4:: ; a3a4
ds DECK_NAME_SIZE + DECK_SIZE
s0a3f8:: ; a3f8
ds DECK_NAME_SIZE + DECK_SIZE
ds $12b4
sSavedDecks::
sSavedDeck1:: deck_struct sSavedDeck1 ; a350
sSavedDeck2:: deck_struct sSavedDeck2 ; a3a4
sSavedDeck3:: deck_struct sSavedDeck3 ; a3f8
sSavedDeck4:: deck_struct sSavedDeck4 ; a44c
sSavedDeck5:: deck_struct sSavedDeck5 ; a4a0
sSavedDeck6:: deck_struct sSavedDeck6 ; a4f4
sSavedDeck7:: deck_struct sSavedDeck7 ; a548
sSavedDeck8:: deck_struct sSavedDeck8 ; a59c
sSavedDeck9:: deck_struct sSavedDeck9 ; a5f0
sSavedDeck10:: deck_struct sSavedDeck10 ; a644
sSavedDeck11:: deck_struct sSavedDeck11 ; a698
sSavedDeck12:: deck_struct sSavedDeck12 ; a6ec
sSavedDeck13:: deck_struct sSavedDeck13 ; a740
sSavedDeck14:: deck_struct sSavedDeck14 ; a794
sSavedDeck15:: deck_struct sSavedDeck15 ; a7e8
sSavedDeck16:: deck_struct sSavedDeck16 ; a83c
sSavedDeck17:: deck_struct sSavedDeck17 ; a890
sSavedDeck18:: deck_struct sSavedDeck18 ; a8e4
sSavedDeck19:: deck_struct sSavedDeck19 ; a938
sSavedDeck20:: deck_struct sSavedDeck20 ; a98c
sSavedDeck21:: deck_struct sSavedDeck21 ; a9e0
sSavedDeck22:: deck_struct sSavedDeck22 ; aa34
sSavedDeck23:: deck_struct sSavedDeck23 ; aa88
sSavedDeck24:: deck_struct sSavedDeck24 ; aadc
sSavedDeck25:: deck_struct sSavedDeck25 ; ab30
sSavedDeck26:: deck_struct sSavedDeck26 ; ab84
sSavedDeck27:: deck_struct sSavedDeck27 ; abd8
sSavedDeck28:: deck_struct sSavedDeck28 ; ac2c
sSavedDeck29:: deck_struct sSavedDeck29 ; ac80
sSavedDeck30:: deck_struct sSavedDeck30 ; acd4
sSavedDeck31:: deck_struct sSavedDeck31 ; ad28
sSavedDeck32:: deck_struct sSavedDeck32 ; ad7c
sSavedDeck33:: deck_struct sSavedDeck33 ; add0
sSavedDeck34:: deck_struct sSavedDeck34 ; ae24
sSavedDeck35:: deck_struct sSavedDeck35 ; ae78
sSavedDeck36:: deck_struct sSavedDeck36 ; aecc
sSavedDeck37:: deck_struct sSavedDeck37 ; af20
sSavedDeck38:: deck_struct sSavedDeck38 ; af74
sSavedDeck39:: deck_struct sSavedDeck39 ; afc8
sSavedDeck40:: deck_struct sSavedDeck40 ; b01c
sSavedDeck41:: deck_struct sSavedDeck41 ; b070
sSavedDeck42:: deck_struct sSavedDeck42 ; b0c4
sSavedDeck43:: deck_struct sSavedDeck43 ; b118
sSavedDeck44:: deck_struct sSavedDeck44 ; b16c
sSavedDeck45:: deck_struct sSavedDeck45 ; b1c0
sSavedDeck46:: deck_struct sSavedDeck46 ; b214
sSavedDeck47:: deck_struct sSavedDeck47 ; b268
sSavedDeck48:: deck_struct sSavedDeck48 ; b2bc
sSavedDeck49:: deck_struct sSavedDeck49 ; b310
sSavedDeck50:: deck_struct sSavedDeck50 ; b364
sSavedDeck51:: deck_struct sSavedDeck51 ; b3b8
sSavedDeck52:: deck_struct sSavedDeck52 ; b40c
sSavedDeck53:: deck_struct sSavedDeck53 ; b460
sSavedDeck54:: deck_struct sSavedDeck54 ; b4b4
sSavedDeck55:: deck_struct sSavedDeck55 ; b508
sSavedDeck56:: deck_struct sSavedDeck56 ; b55c
sSavedDeck57:: deck_struct sSavedDeck57 ; b5b0
sSavedDeck58:: deck_struct sSavedDeck58 ; b604
sSavedDeck59:: deck_struct sSavedDeck59 ; b658
sSavedDeck60:: deck_struct sSavedDeck60 ; b6ac
sCurrentlySelectedDeck:: ; b700
ds $1
sb701:: ; b701
; keeps track of how many unnamed decks have been built
; this is the number that gets appended at the end of
; an unnamed deck (i.e. DECK XXX)
; max number is MAX_UNNAMED_DECK_NUM
sUnnamedDeckCounter:: ; b701
ds $1
ds $1
sb703:: ; b703
ds $1
ds $4
ds $fc
ds $f9
sb800:: ; b800
ds $8
+1 -1
View File
@@ -1828,7 +1828,7 @@ SCardsText: ; 3bdd1 (e:7dd1)
text "'s Cards"
done
Text025b: ; 3bddb (e:7ddb)
EmptyDeckNameText: ; 3bddb (e:7ddb)
textfw0 "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"
done
+1 -1
View File
@@ -604,7 +604,7 @@ TextOffsets:: ; 34000 (d:4000)
textpointer ViewWhichCardFileText ; 0x0258
textpointer Text0259 ; 0x0259
textpointer SCardsText ; 0x025a
textpointer Text025b ; 0x025b
textpointer EmptyDeckNameText ; 0x025b
textpointer DeckSaveMachineText ; 0x025c
textpointer SaveADeckText ; 0x025d
textpointer DeleteADeckText ; 0x025e
+55 -37
View File
@@ -448,17 +448,7 @@ UNION
; this is kept updated with some default text that is used
; when the text printing functions are called with text id $0000
wDefaultText:: ; c590
ds $2
wc592:: ; c592
ds $3
ds $15
wc5aa:: ; c5aa
ds $1
ds $21
ds $3c
NEXTU
@@ -1913,28 +1903,38 @@ wcea1:: ; cea1
wCheckMenuCursorBlinkCounter:: ; cea3
ds $1
; used to temporarily store wCurCardTypeFilter
; to check whether a new filter is to be applied
wTempCardTypeFilter:: ; cea4
wCardListCursorPos:: ; cea4
wNamingScreenCursorY:: ; cea4
ds $1
wcea5:: ; cea5
wCardListCursorXPos:: ; cea5
ds $1
wcea6:: ; cea6
wCardListCursorYPos:: ; cea6
ds $1
wcea7:: ; cea7
wCardListYSpacing:: ; cea7
ds $1
wcea8:: ; cea8
wCardListXSpacing:: ; cea8
ds $1
wCardListNumCursorPositions:: ; cea9
wNamingScreenKeyboardHeight:: ; cea9
ds $1
wceaa:: ; ceaa
; tile to draw when cursor is blinking
wVisibleCursorTile:: ; ceaa
ds $1
wceab:: ; ceab
; tile to draw when cursor is visible
wInvisibleCursorTile:: ; ceab
ds $1
wceac:: ; ceac
@@ -1978,10 +1978,14 @@ wOnesAndTensPlace:: ; ceb6
wCardFilterCounts:: ; cebb
ds NUM_FILTERS
wcec4:: ; cec4
ds $7
; buffer used to show which card IDs
; are visible in a given list
wVisibleListCardIDs:: ; cec4
ds MAX_DECK_CONFIRMATION_VISIBLE_CARDS
wcecb:: ; cecb
; number of visible entries
; when showing a list of cards
wNumVisibleCardListEntries:: ; cecb
ds $1
wTotalCardCount:: ; cecc
@@ -2035,17 +2039,17 @@ wHandTempList:: ; ceda
wceda:: ; ceda
ds DECK_SIZE
; terminator for wceda
wcf16:: ; cf16
ds $1
; used in bank2, probably related to wTempHandCardList (another temp list?)
; holds cards for the current deck
wCurDeckCards:: ; cf17
ds DECK_SIZE
ds DECK_CONFIG_BUFFER_SIZE
wcf53:: ; cf53
wCurDeckCardsTerminator:: ; cf67
ds $1
ds $14
wCurDeckCardsEnd::
; stores the count number of cards owned
; can be 0 in the case that a card is not available
@@ -2062,21 +2066,35 @@ wTempHandCardList:: ; cf68
wCurDeckName:: ; cfb9
ds DECK_NAME_SIZE
wcfd1:: ; cfd1
; max number of cards that are allowed
; to include when building a deck configuration
wMaxNumCardsAllowed:: ; cfd1
ds $1
wcfd2:: ; cfd2
; max number of cards with same name that are allowed
; to be included when building a deck configuration
wSameNameCardsLimit:: ; cfd2
ds $1
wcfd3:: ; cfd3
; whether to include the cards in the selected deck
; to appear in the filtered lists
; is TRUE when building a deck (since the cards should be shown for removal)
; is FALSE when choosing a deck configuration to send through Gift Center
; (can't select cards that are included in already built decks)
wIncludeCardsInDeck:: ; cfd3
ds $1
wcfd4:: ; cfd4
; pointer to a function that handles the menu
; when building a deck configuration
wDeckConfigurationMenuHandlerFunction:: ; cfd4
ds $2
wcfd6:: ; cfd6
; pointer to a transition table for the
; function in wDeckConfigurationMenuHandlerFunction
wDeckConfigurationMenuTransitionTable:: ; cfd6
ds $2
; pointer to a list of cards
wcfd8:: ; cfd8
ds $2
@@ -2109,7 +2127,8 @@ wPlaysSfx:: ; cfe3
wcfe4:: ; cfe4
ds $1
wcfe5:: ; cfe5
; collection index of the first owned card
wFirstOwnedCardIndex:: ; cfe5
ds $1
wcfe6:: ; cfe6
@@ -2148,12 +2167,11 @@ wNamingScreenNamePosition:: ; d007
wd009:: ; d009
ds $4
wd00d:: ; d00d
ds $18
; pointers to all decks of current deck machine
wMachineDeckPtrs:: ; d00d
ds 2 * NUM_DECK_SAVE_MACHINE_SLOTS
ds $60
wd085:: ; d085
wNumSavedDecks:: ; d085
ds $1
wd086:: ; d086
@@ -2174,7 +2192,7 @@ wd08a:: ; d08a
wd0a2:: ; d0a2
ds $2
wd0a4:: ; d0a4
wTempBankSRAM:: ; d0a4
ds $1
wd0a5:: ; d0a5