From 4373aafac152f64621bf3d8c6b8d037cd9c76f7b Mon Sep 17 00:00:00 2001 From: Rangi Date: Mon, 17 Aug 2020 17:47:28 -0400 Subject: Use def_warps_to macro for automatic warp_to entries --- macros/scripts/maps.asm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'macros/scripts/maps.asm') diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index efe82dc8..381fe7f5 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -42,6 +42,10 @@ endc _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 @@ -51,6 +55,10 @@ ENDM 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 ENDM def_signs: MACRO @@ -70,6 +78,21 @@ sign: MACRO _NUM_SIGNS = _NUM_SIGNS + 1 ENDM +def_warps_to: MACRO +_WARP_TO_WIDTH EQU \1_WIDTH + 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 + ENDR +PURGE _WARP_TO_WIDTH +ENDM + ;\1 x position ;\2 y position ;\3 map width -- cgit v1.2.3