ref: 5e1865a7b160696de4f82f7d172c038f3b4726e0
parent: 6fa8a553cbb53a9abe59bee8d0cc176d19cde47f
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Aug 17 15:30:32 EDT 2020
Implement def_warps_to in a simpler way Instead of building a semicolon-separated "array" of warp_to coordinates in _WARP_TO_BUFFER, just declare a new EQUS for each one: _WARP_TO_NUM_1, _WARP_TO_NUM_2, etc. Then have def_warps_to output and PURGE each one of them.
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -42,10 +42,6 @@
_NUM_WARPS EQUS "_NUM_WARPS_\@"
db _NUM_WARPS
_NUM_WARPS = 0
- IF DEF(_WARP_TO_BUFFER)
- PURGE _WARP_TO_BUFFER
- ENDC
-_WARP_TO_BUFFER EQUS ""
ENDM
;\1 x position
@@ -55,10 +51,9 @@
warp: MACRO
db \2, \1, \3, \4
_NUM_WARPS = _NUM_WARPS + 1
-_TMP EQUS "{_WARP_TO_BUFFER}\1,\2; "
- PURGE _WARP_TO_BUFFER
-_WARP_TO_BUFFER EQUS "{_TMP}"
- PURGE _TMP
+_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
@@ -78,17 +73,18 @@
_NUM_SIGNS = _NUM_SIGNS + 1
ENDM
+;\1 source map
def_warps_to: MACRO
_WARP_TO_WIDTH = \1_WIDTH
+_WARP_TO_N = 1
REPT _NUM_WARPS
-_SEP = STRIN("{_WARP_TO_BUFFER}", ";")
-_WARP_TO_NTH EQUS STRCAT(STRCAT("warp_to ", STRSUB("{_WARP_TO_BUFFER}", 1, _SEP - 1)), ", _WARP_TO_WIDTH")
-_TMP EQUS STRSUB("{_WARP_TO_BUFFER}", _SEP + 1, STRLEN("{_WARP_TO_BUFFER}") - _SEP)
- PURGE _WARP_TO_BUFFER
-_WARP_TO_BUFFER EQUS "{_TMP}"
- PURGE _TMP
- _WARP_TO_NTH
- PURGE _WARP_TO_NTH
+_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