Move second map header macros into macros/map.asm.

On second thought, keep the data separate from ugly macros.
This commit is contained in:
yenatch 2015-02-11 23:18:24 -08:00
parent 48b05947b7
commit 2c5be67604
2 changed files with 87 additions and 85 deletions

View File

@ -64,3 +64,90 @@ warp_def: macro
db \4 ; map group db \4 ; map group
db \5 ; map number db \5 ; map number
endm endm
map_header_2: MACRO
; label, map, border block, connections
\1_SecondMapHeader::
db \3
\2\@HEIGHT EQUS "\2_HEIGHT"
\2\@WIDTH EQUS "\2_WIDTH"
db \2\@HEIGHT, \2\@WIDTH
db BANK(\1_BlockData)
dw \1_BlockData
db BANK(\1_MapScriptHeader)
dw \1_MapScriptHeader
dw \1_MapEventHeader
db \4
ENDM
connection: MACRO
if "\1" == "north"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \2_WIDTH * (\2_HEIGHT - 3) + \5
dw OverworldMap + \4 + 3
db \6
db \2_WIDTH
db \2_HEIGHT * 2 - 1
db (\4 - \5) * -2
dw OverworldMap + \2_HEIGHT * (\2_WIDTH + 6) + 1
endc
if "\1" == "south"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \5
dw OverworldMap + (\7_HEIGHT + 3) * (\7_WIDTH + 6) + \4 + 3
db \6
db \2_WIDTH
db 0
db (\4 - \5) * -2
dw OverworldMap + \2_WIDTH + 7
endc
if "\1" == "west"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5) + \2_WIDTH - 3
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3)
db \6
db \2_WIDTH
db (\4 - \5) * -2
db \2_WIDTH * 2 - 1
dw OverworldMap + \2_WIDTH * 2 + 6
endc
if "\1" == "east"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5)
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3 + 1) - 3
db \6
db \2_WIDTH
db (\4 - \5) * -2
db 0
dw OverworldMap + \2_WIDTH + 7
endc
ENDM

View File

@ -1,88 +1,3 @@
map_header_2: MACRO
; label, map, border block, connections
\1_SecondMapHeader::
db \3
\2\@HEIGHT EQUS "\2_HEIGHT"
\2\@WIDTH EQUS "\2_WIDTH"
db \2\@HEIGHT, \2\@WIDTH
db BANK(\1_BlockData)
dw \1_BlockData
db BANK(\1_MapScriptHeader)
dw \1_MapScriptHeader
dw \1_MapEventHeader
db \4
ENDM
connection: MACRO
if "\1" == "north"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \2_WIDTH * (\2_HEIGHT - 3) + \5
dw OverworldMap + \4 + 3
db \6
db \2_WIDTH
db \2_HEIGHT * 2 - 1
db (\4 - \5) * -2
dw OverworldMap + \2_HEIGHT * (\2_WIDTH + 6) + 1
endc
if "\1" == "south"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \5
dw OverworldMap + (\7_HEIGHT + 3) * (\7_WIDTH + 6) + \4 + 3
db \6
db \2_WIDTH
db 0
db (\4 - \5) * -2
dw OverworldMap + \2_WIDTH + 7
endc
if "\1" == "west"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5) + \2_WIDTH - 3
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3)
db \6
db \2_WIDTH
db (\4 - \5) * -2
db \2_WIDTH * 2 - 1
dw OverworldMap + \2_WIDTH * 2 + 6
endc
if "\1" == "east"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5)
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3 + 1) - 3
db \6
db \2_WIDTH
db (\4 - \5) * -2
db 0
dw OverworldMap + \2_WIDTH + 7
endc
ENDM
map_header_2 NewBarkTown, NEW_BARK_TOWN, $5, WEST | EAST ; 0x94dd8 map_header_2 NewBarkTown, NEW_BARK_TOWN, $5, WEST | EAST ; 0x94dd8
connection west, ROUTE_29, Route29, 0, 0, 9, NEW_BARK_TOWN connection west, ROUTE_29, Route29, 0, 0, 9, NEW_BARK_TOWN