Skip to content

Commit b035d9f

Browse files
authored
Define constants for wBillsPCPokemonList entries (#1183)
1 parent fd2af28 commit b035d9f

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

constants/pokemon_data_constants.asm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,17 @@ DEF PARTY_LENGTH EQU 6
136136

137137
; boxes
138138
DEF MONS_PER_BOX EQU 20
139+
DEF MONS_PER_BOX_JP EQU 30
139140
; box: count, species, mons, OTs, nicknames, padding
140141
DEF BOX_LENGTH EQU 1 + MONS_PER_BOX + 1 + (BOXMON_STRUCT_LENGTH + NAME_LENGTH + MON_NAME_LENGTH) * MONS_PER_BOX + 2 ; $450
141142
DEF NUM_BOXES EQU 14
142143

144+
rsreset
145+
DEF BOXLIST_SPECIES rb
146+
DEF BOXLIST_BOXNUM rb
147+
DEF BOXLIST_INDEX rb
148+
DEF BOXLIST_SIZE EQU _RS
149+
143150
; hall of fame
144151
; hof_mon: species, id, dvs, level, nicknames
145152
DEF HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; $10

engine/pokemon/bills_pc.asm

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,10 +1115,10 @@ BillsPC_LoadMonStats:
11151115
add [hl]
11161116
ld e, a
11171117
ld d, 0
1118-
ld hl, wBillsPCPokemonList + 1 ; box number
1119-
add hl, de
1120-
add hl, de
1118+
ld hl, wBillsPCPokemonList + BOXLIST_BOXNUM
1119+
rept BOXLIST_SIZE
11211120
add hl, de
1121+
endr
11221122
ld a, [hl]
11231123
and a
11241124
jr z, .party
@@ -1229,10 +1229,10 @@ BillsPC_RefreshTextboxes:
12291229
ld a, [wBillsPC_ScrollPosition]
12301230
ld e, a
12311231
ld d, 0
1232-
ld hl, wBillsPCPokemonList
1233-
add hl, de
1234-
add hl, de
1232+
ld hl, wBillsPCPokemonList + BOXLIST_SPECIES
1233+
rept BOXLIST_SIZE
12351234
add hl, de
1235+
endr
12361236
ld e, l
12371237
ld d, h
12381238
hlcoord 9, 4
@@ -1246,9 +1246,9 @@ BillsPC_RefreshTextboxes:
12461246
ld de, 2 * SCREEN_WIDTH
12471247
add hl, de
12481248
pop de
1249+
rept BOXLIST_SIZE
12491250
inc de
1250-
inc de
1251-
inc de
1251+
endr
12521252
pop af
12531253
dec a
12541254
jr nz, .loop
@@ -1377,13 +1377,13 @@ MACRO copy_box_data
13771377
jr z, .done\@
13781378
and a
13791379
jr z, .done\@
1380-
ld [de], a ; species
1380+
ld [de], a ; BOXLIST_SPECIES
13811381
inc de
13821382
ld a, [wBillsPC_LoadedBox]
1383-
ld [de], a ; box number
1383+
ld [de], a ; BOXLIST_BOXNUM
13841384
inc de
13851385
ld a, [wBillsPCTempListIndex]
1386-
ld [de], a ; list index
1386+
ld [de], a ; BOXLIST_INDEX
13871387
inc a
13881388
ld [wBillsPCTempListIndex], a
13891389
inc de
@@ -1407,7 +1407,7 @@ ENDM
14071407
CopyBoxmonSpecies:
14081408
xor a
14091409
ld hl, wBillsPCPokemonList
1410-
ld bc, 3 * 30
1410+
ld bc, BOXLIST_SIZE * MONS_PER_BOX_JP
14111411
call ByteFill
14121412
ld de, wBillsPCPokemonList
14131413
xor a
@@ -1444,10 +1444,10 @@ BillsPC_GetSelectedPokemonSpecies:
14441444
add [hl]
14451445
ld e, a
14461446
ld d, 0
1447-
ld hl, wBillsPCPokemonList
1448-
add hl, de
1449-
add hl, de
1447+
ld hl, wBillsPCPokemonList + BOXLIST_SPECIES
1448+
rept BOXLIST_SIZE
14501449
add hl, de
1450+
endr
14511451
ld a, [hl]
14521452
ret
14531453

ram/wram.asm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,9 +921,7 @@ SECTION UNION "Overworld Map", WRAM0
921921

922922
; bill's pc data
923923
wBillsPCData::
924-
wBillsPCPokemonList::
925-
; (species, box number, list index) x30
926-
ds 3 * 30
924+
wBillsPCPokemonList:: ds BOXLIST_SIZE * MONS_PER_BOX_JP
927925
ds 720
928926
wBillsPC_ScrollPosition:: db
929927
wBillsPC_CursorPosition:: db

0 commit comments

Comments
 (0)