summaryrefslogtreecommitdiff
path: root/macros/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'macros/scripts')
-rw-r--r--macros/scripts/maps.asm56
1 files changed, 53 insertions, 3 deletions
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index 8722b4d0..2032629b 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -1,3 +1,12 @@
+def_objects: MACRO
+ IF DEF(_NUM_OBJECTS)
+ PURGE _NUM_OBJECTS
+ ENDC
+_NUM_OBJECTS EQUS "_NUM_OBJECTS_\@"
+ db _NUM_OBJECTS
+_NUM_OBJECTS = 0
+ENDM
+
;\1 sprite id
;\2 x position
;\3 y position
@@ -23,6 +32,16 @@ object: MACRO
ELSE
db \6
ENDC
+_NUM_OBJECTS = _NUM_OBJECTS + 1
+ENDM
+
+def_warps: MACRO
+ IF DEF(_NUM_WARPS)
+ PURGE _NUM_WARPS
+ ENDC
+_NUM_WARPS EQUS "_NUM_WARPS_\@"
+ db _NUM_WARPS
+_NUM_WARPS = 0
ENDM
;\1 x position
@@ -31,6 +50,20 @@ ENDM
;\4 destination map (-1 = wLastMap)
warp: MACRO
db \2, \1, \3, \4
+_NUM_WARPS = _NUM_WARPS + 1
+; the Nth warp defines a corresponding Nth warp_to, stored in _WARP_TO_NUM_<N>
+_WARP_TO_NAME EQUS "_WARP_TO_NUM_{d:{_NUM_WARPS}}"
+_WARP_TO_NAME EQUS "warp_to \1, \2, _WARP_TO_WIDTH"
+ PURGE _WARP_TO_NAME
+ENDM
+
+def_signs: MACRO
+ IF DEF(_NUM_SIGNS)
+ PURGE _NUM_SIGNS
+ ENDC
+_NUM_SIGNS EQUS "_NUM_SIGNS_\@"
+ db _NUM_SIGNS
+_NUM_SIGNS = 0
ENDM
;\1 x position
@@ -38,6 +71,23 @@ ENDM
;\3 sign id
sign: MACRO
db \2, \1, \3
+_NUM_SIGNS = _NUM_SIGNS + 1
+ENDM
+
+;\1 source map
+def_warps_to: MACRO
+; output and purge each _WARP_TO_NUM_<N> warp_to, from N=1 to _NUM_WARPS
+_WARP_TO_WIDTH = \1_WIDTH
+_WARP_TO_N = 1
+ REPT _NUM_WARPS
+_WARP_TO_NAME EQUS "_WARP_TO_NUM_{d:_WARP_TO_N}"
+ _WARP_TO_NAME
+_WARP_TO_N = _WARP_TO_N + 1
+_PURGE_WARP_TO_NUM EQUS "PURGE {_WARP_TO_NAME}"
+ _PURGE_WARP_TO_NUM
+ PURGE _PURGE_WARP_TO_NUM
+ PURGE _WARP_TO_NAME
+ ENDR
ENDM
;\1 x position
@@ -96,9 +146,9 @@ ENDM
; Comes after map_header and connection macros
end_map_header: MACRO
dw CURRENT_MAP_OBJECT
-PURGE CURRENT_MAP_WIDTH
-PURGE CURRENT_MAP_HEIGHT
-PURGE CURRENT_MAP_OBJECT
+ PURGE CURRENT_MAP_WIDTH
+ PURGE CURRENT_MAP_HEIGHT
+ PURGE CURRENT_MAP_OBJECT
ENDM
; Connections go in order: north, south, west, east