summaryrefslogtreecommitdiff
path: root/macros/scripts/maps.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-04-17 19:06:56 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-04-17 19:06:56 -0400
commitdd690920c9f8502b649f1022fadbb99fab67a44a (patch)
tree6241fa9659e8ba2a82ea6fa45194dbd6e5dc39ef /macros/scripts/maps.asm
parent4b64b146e4d723980d26470d171fb18e63f4a215 (diff)
Use rgbds 0.5.0 features:
- FOR loops - {interpolation} - REDEF EQUS - \# for all macro args
Diffstat (limited to 'macros/scripts/maps.asm')
-rw-r--r--macros/scripts/maps.asm52
1 files changed, 18 insertions, 34 deletions
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index 204098ad..8ab5c46d 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -1,10 +1,7 @@
def_objects: MACRO
- IF DEF(_NUM_OBJECTS)
- PURGE _NUM_OBJECTS
- ENDC
-_NUM_OBJECTS EQUS "_NUM_OBJECTS_\@"
- db _NUM_OBJECTS
-_NUM_OBJECTS = 0
+REDEF _NUM_OBJECTS EQUS "_NUM_OBJECTS_\@"
+ db {_NUM_OBJECTS}
+{_NUM_OBJECTS} = 0
ENDM
;\1 sprite id
@@ -32,16 +29,13 @@ object: MACRO
ELSE
db \6
ENDC
-_NUM_OBJECTS = _NUM_OBJECTS + 1
+{_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
+REDEF _NUM_WARPS EQUS "_NUM_WARPS_\@"
+ db {_NUM_WARPS}
+{_NUM_WARPS} = 0
ENDM
;\1 x position
@@ -50,19 +44,15 @@ ENDM
;\4 destination map (-1 = wLastMap)
warp: MACRO
db \2, \1, \3, \4
-_TMP EQUS "\n_WARP_{d:{_NUM_WARPS}}_X = \1\n_WARP_{d:{_NUM_WARPS}}_Y = \2"
- _TMP
- PURGE _TMP
-_NUM_WARPS = _NUM_WARPS + 1
+_WARP_{d:{_NUM_WARPS}}_X = \1
+_WARP_{d:{_NUM_WARPS}}_Y = \2
+{_NUM_WARPS} = {_NUM_WARPS} + 1
ENDM
def_signs: MACRO
- IF DEF(_NUM_SIGNS)
- PURGE _NUM_SIGNS
- ENDC
-_NUM_SIGNS EQUS "_NUM_SIGNS_\@"
- db _NUM_SIGNS
-_NUM_SIGNS = 0
+REDEF _NUM_SIGNS EQUS "_NUM_SIGNS_\@"
+ db {_NUM_SIGNS}
+{_NUM_SIGNS} = 0
ENDM
;\1 x position
@@ -70,17 +60,13 @@ ENDM
;\3 sign id
sign: MACRO
db \2, \1, \3
-_NUM_SIGNS = _NUM_SIGNS + 1
+{_NUM_SIGNS} = {_NUM_SIGNS} + 1
ENDM
;\1 source map
def_warps_to: MACRO
-N = 0
- REPT _NUM_WARPS
-_TMP EQUS "warp_to _WARP_{d:N}_X, _WARP_{d:N}_Y, \1_WIDTH"
- _TMP
- PURGE _TMP
-N = N + 1
+ FOR n, _NUM_WARPS
+ warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH
ENDR
ENDM
@@ -146,10 +132,8 @@ 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
+ dw {CURRENT_MAP_OBJECT}
+ PURGE CURRENT_MAP_WIDTH, CURRENT_MAP_HEIGHT, CURRENT_MAP_OBJECT
ENDM
; Connections go in order: north, south, west, east