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

@ -135,7 +135,7 @@ PARTY_LENGTH EQU 6
; boxes
MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
NUM_BOXES EQU 14
; hall of fame
HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; species, id, dvs, level, nick

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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