aboutsummaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2023-11-20 00:33:27 -0600
committerdannye <33dannye@gmail.com>2023-11-20 20:23:27 -0600
commit298e99d3776580585c3f434e5d93137ae431bdd3 (patch)
treea808c4ffd0fd0f9bd28972bae5236e0d3345c8e5 /macros
parentAdd sound bits documentation for wOptions (#110) (diff)
parentName 2 unnamed labels I missed in SeafoamIslandsB4F and PokemonMansion3F (#437) (diff)
downloadpokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.tar.gz
pokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.tar.xz
pokeyellow-298e99d3776580585c3f434e5d93137ae431bdd3.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'macros')
-rw-r--r--macros/const.asm10
-rw-r--r--macros/scripts/maps.asm24
2 files changed, 33 insertions, 1 deletions
diff --git a/macros/const.asm b/macros/const.asm
index 7c7f8591..fa2f0753 100644
--- a/macros/const.asm
+++ b/macros/const.asm
@@ -18,6 +18,11 @@ MACRO const
DEF const_value += const_inc
ENDM
+MACRO const_export
+ const \1
+ EXPORT \1
+ENDM
+
MACRO shift_const
DEF \1 EQU 1 << const_value
DEF const_value += const_inc
@@ -39,6 +44,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"