aboutsummaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
authorvulcandth <vulcandth@gmail.com>2023-07-13 20:27:56 -0500
committerGitHub <noreply@github.com>2023-07-13 21:27:56 -0400
commitd001ced41b53271373753de835a9c3b3413dc318 (patch)
treeff2db7f403bddfcdeb12e50def8411cafedcdd5e /macros
parentMake wCurrentBoxNum a byte instead of word (#414) (diff)
downloadpokeyellow-d001ced41b53271373753de835a9c3b3413dc318.tar.gz
pokeyellow-d001ced41b53271373753de835a9c3b3413dc318.tar.xz
pokeyellow-d001ced41b53271373753de835a9c3b3413dc318.zip
Add macros, constants, and labels for map scripts and text (#367)
This introduces `def_script_pointers`, `def_text_pointers`, and `object_const_def` macros, and applies them to all maps. Most other map labels have also been identified.
Diffstat (limited to 'macros')
-rw-r--r--macros/const.asm5
-rw-r--r--macros/scripts/maps.asm24
2 files changed, 28 insertions, 1 deletions
diff --git a/macros/const.asm b/macros/const.asm
index 7c7f8591..e0a84404 100644
--- a/macros/const.asm
+++ b/macros/const.asm
@@ -39,6 +39,11 @@ MACRO const_next
endc
ENDM
+MACRO dw_const
+ dw \1
+ const \2
+ENDM
+
MACRO rb_skip
IF _NARG == 1
rsset _RS + \1
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index 5c1a8ad5..c5f0d1d0 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -29,6 +29,12 @@ MACRO object_event
ELSE
db \6
ENDC
+ ; items and trainers don't use a typical text id
+ IF _NARG > 6
+ REDEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID EQUS "0"
+ ELSE
+ REDEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID EQUS "\6"
+ ENDC
DEF {_NUM_OBJECT_EVENTS} += 1
ENDM
@@ -60,12 +66,22 @@ ENDM
;\3 sign id
MACRO bg_event
db \2, \1, \3
+ REDEF _BG_EVENT_{d:{_NUM_BG_EVENTS}}_TEXT_ID EQUS "\3"
DEF {_NUM_BG_EVENTS} += 1
ENDM
;\1 source map
MACRO def_warps_to
- FOR n, _NUM_WARP_EVENTS
+ ; text ID values are significant (see DisplayTextID in home/text_scripts.asm)
+ FOR n, {_NUM_BG_EVENTS}
+ ASSERT {_BG_EVENT_{d:n}_TEXT_ID} > {_NUM_OBJECT_EVENTS}, \
+ "A bg_event has text ID {_BG_EVENT_{d:n}_TEXT_ID} expected for an object_event ({d:{_NUM_OBJECT_EVENTS}} or below)"
+ ENDR
+ FOR n, {_NUM_OBJECT_EVENTS}
+ ASSERT {_OBJECT_EVENT_{d:n}_TEXT_ID} <= {_NUM_OBJECT_EVENTS}, \
+ "An object_event has text ID {_OBJECT_EVENT_{d:n}_TEXT_ID} expected for a bg_event (above {d:{_NUM_OBJECT_EVENTS}})"
+ ENDR
+ FOR n, {_NUM_WARP_EVENTS}
warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH
ENDR
ENDM
@@ -208,3 +224,9 @@ MACRO connection
db _y, _x
dw wOverworldMap + _win
ENDM
+
+DEF def_script_pointers EQUS "const_def"
+
+DEF def_text_pointers EQUS "const_def 1"
+
+DEF object_const_def EQUS "const_def 1"