ref: 2c5be6760437c363617ad4052a40e5f5fd8e7470
parent: 48b05947b7b05cccf6f8af9c8b65e1b4f2d85e54
author: yenatch <[email protected]>
date: Wed Feb 11 18:18:24 EST 2015
Move second map header macros into macros/map.asm. On second thought, keep the data separate from ugly macros.
--- a/macros/map.asm
+++ b/macros/map.asm
@@ -64,3 +64,90 @@
db \4 ; map group
db \5 ; map number
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
--- a/maps/second_map_headers.asm
+++ b/maps/second_map_headers.asm
@@ -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
connection west, ROUTE_29, Route29, 0, 0, 9, NEW_BARK_TOWN