summaryrefslogtreecommitdiff
path: root/macros/scripts/maps.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2021-04-17 21:00:28 -0500
committerdannye <33dannye@gmail.com>2021-04-17 21:00:28 -0500
commitd4154b289176647ff20e19879de70073bd6d9a30 (patch)
treef4175a9303dd0e1430f4c42e79a4d5ffb1f32c00 /macros/scripts/maps.asm
parenta1081856200cec52ba881fc6f878f5ce0328ab0a (diff)
parent2fdcb1a3d6919f378b2f83f14d3b3822a19fcc33 (diff)
Merge branch 'master' of https://github.com/pret/pokered
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