summaryrefslogtreecommitdiff
path: root/macros/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'macros/scripts')
-rw-r--r--macros/scripts/events.asm8
-rw-r--r--macros/scripts/maps.asm52
-rw-r--r--macros/scripts/text.asm7
3 files changed, 25 insertions, 42 deletions
diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm
index e55aa00e..c7fdb484 100644
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -184,8 +184,8 @@ ENDM
SetEvents: MACRO
SetEvent \1
REPT _NARG - 1
- SetEventReuseHL \2
- SHIFT
+ SetEventReuseHL \2
+ SHIFT
ENDR
ENDM
@@ -236,8 +236,8 @@ ENDM
ResetEvents: MACRO
ResetEvent \1
REPT _NARG - 1
- ResetEventReuseHL \2
- SHIFT
+ ResetEventReuseHL \2
+ SHIFT
ENDR
ENDM
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
diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm
index a947ca2f..c446c6c7 100644
--- a/macros/scripts/text.asm
+++ b/macros/scripts/text.asm
@@ -169,10 +169,9 @@ ENDM
script_mart: MACRO
db TX_SCRIPT_MART
db _NARG ; number of items
-REPT _NARG
- db \1 ; item id
- SHIFT
-ENDR
+ IF _NARG
+ db \# ; all item ids
+ ENDC
db -1 ; end
ENDM