2022-06-06 14:25:42 -07:00
|
|
|
MACRO map_attributes
|
2018-02-03 13:58:49 -08:00
|
|
|
;\1: map name
|
|
|
|
;\2: map id
|
|
|
|
;\3: border block
|
|
|
|
;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF CURRENT_MAP_WIDTH = \2_WIDTH
|
|
|
|
DEF CURRENT_MAP_HEIGHT = \2_HEIGHT
|
2018-02-03 13:58:49 -08:00
|
|
|
\1_MapAttributes::
|
|
|
|
db \3
|
|
|
|
db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH
|
|
|
|
db BANK(\1_Blocks)
|
|
|
|
dw \1_Blocks
|
2019-01-12 12:17:20 -08:00
|
|
|
db BANK(\1_MapScripts) ; aka BANK(\1_MapEvents)
|
2018-02-03 13:58:49 -08:00
|
|
|
dw \1_MapScripts
|
|
|
|
dw \1_MapEvents
|
|
|
|
db \4
|
|
|
|
ENDM
|
|
|
|
|
2018-02-26 10:41:48 -08:00
|
|
|
; Connections go in order: north, south, west, east
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO connection
|
2018-02-03 13:58:49 -08:00
|
|
|
;\1: direction
|
|
|
|
;\2: map name
|
|
|
|
;\3: map id
|
2018-11-10 15:32:05 -08:00
|
|
|
;\4: offset of the target map relative to the current map
|
|
|
|
; (x offset for east/west, y offset for north/south)
|
2018-11-10 05:27:46 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
; LEGACY: Support for old connection macro
|
|
|
|
if _NARG == 6
|
|
|
|
connection \1, \2, \3, (\4) - (\5)
|
|
|
|
else
|
|
|
|
|
|
|
|
; Calculate tile offsets for source (current) and target maps
|
|
|
|
DEF _src = 0
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _tgt = (\4) + MAP_CONNECTION_PADDING_WIDTH
|
2022-06-06 14:25:42 -07:00
|
|
|
if _tgt < 0
|
|
|
|
DEF _src = -_tgt
|
|
|
|
DEF _tgt = 0
|
|
|
|
endc
|
|
|
|
|
|
|
|
if !STRCMP("\1", "north")
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _blk = \3_WIDTH * (\3_HEIGHT - MAP_CONNECTION_PADDING_WIDTH) + _src
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF _map = _tgt
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _win = (\3_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2) * \3_HEIGHT + 1
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF _y = \3_HEIGHT * 2 - 1
|
|
|
|
DEF _x = (\4) * -2
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _len = CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH - (\4)
|
2022-06-06 14:25:42 -07:00
|
|
|
if _len > \3_WIDTH
|
|
|
|
DEF _len = \3_WIDTH
|
|
|
|
endc
|
|
|
|
|
|
|
|
elif !STRCMP("\1", "south")
|
|
|
|
DEF _blk = _src
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _map = (CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2) * (CURRENT_MAP_HEIGHT + MAP_CONNECTION_PADDING_WIDTH) + _tgt
|
|
|
|
DEF _win = \3_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2 + 1
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF _y = 0
|
|
|
|
DEF _x = (\4) * -2
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _len = CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH - (\4)
|
2022-06-06 14:25:42 -07:00
|
|
|
if _len > \3_WIDTH
|
|
|
|
DEF _len = \3_WIDTH
|
|
|
|
endc
|
|
|
|
|
|
|
|
elif !STRCMP("\1", "west")
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _blk = (\3_WIDTH * _src) + \3_WIDTH - MAP_CONNECTION_PADDING_WIDTH
|
|
|
|
DEF _map = (CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2) * _tgt
|
|
|
|
DEF _win = (\3_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2) * 2 - MAP_CONNECTION_PADDING_WIDTH * 2
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF _y = (\4) * -2
|
|
|
|
DEF _x = \3_WIDTH * 2 - 1
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _len = CURRENT_MAP_HEIGHT + MAP_CONNECTION_PADDING_WIDTH - (\4)
|
2022-06-06 14:25:42 -07:00
|
|
|
if _len > \3_HEIGHT
|
|
|
|
DEF _len = \3_HEIGHT
|
|
|
|
endc
|
|
|
|
|
|
|
|
elif !STRCMP("\1", "east")
|
|
|
|
DEF _blk = (\3_WIDTH * _src)
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _map = (CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2) * _tgt + CURRENT_MAP_WIDTH + MAP_CONNECTION_PADDING_WIDTH
|
|
|
|
DEF _win = \3_WIDTH + MAP_CONNECTION_PADDING_WIDTH * 2 + 1
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF _y = (\4) * -2
|
|
|
|
DEF _x = 0
|
2023-07-26 17:50:16 -07:00
|
|
|
DEF _len = CURRENT_MAP_HEIGHT + MAP_CONNECTION_PADDING_WIDTH - (\4)
|
2022-06-06 14:25:42 -07:00
|
|
|
if _len > \3_HEIGHT
|
|
|
|
DEF _len = \3_HEIGHT
|
|
|
|
endc
|
|
|
|
|
|
|
|
else
|
|
|
|
fail "Invalid direction for 'connection'."
|
|
|
|
endc
|
2018-11-10 15:32:05 -08:00
|
|
|
|
2018-02-03 13:58:49 -08:00
|
|
|
map_id \3
|
2018-11-10 15:32:05 -08:00
|
|
|
dw \2_Blocks + _blk
|
|
|
|
dw wOverworldMapBlocks + _map
|
|
|
|
db _len - _src
|
2018-02-03 13:58:49 -08:00
|
|
|
db \3_WIDTH
|
2018-11-10 15:32:05 -08:00
|
|
|
db _y, _x
|
|
|
|
dw wOverworldMapBlocks + _win
|
2022-06-06 14:25:42 -07:00
|
|
|
|
|
|
|
endc
|
2018-02-03 13:58:49 -08:00
|
|
|
ENDM
|
|
|
|
|
2023-08-11 03:28:14 -07:00
|
|
|
map_attributes Level1_Map1, LEVEL_1_MAP_1, $00, SOUTH | NORTH
|
|
|
|
connection south, Level1_Map1, LEVEL_1_MAP_1, 0
|
|
|
|
connection north, Level1_Map1, LEVEL_1_MAP_1, 0
|
2018-11-06 12:19:07 -08:00
|
|
|
|
2023-07-25 06:33:08 -07:00
|
|
|
; map_attributes NewBarkTown, NEW_BARK_TOWN, $05, WEST | EAST
|
|
|
|
; connection west, Route29, ROUTE_29, 0
|
|
|
|
; connection east, Route27, ROUTE_27, 0
|
2023-09-02 15:22:23 -07:00
|
|
|
|
|
|
|
if DEF(_DEBUG)
|
|
|
|
map_attributes DebugLevel1_Map1, DEBUGLEVEL_1_MAP_1, $00, SOUTH | NORTH
|
|
|
|
connection south, DebugLevel1_Map1, DEBUGLEVEL_1_MAP_1, 0
|
|
|
|
connection north, DebugLevel1_Map1, DEBUGLEVEL_1_MAP_1, 0
|
|
|
|
endc
|