summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-04-27 12:30:04 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-04-27 12:30:04 -0400
commit2a9ae6ecefe12e798c15e7a37a77005f5373aa9d (patch)
tree130d959ec25729831aad44d2e741b82af5dcf429 /macros
parent5f2d61034527ffd2c36eaa4d4079e9948dc809b4 (diff)
Use {interpolation} to generate sequences of RAM labels
This makes the table_width/assert_table_length usages unnecessary, and also keeps the labels automatically up to date if the length constants change.
Diffstat (limited to 'macros')
-rw-r--r--macros/wram.asm32
1 files changed, 20 insertions, 12 deletions
diff --git a/macros/wram.asm b/macros/wram.asm
index 419c8397..f791f053 100644
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -97,13 +97,23 @@ battle_struct: MACRO
ENDM
curbox: MACRO
-\1Count:: db
-\1Species:: ds MONS_PER_BOX + 1
+\1Count:: db
+\1Species:: ds MONS_PER_BOX + 1
\1Mons::
-\1Mon1:: box_struct \1Mon1
-\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX - 1)
-\1MonOTs:: ds NAME_LENGTH * MONS_PER_BOX
-\1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX
+; \1Mon1 - \1Mon20
+for n, 1, MONS_PER_BOX + 1
+\1Mon{d:n}:: box_struct \1Mon{d:n}
+endr
+\1MonOTs::
+; \1Mon1OT - \1Mon20OT
+for n, 1, MONS_PER_BOX + 1
+\1Mon{d:n}OT:: ds NAME_LENGTH
+endr
+\1MonNicknames::
+; \1Mon1Nickname - \1Mon20Nickname
+for n, 1, MONS_PER_BOX + 1
+\1Mon{d:n}Nickname:: ds MON_NAME_LENGTH
+endr
\1MonNicknamesEnd::
\1End::
ENDM
@@ -206,12 +216,10 @@ ENDM
hall_of_fame: MACRO
\1WinCount:: db
-\1Mon1:: hof_mon \1Mon1
-\1Mon2:: hof_mon \1Mon2
-\1Mon3:: hof_mon \1Mon3
-\1Mon4:: hof_mon \1Mon4
-\1Mon5:: hof_mon \1Mon5
-\1Mon6:: hof_mon \1Mon6
+; \1Mon1 - \1Mon6
+for n, 1, PARTY_LENGTH + 1
+\1Mon{d:n}:: hof_mon \1Mon{d:n}
+endr
\1End:: db
ENDM