Assert the sBox1-14 tables have NUM_BOXES entries

This commit is contained in:
Rangi 2021-03-21 17:47:53 -04:00
parent 7fd23ae918
commit 0506e5b1b9
7 changed files with 28 additions and 19 deletions

View File

@ -1355,6 +1355,7 @@ DebugRoom_BoxStructStrings:
.SendBox: db "SEND BOX@" .SendBox: db "SEND BOX@"
DebugRoom_BoxAddresses: DebugRoom_BoxAddresses:
table_width 3, DebugRoom_BoxAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -1369,6 +1370,7 @@ DebugRoom_BoxAddresses:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
DebugRoomMenu_RTCEdit: DebugRoomMenu_RTCEdit:
ld hl, .PagedValuesHeader ld hl, .PagedValuesHeader

View File

@ -192,6 +192,7 @@ CheckForLuckyNumberWinners:
ret ret
.BoxBankAddresses: .BoxBankAddresses:
table_width 3, CheckForLuckyNumberWinners.BoxBankAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -206,6 +207,7 @@ CheckForLuckyNumberWinners:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
.LuckyNumberMatchPartyText: .LuckyNumberMatchPartyText:
text_far _LuckyNumberMatchPartyText text_far _LuckyNumberMatchPartyText

View File

@ -2140,7 +2140,7 @@ GetBoxPointer:
dec b dec b
ld c, b ld c, b
ld b, 0 ld b, 0
ld hl, .boxes ld hl, .BoxBankAddresses
add hl, bc add hl, bc
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -2151,8 +2151,8 @@ GetBoxPointer:
ld l, a ld l, a
ret ret
.boxes .BoxBankAddresses:
; bank, address table_width 3, GetBoxPointer.BoxBankAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -2167,6 +2167,7 @@ GetBoxPointer:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
BillsPC_ApplyPalettes: BillsPC_ApplyPalettes:
ld b, a ld b, a
@ -2319,19 +2320,15 @@ BillsPC_PrintBoxCountAndCapacity:
ld de, wTextDecimalByte ld de, wTextDecimalByte
lb bc, 1, 2 lb bc, 1, 2
call PrintNum call PrintNum
ld de, .out_of_20 ld de, .OutOf20
call PlaceString call PlaceString
ret ret
.Pokemon: .Pokemon:
db "#MON@" db "#MON@"
.out_of_20 .OutOf20:
; db "/20@" db "/{d:MONS_PER_BOX}@" ; "/20@"
db "/"
db "0" + MONS_PER_BOX / 10 ; "2"
db "0" + MONS_PER_BOX % 10 ; "0"
db "@"
GetBoxCount: GetBoxCount:
ld a, [wCurBox] ld a, [wCurBox]
@ -2342,7 +2339,7 @@ GetBoxCount:
jr z, .activebox jr z, .activebox
ld c, a ld c, a
ld b, 0 ld b, 0
ld hl, .boxbanks ld hl, .BoxBankAddresses
add hl, bc add hl, bc
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -2374,7 +2371,8 @@ GetBoxCount:
call CloseSRAM call CloseSRAM
ret ret
.boxbanks .BoxBankAddresses:
table_width 3, GetBoxCount.BoxBankAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -2389,6 +2387,7 @@ GetBoxCount:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
BillsPC_PrintBoxName: BillsPC_PrintBoxName:
hlcoord 0, 0 hlcoord 0, 0

View File

@ -266,7 +266,7 @@ LoadBoxMonListing: ; unreferenced
cp b cp b
jr z, .same_box jr z, .same_box
ld a, b ld a, b
ld hl, .BoxAddrs ld hl, .BoxAddresses
ld bc, 3 ld bc, 3
call AddNTimes call AddNTimes
ld a, [hli] ld a, [hli]
@ -364,7 +364,8 @@ LoadBoxMonListing: ; unreferenced
call CloseSRAM call CloseSRAM
ret ret
.BoxAddrs: .BoxAddresses:
table_width 3, LoadBoxMonListing.BoxAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -379,3 +380,4 @@ LoadBoxMonListing: ; unreferenced
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES

View File

@ -113,7 +113,7 @@ CheckOwnMonAnywhere:
jr z, .loopbox jr z, .loopbox
; Load the box. ; Load the box.
ld hl, BoxAddressTable ld hl, SearchBoxAddressTable
ld b, 0 ld b, 0
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -244,7 +244,8 @@ endr
scf scf
ret ret
BoxAddressTable: SearchBoxAddressTable:
table_width 3, SearchBoxAddressTable
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -259,6 +260,7 @@ BoxAddressTable:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
UpdateOTPointer: UpdateOTPointer:
push hl push hl

View File

@ -51,7 +51,7 @@ MobileCheckOwnMonAnywhere:
and $f and $f
cp c cp c
jr z, .asm_4a8d1 jr z, .asm_4a8d1
ld hl, .BoxAddrs ld hl, .BoxAddresses
ld b, 0 ld b, 0
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -130,7 +130,8 @@ MobileCheckOwnMonAnywhere:
scf scf
ret ret
.BoxAddrs: .BoxAddresses:
table_width 3, MobileCheckOwnMonAnywhere.BoxAddresses
dba sBox1 dba sBox1
dba sBox2 dba sBox2
dba sBox3 dba sBox3
@ -145,6 +146,7 @@ MobileCheckOwnMonAnywhere:
dba sBox12 dba sBox12
dba sBox13 dba sBox13
dba sBox14 dba sBox14
assert_table_length NUM_BOXES
.AdvanceOTName: .AdvanceOTName:
push hl push hl