From f37cf959c930ae9595f9f71ce0d9b17dcf5421d0 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 14 Jul 2020 10:21:18 -0400 Subject: Clean up some data, using macros for multiline list entries --- macros/scripts/maps.asm | 50 ++++++------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'macros/scripts/maps.asm') diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index 37da8c58..a097fb88 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -1,39 +1,3 @@ -;\1 map width -;\2 Rows above (Y-blocks) -;\3 X movement (X-blocks) -EVENT_DISP: MACRO - dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\2) >> 1) + ((\3) >> 1)) ; Ev.Disp - db \2,\3 ;Y,X -ENDM - -FLYWARP_DATA: MACRO - EVENT_DISP \1,\2,\3 - db ((\2) & $01) ;sub-block Y - db ((\3) & $01) ;sub-block X -ENDM - -; external map entry macro -EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer -; the appearance of towns and routes in the town map, indexed by map id - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - dn \2, \1 - dw \3 -ENDM - -; internal map entry macro -IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer -; the appearance of buildings and dungeons in the town map - ; byte : maximum map id subject to this rule - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - db \1 + 1 - dn \3, \2 - dw \4 -ENDM - ;\1 sprite id ;\2 x position ;\3 y position @@ -49,17 +13,15 @@ object: MACRO db \2 + 4 db \4 db \5 - IF (_NARG > 7) + IF _NARG > 7 db TRAINER | \6 db \7 db \8 + ELIF _NARG > 6 + db ITEM | \6 + db \7 ELSE - IF (_NARG > 6) - db ITEM | \6 - db \7 - ELSE - db \6 - ENDC + db \6 ENDC ENDM @@ -82,7 +44,7 @@ ENDM ;\2 y position ;\3 map width warp_to: MACRO - EVENT_DISP \3, \2, \1 + event_displacement \3, \1, \2 ENDM ;\1 map name -- cgit v1.2.3 From 5c0f33cb5350d3e11bd75cc04d943549667ecd4c Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 14 Jul 2020 15:45:36 -0400 Subject: Use a 'trainer' macro for trainers in scripts/ --- macros/scripts/maps.asm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'macros/scripts/maps.asm') diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index a097fb88..6f643672 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -47,6 +47,27 @@ warp_to: MACRO event_displacement \3, \1, \2 ENDM + +;\1 event flag +;\2 view range +;\3 TextBeforeBattle +;\4 TextAfterBattle +;\5 TextEndBattle +trainer: MACRO + IF _NARG > 5 + dbEventFlagBit \1, \2 + db (\3 << 4) + dwEventFlagAddress \1, \2 + SHIFT + ELSE + dbEventFlagBit \1 + db (\2 << 4) + dwEventFlagAddress \1 + ENDC + dw \3, \5, \4, \4 +ENDM + + ;\1 map name ;\2 map id ;\3 tileset -- cgit v1.2.3 From 93d0697f37aca8ed7a21298a980876af6d43268b Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 14 Jul 2020 16:07:23 -0400 Subject: Don't compare strings with ==; use STRCMP --- macros/scripts/maps.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'macros/scripts/maps.asm') diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index 6f643672..f2009209 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -109,7 +109,7 @@ _src = -_tgt _tgt = 0 ENDC -IF "\1" == "north" +IF !STRCMP("\1", "north") _blk = \3_WIDTH * (\3_HEIGHT - 3) + _src _map = _tgt _win = (\3_WIDTH + 6) * \3_HEIGHT + 1 @@ -120,7 +120,7 @@ IF _len > \3_WIDTH _len = \3_WIDTH ENDC -ELIF "\1" == "south" +ELIF !STRCMP("\1", "south") _blk = _src _map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt _win = \3_WIDTH + 7 @@ -131,7 +131,7 @@ IF _len > \3_WIDTH _len = \3_WIDTH ENDC -ELIF "\1" == "west" +ELIF !STRCMP("\1", "west") _blk = (\3_WIDTH * _src) + \3_WIDTH - 3 _map = (CURRENT_MAP_WIDTH + 6) * _tgt _win = (\3_WIDTH + 6) * 2 - 6 @@ -142,7 +142,7 @@ IF _len > \3_HEIGHT _len = \3_HEIGHT ENDC -ELIF "\1" == "east" +ELIF !STRCMP("\1", "east") _blk = (\3_WIDTH * _src) _map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 _win = \3_WIDTH + 7 -- cgit v1.2.3