summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2021-04-30 14:03:34 -0500
committerdannye <33dannye@gmail.com>2021-04-30 14:03:34 -0500
commit0cbd5acb76d0f5df35ebf529bd227c201e0b3115 (patch)
treefcc3124631cbbc05d3f4df670d13e5f2a3e02e59
parent3d7293abf6d09879106457d12b52bfb4b88922ea (diff)
parent6a31663c960a5c1da9dbbf12d49e0252860b96d0 (diff)
Merge branch 'master' of https://github.com/pret/pokered
-rw-r--r--constants/gfx_constants.asm3
-rw-r--r--constants/map_object_constants.asm2
-rw-r--r--engine/battle/read_trainer_party.asm2
-rw-r--r--engine/debug/debug_menu.asm16
-rw-r--r--engine/events/give_pokemon.asm2
-rw-r--r--engine/items/item_effects.asm16
-rw-r--r--engine/link/cable_club.asm8
-rw-r--r--engine/menus/save.asm2
-rw-r--r--engine/movie/oak_speech/init_player_data.asm2
-rw-r--r--engine/pokemon/add_mon.asm8
-rw-r--r--engine/pokemon/bills_pc.asm10
-rw-r--r--engine/pokemon/load_mon_data.asm2
-rw-r--r--engine/pokemon/remove_mon.asm2
-rw-r--r--sram.asm31
-rw-r--r--vram.asm32
-rw-r--r--wram.asm136
16 files changed, 148 insertions, 126 deletions
diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm
index 099ff2d7..e6290c8a 100644
--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -22,6 +22,9 @@ HP_BAR_GREEN EQU 0
HP_BAR_YELLOW EQU 1
HP_BAR_RED EQU 2
+; wOAMBuffer
+NUM_SPRITE_OAM_STRUCTS EQU 40
+
; hAutoBGTransferEnabled
TRANSFERTOP EQU 0
TRANSFERMIDDLE EQU 1
diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm
index 9993a6a9..899e01f0 100644
--- a/constants/map_object_constants.asm
+++ b/constants/map_object_constants.asm
@@ -38,6 +38,8 @@ SPRITESTATEDATA1_LENGTH EQU const_value
const SPRITESTATEDATA2_0F ; f
SPRITESTATEDATA2_LENGTH EQU const_value
+NUM_SPRITESTATEDATA_STRUCTS EQU 16
+
; different kinds of people events
ITEM EQU $80
TRAINER EQU $40
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index 02fbfeda..8fa323b5 100644
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -5,7 +5,7 @@ ReadTrainer:
and a
ret nz
-; set [wEnemyPartyCount] to 0, [wEnemyPartyMons] to FF
+; set [wEnemyPartyCount] to 0, [wEnemyPartySpecies] to FF
; XXX first is total enemy pokemon?
; XXX second is species of first pokemon?
ld hl, wEnemyPartyCount
diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm
index 43638be3..4d31265b 100644
--- a/engine/debug/debug_menu.asm
+++ b/engine/debug/debug_menu.asm
@@ -119,7 +119,7 @@ TestBattle:
ld [wGrassMons + 1], a
ld b, a
ld c, a
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
call Func_fe809
ld hl, wPartyCount
call Func_fe809
@@ -310,7 +310,7 @@ Func_fe8d9:
Func_fe8e2:
ld a, [wWhichPokemon]
push de
- ld de, wEnemyPartyMons
+ ld de, wEnemyPartySpecies
add e
ld e, a
jr nc, .asm_fe8ee
@@ -399,7 +399,7 @@ Func_fe964:
.asm_fe96f
ld a, [hl]
ld b, a
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
ld a, [wWhichPokemon]
add l
ld l, a
@@ -842,7 +842,7 @@ Func_fec9b:
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
ld a, [wWhichPokemon]
- ld de, wEnemyPartyMons
+ ld de, wEnemyPartySpecies
add e
ld e, a
jr nc, .asm_fecee
@@ -919,7 +919,7 @@ Data_feded:
db -1 ; end
Func_fedfe:
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
cp 30
jp nc, Func_ff1ad
call ClearScreen
@@ -1445,7 +1445,7 @@ Func_ff1b9:
ld hl, Text_ff28f
call PrintText
callfar EmptyAllSRAMBoxes
- ld hl, wNumInBox
+ ld hl, wBoxCount
xor a
ld [hli], a
dec a
@@ -1553,7 +1553,7 @@ Func_ff295:
call Func_ff2d1
ld e, l
ld d, h
- ld hl, wNumInBox
+ ld hl, wBoxCount
call Func_ff2f3
pop de
ld a, d
@@ -1561,7 +1561,7 @@ Func_ff295:
ld [wCurrentBoxNum], a
push de
call Func_ff2d1
- ld de, wNumInBox
+ ld de, wBoxCount
call Func_ff2f3
ld a, [wLetterPrintingDelayFlags]
push af
diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm
index efc184f8..a65f65cc 100644
--- a/engine/events/give_pokemon.asm
+++ b/engine/events/give_pokemon.asm
@@ -7,7 +7,7 @@ _GivePokemon::
ld a, [wPartyCount]
cp PARTY_LENGTH
jr c, .addToParty
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
cp MONS_PER_BOX
jr nc, .boxFull
; add to box
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index 9d6a3c06..ca51cd36 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -122,7 +122,7 @@ ItemUseBall:
ld a, [wPartyCount] ; is party full?
cp PARTY_LENGTH
jr nz, .canUseBall
- ld a, [wNumInBox] ; is box full?
+ ld a, [wBoxCount] ; is box full?
cp MONS_PER_BOX
jp z, BoxFullCannotThrowBall
@@ -2921,7 +2921,7 @@ IsKeyItem_::
INCLUDE "data/items/key_items.asm"
SendNewMonToBox:
- ld de, wNumInBox
+ ld de, wBoxCount
ld a, [de]
inc a
ld [de], a
@@ -2940,7 +2940,7 @@ SendNewMonToBox:
call GetMonHeader
ld hl, wBoxMonOT
ld bc, NAME_LENGTH
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
jr z, .asm_e732
dec a
@@ -2951,7 +2951,7 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
ld b, a
.asm_e71f
@@ -2972,7 +2972,7 @@ SendNewMonToBox:
ld de, wBoxMonOT
ld bc, NAME_LENGTH
call CopyData
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
jr z, .asm_e76e
ld hl, wBoxMonNicks
@@ -2985,7 +2985,7 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
ld b, a
.asm_e75b
@@ -3006,7 +3006,7 @@ SendNewMonToBox:
ld a, NAME_MON_SCREEN
ld [wNamingScreenType], a
predef AskName
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
jr z, .asm_e7ab
ld hl, wBoxMons
@@ -3019,7 +3019,7 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
dec a
ld b, a
.asm_e798
diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm
index 5124c744..f9728f47 100644
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -655,7 +655,7 @@ TradeCenter_DrawPartyLists:
ld de, wPartySpecies
call TradeCenter_PrintPartyListNames
hlcoord 2, 9
- ld de, wEnemyPartyMons
+ ld de, wEnemyPartySpecies
; fall through
TradeCenter_PrintPartyListNames:
@@ -707,7 +707,7 @@ TradeCenter_Trade:
ld bc, NAME_LENGTH
call CopyData
ld a, [wTradingWhichEnemyMon]
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
ld c, a
ld b, 0
add hl, bc
@@ -803,7 +803,7 @@ TradeCenter_Trade:
ld a, [wTradingWhichEnemyMon]
ld c, a
ld [wWhichPokemon], a
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
ld d, 0
ld e, a
add hl, de
@@ -823,7 +823,7 @@ TradeCenter_Trade:
ld a, $1
ld [wForceEvolution], a
ld a, [wTradingWhichEnemyMon]
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
ld b, 0
ld c, a
add hl, bc
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index 0c53f689..aab29b20 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -554,7 +554,7 @@ GetMonCountsForAllBoxes:
ld c, a
ld b, 0
add hl, bc
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
ld [hl], a
ret
diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm
index d6745daf..ca7f203d 100644
--- a/engine/movie/oak_speech/init_player_data.asm
+++ b/engine/movie/oak_speech/init_player_data.asm
@@ -19,7 +19,7 @@ InitPlayerData2:
ld hl, wPartyCount
call InitializeEmptyList
- ld hl, wNumInBox
+ ld hl, wBoxCount
call InitializeEmptyList
ld hl, wNumBagItems
call InitializeEmptyList
diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm
index e86b7b61..c498f02a 100644
--- a/engine/pokemon/add_mon.asm
+++ b/engine/pokemon/add_mon.asm
@@ -354,7 +354,7 @@ _MoveMon::
ld hl, wDayCareMon
jr z, .findMonDataSrc
; else it's PARTY_TO_BOX
- ld hl, wNumInBox
+ ld hl, wBoxCount
ld a, [hl]
cp MONS_PER_BOX
jr nz, .partyOrBoxNotFull
@@ -391,7 +391,7 @@ _MoveMon::
; if it's PARTY_TO_BOX
ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
.addMonOffset
dec a
call AddNTimes
@@ -441,7 +441,7 @@ _MoveMon::
ld a, [wPartyCount]
jr nz, .addOToffset
ld hl, wBoxMonOT
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
.addOToffset
dec a
call SkipFixedLengthTextEntries
@@ -472,7 +472,7 @@ _MoveMon::
ld a, [wPartyCount]
jr nz, .addNickOffset
ld hl, wBoxMonNicks
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
.addNickOffset
dec a
call SkipFixedLengthTextEntries
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm
index 42d4fb07..13ad1b20 100644
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -215,7 +215,7 @@ BillsPCDeposit:
call PrintText
jp BillsPCMenu
.partyLargeEnough
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
cp MONS_PER_BOX
jr nz, .boxNotFull
ld hl, BoxFullText
@@ -276,7 +276,7 @@ SleepingPikachuText2:
text_end
BillsPCWithdraw:
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
and a
jr nz, .boxNotEmpty
ld hl, NoMonText
@@ -290,7 +290,7 @@ BillsPCWithdraw:
call PrintText
jp BillsPCMenu
.partyNotFull
- ld hl, wNumInBox
+ ld hl, wBoxCount
call DisplayMonListMenu
jp c, BillsPCMenu
call DisplayDepositWithdrawMenu
@@ -319,14 +319,14 @@ BillsPCWithdraw:
jp BillsPCMenu
BillsPCRelease:
- ld a, [wNumInBox]
+ ld a, [wBoxCount]
and a
jr nz, .loop
ld hl, NoMonText
call PrintText
jp BillsPCMenu
.loop
- ld hl, wNumInBox
+ ld hl, wBoxCount
call DisplayMonListMenu
jp c, BillsPCMenu
callfar IsThisPartymonStarterPikachu_Box
diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm
index 53840728..3d9417a7 100644
--- a/engine/pokemon/load_mon_data.asm
+++ b/engine/pokemon/load_mon_data.asm
@@ -59,7 +59,7 @@ GetMonSpecies:
ld hl, wBoxSpecies
jr .getSpecies
.enemyParty
- ld hl, wEnemyPartyMons
+ ld hl, wEnemyPartySpecies
.getSpecies
ld d, 0
add hl, de
diff --git a/engine/pokemon/remove_mon.asm b/engine/pokemon/remove_mon.asm
index c85b96bf..60ec8c27 100644
--- a/engine/pokemon/remove_mon.asm
+++ b/engine/pokemon/remove_mon.asm
@@ -3,7 +3,7 @@ _RemovePokemon::
ld a, [wRemoveMonFromBox]
and a
jr z, .usePartyCount
- ld hl, wNumInBox
+ ld hl, wBoxCount
.usePartyCount
ld a, [hl]
dec a
diff --git a/sram.asm b/sram.asm
index 48542dc7..f6bac35c 100644
--- a/sram.asm
+++ b/sram.asm
@@ -21,25 +21,30 @@ sTileAnimations:: ds 1
sMainDataCheckSum:: ds 1
+; The PC boxes will not fit into one SRAM bank,
+; so they use multiple SECTIONs
+box_n = 0
+boxes: MACRO
+rept \1
+box_n = box_n + 1
+sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart
+endr
+ENDM
+
SECTION "Saved Boxes 1", SRAM ; BANK 2
-sBox1:: ds wBoxDataEnd - wBoxDataStart
-sBox2:: ds wBoxDataEnd - wBoxDataStart
-sBox3:: ds wBoxDataEnd - wBoxDataStart
-sBox4:: ds wBoxDataEnd - wBoxDataStart
-sBox5:: ds wBoxDataEnd - wBoxDataStart
-sBox6:: ds wBoxDataEnd - wBoxDataStart
+; sBox1 - sBox6
+ boxes 6
sBank2AllBoxesChecksum:: ds 1
sBank2IndividualBoxChecksums:: ds 6
-
SECTION "Saved Boxes 2", SRAM ; BANK 3
-sBox7:: ds wBoxDataEnd - wBoxDataStart
-sBox8:: ds wBoxDataEnd - wBoxDataStart
-sBox9:: ds wBoxDataEnd - wBoxDataStart
-sBox10:: ds wBoxDataEnd - wBoxDataStart
-sBox11:: ds wBoxDataEnd - wBoxDataStart
-sBox12:: ds wBoxDataEnd - wBoxDataStart
+; sBox7 - sBox12
+ boxes 6
sBank3AllBoxesChecksum:: ds 1
sBank3IndividualBoxChecksums:: ds 6
+
+; All 12 boxes fit within 2 SRAM banks
+ assert box_n == NUM_BOXES, \
+ "boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}"
diff --git a/vram.asm b/vram.asm
index d69d3f44..21230ac0 100644
--- a/vram.asm
+++ b/vram.asm
@@ -2,30 +2,30 @@ SECTION "VRAM", VRAM
UNION
; generic
-vChars0:: ds $800
-vChars1:: ds $800
-vChars2:: ds $800
-vBGMap0:: ds $400
-vBGMap1:: ds $400
+vChars0:: ds $80 tiles
+vChars1:: ds $80 tiles
+vChars2:: ds $80 tiles
+vBGMap0:: ds BG_MAP_WIDTH * BG_MAP_HEIGHT
+vBGMap1:: ds BG_MAP_WIDTH * BG_MAP_HEIGHT
NEXTU
; battle/menu
-vSprites:: ds $800
-vFont:: ds $800
-vFrontPic:: ds 7 * 7 * $10
-vBackPic:: ds 7 * 7 * $10
+vSprites:: ds $80 tiles
+vFont:: ds $80 tiles
+vFrontPic:: ds 7 * 7 tiles
+vBackPic:: ds 7 * 7 tiles
NEXTU
; overworld
-vNPCSprites:: ds $800
-vNPCSprites2:: ds $800
-vTileset:: ds $800
+vNPCSprites:: ds $80 tiles
+vNPCSprites2:: ds $80 tiles
+vTileset:: ds $80 tiles
NEXTU
; title
- ds $800
-vTitleLogo:: ds $800
- ds 7 * 7 * $10
-vTitleLogo2:: ds $1e0
+ ds $80 tiles
+vTitleLogo:: ds $80 tiles
+ ds 7 * 7 tiles
+vTitleLogo2:: ds 30 tiles
ENDU
diff --git a/wram.asm b/wram.asm
index a0033701..5fd243cb 100644
--- a/wram.asm
+++ b/wram.asm
@@ -177,22 +177,12 @@ wSpriteStateData1::
; - D
; - E
; - F
-wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1
-wSprite01StateData1:: spritestatedata1 wSprite01StateData1
-wSprite02StateData1:: spritestatedata1 wSprite02StateData1
-wSprite03StateData1:: spritestatedata1 wSprite03StateData1
-wSprite04StateData1:: spritestatedata1 wSprite04StateData1
-wSprite05StateData1:: spritestatedata1 wSprite05StateData1
-wSprite06StateData1:: spritestatedata1 wSprite06StateData1
-wSprite07StateData1:: spritestatedata1 wSprite07StateData1
-wSprite08StateData1:: spritestatedata1 wSprite08StateData1
-wSprite09StateData1:: spritestatedata1 wSprite09StateData1
-wSprite10StateData1:: spritestatedata1 wSprite10StateData1
-wSprite11StateData1:: spritestatedata1 wSprite11StateData1
-wSprite12StateData1:: spritestatedata1 wSprite12StateData1
-wSprite13StateData1:: spritestatedata1 wSprite13StateData1
-wSprite14StateData1:: spritestatedata1 wSprite14StateData1
-wSpritePikachuStateData1:: spritestatedata1 wSpritePikachuStateData1
+wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1 ; player is struct 0
+; wSprite02StateData1 - wSprite15StateData1
+for n, 1, NUM_SPRITESTATEDATA_STRUCTS - 1
+wSprite{02d:n}StateData1:: spritestatedata1 wSprite{02d:n}StateData1
+endr
+wSpritePikachuStateData1:: spritestatedata1 wSpritePikachuStateData1 ; pikachu is struct 15
wSpriteStateData2::
; more data for all sprites on the current map
@@ -215,23 +205,17 @@ wSpriteStateData2::
; - D: picture ID
; - E: sprite image base offset (in video ram, player always has value 1, used to compute sprite image index)
; - F
-wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2
-wSprite01StateData2:: spritestatedata2 wSprite01StateData2
-wSprite02StateData2:: spritestatedata2 wSprite02StateData2
-wSprite03StateData2:: spritestatedata2 wSprite03StateData2
-wSprite04StateData2:: spritestatedata2 wSprite04StateData2
-wSprite05StateData2:: spritestatedata2 wSprite05StateData2
-wSprite06StateData2:: spritestatedata2 wSprite06StateData2
-wSprite07StateData2:: spritestatedata2 wSprite07StateData2
-wSprite08StateData2:: spritestatedata2 wSprite08StateData2
-wSprite09StateData2:: spritestatedata2 wSprite09StateData2
-wSprite10StateData2:: spritestatedata2 wSprite10StateData2
-wSprite11StateData2:: spritestatedata2 wSprite11StateData2
-wSprite12StateData2:: spritestatedata2 wSprite12StateData2
-wSprite13StateData2:: spritestatedata2 wSprite13StateData2
-wSprite14StateData2:: spritestatedata2 wSprite14StateData2
-wSpritePikachuStateData2:: spritestatedata2 wSpritePikachuStateData2
-
+wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2 ; player is struct 0
+; wSprite02StateData2 - wSprite15StateData2
+for n, 1, NUM_SPRITESTATEDATA_STRUCTS - 1
+wSprite{02d:n}StateData2:: spritestatedata2 wSprite{02d:n}StateData2
+endr
+wSpritePikachuStateData2:: spritestatedata2 wSpritePikachuStateData2 ; pikachu is struct 15
+
+; The high byte of a pointer to anywhere within wSpriteStateData1 can be incremented
+; to reach within wSpriteStateData2, and vice-versa for decrementing.
+assert HIGH(wSpriteStateData1) + 1 == HIGH(wSpriteStateData2)
+assert LOW(wSpriteStateData1) == 0
wSpriteDataEnd::
@@ -240,7 +224,10 @@ SECTION "OAM Buffer", WRAM0
wOAMBuffer::
; buffer for OAM data. Copied to OAM by DMA
- ds 4 * 40
+; wOAMBufferSprite00 - wOAMBufferSprite39
+for n, NUM_SPRITE_OAM_STRUCTS
+wOAMBufferSprite{02d:n}:: ds 4
+endr
wOAMBufferEnd::
wTileMap::
@@ -2318,7 +2305,7 @@ wRepelRemainingSteps::
wMoves::
; list of moves for FormatMovesString
- ds 4
+ ds NUM_MOVES
wMoveNum::
ds 1
@@ -2528,20 +2515,26 @@ wPlayerName::
wPartyDataStart::
-wPartyCount:: ds 1
-wPartySpecies:: ds PARTY_LENGTH
-wPartyEnd:: ds 1
+wPartyCount:: ds 1
+wPartySpecies:: ds PARTY_LENGTH + 1
wPartyMons::
-wPartyMon1:: party_struct wPartyMon1
-wPartyMon2:: party_struct wPartyMon2
-wPartyMon3:: party_struct wPartyMon3
-wPartyMon4:: party_struct wPartyMon4
-wPartyMon5:: party_struct wPartyMon5
-wPartyMon6:: party_struct wPartyMon6
-
-wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH
-wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH
+; wPartyMon1 - wPartyMon6
+for n, 1, PARTY_LENGTH + 1
+wPartyMon{d:n}:: party_struct wPartyMon{d:n}
+endr
+
+wPartyMonOT::
+; wPartyMon1OT - wPartyMon6OT
+for n, 1, PARTY_LENGTH + 1
+wPartyMon{d:n}OT:: ds NAME_LENGTH
+endr
+
+wPartyMonNicks::
+; wPartyMon1Nick - wPartyMon6Nick
+for n, 1, PARTY_LENGTH + 1
+wPartyMon{d:n}Nick:: ds NAME_LENGTH
+endr
wPartyMonNicksEnd::
wPartyDataEnd::
@@ -3458,18 +3451,25 @@ wSerialEnemyDataBlock::
ds 9
wEnemyPartyCount:: ds 1
-wEnemyPartyMons:: ds PARTY_LENGTH + 1
+wEnemyPartySpecies:: ds PARTY_LENGTH + 1
wEnemyMons::
-wEnemyMon1:: party_struct wEnemyMon1
-wEnemyMon2:: party_struct wEnemyMon2
-wEnemyMon3:: party_struct wEnemyMon3
-wEnemyMon4:: party_struct wEnemyMon4
-wEnemyMon5:: party_struct wEnemyMon5
-wEnemyMon6:: party_struct wEnemyMon6
-
-wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH
-wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH
+; wEnemyMon1 - wEnemyMon6
+for n, 1, PARTY_LENGTH + 1
+wEnemyMon{d:n}:: party_struct wEnemyMon{d:n}
+endr
+
+wEnemyMonOT::
+; wEnemyMon1OT - wEnemyMon6OT
+for n, 1, PARTY_LENGTH + 1
+wEnemyMon{d:n}OT:: ds NAME_LENGTH
+endr
+
+wEnemyMonNicks::
+; wEnemyMon1Nick - wEnemyMon6Nick
+for n, 1, PARTY_LENGTH + 1
+wEnemyMon{d:n}Nick:: ds NAME_LENGTH
+endr
ENDU
@@ -3526,15 +3526,27 @@ wMainDataEnd::
wBoxDataStart::
-wNumInBox:: ds 1
+wBoxCount:: ds 1
wBoxSpecies:: ds MONS_PER_BOX + 1
wBoxMons::
-wBoxMon1:: box_struct wBoxMon1
-wBoxMon2:: ds BOX_STRUCT_LENGTH * (MONS_PER_BOX - 1)
-wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX
-wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX
+; wBoxMon1 - wBoxMon20
+for n, 1, MONS_PER_BOX + 1
+wBoxMon{d:n}:: box_struct wBoxMon{d:n}
+endr
+
+wBoxMonOT::
+; wBoxMon1OT - wBoxMon20OT
+for n, 1, MONS_PER_BOX + 1
+wBoxMon{d:n}OT:: ds NAME_LENGTH
+endr
+
+wBoxMonNicks::
+; wBoxMon1Nick - wBoxMon20Nick
+for n, 1, MONS_PER_BOX + 1
+wBoxMon{d:n}Nick:: ds NAME_LENGTH
+endr
wBoxMonNicksEnd::
wBoxDataEnd::