ref: 968c0c493cfc9bffe4501598585c8e1b05a352c4
parent: f0d8e69adcb176e82deb588c6b6e1ba8a12f5123
author: Bryan Bishop <[email protected]>
date: Sun Jan 15 20:40:25 EST 2012
formulas for map header connections instead of raw values hg-commit-id: b6822898d929
--- a/common.asm
+++ b/common.asm
@@ -8055,7 +8055,7 @@
dw CeladonCityBlocks, CeladonCityTexts, CeladonCityScript ; blocks, texts, scripts
db WEST | EAST ; connections
- ; connection data
+ ; connections data
db ROUTE_16
dw $4B95, $C7C1 ; pointers (connected, current) (strip)
@@ -8069,7 +8069,7 @@
db $F8, $00 ; alignments (y, x)
dw $C6F9 ; window
- ; end connection data
+ ; end connections data
dw CeladonCityObject ; objects
@@ -8187,24 +8187,27 @@
; connections data
db ROUTE_2
- dw Route2Blocks + (Route2Height - 3) * Route2Width, $C6F0 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $47, $f6 ; alignments (y, x)
- dw $c929 ; window
+ dw Route2Blocks + (Route2Height - 3) * Route2Width ; connection strip location
+ dw $C6EB + 5 ; current map position
+ db Route2Width, Route2Width ; bigness, width
+ db (Route2Height * 2) - 1, (5 * -2) ; alignments (y, x)
+ dw $C6E9 + Route2Height * (Route2Width + 6) ; window
db ROUTE_1
- dw Route1Blocks, $c912 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $f6 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route1Blocks ; connection strip location
+ dw $C6EB + (ViridianCityHeight + 3) * (ViridianCityWidth + 6) + 5 ; current map position
+ db Route1Width, Route1Width ; bigness, width
+ db 0, (5 * -2) ; alignments (y, x)
+ dw $C6EF + Route1Width ; window
db ROUTE_22
- dw Route22Blocks - 3 + (Route22Width), $c79e ; pointers (connected, current) (strip)
- db $09, $14 ; bigness, width
- db $f8, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw Route22Blocks - 3 + (Route22Width) ; connection strip location
+ dw $C6E8 + (ViridianCityWidth + 6) * (4 + 3) ; current map position
+ db Route22Height, Route22Width ; bigness, width
+ db (4 * -2), (Route22Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route22Width ; window
- ; end connection data
+ ; end connections data
dw ViridianCityObject ; objects
@@ -8254,18 +8257,20 @@
; connections data
db ROUTE_2
- dw Route2Blocks, $c912 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $f6 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route2Blocks ; connection strip location
+ dw $C6EB + (PewterCityHeight + 3) * (PewterCityWidth + 6) + 5 ; current map position
+ db Route2Width, Route2Width ; bigness, width
+ db 0, (5 * -2) ; alignments (y, x)
+ dw $C6EF + Route2Width ; window
db ROUTE_3
- dw Route3Blocks + (Route3Width * 0), $c7b5 ; pointers (connected, current) (strip)
- db $09, $23 ; bigness, width
- db $f8, $00 ; alignments (y, x)
- dw $c712 ; window
+ dw Route3Blocks + (Route3Width * 0) ; connection strip location
+ dw $C6E5 + (PewterCityWidth + 6) * (4 + 4) ; current map position
+ db Route3Height, Route3Width ; bigness, width
+ db (4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route3Width ; window
- ; end connection data
+ ; end connections data
dw PewterCityObject ; objects
@@ -8320,30 +8325,34 @@
; connections data
db ROUTE_24
- dw Route24Blocks + (Route24Height - 3) * Route24Width, $c6f0 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $23, $f6 ; alignments (y, x)
- dw $c809 ; window
+ dw Route24Blocks + (Route24Height - 3) * Route24Width ; connection strip location
+ dw $C6EB + 5 ; current map position
+ db Route24Width, Route24Width ; bigness, width
+ db (Route24Height * 2) - 1, (5 * -2) ; alignments (y, x)
+ dw $C6E9 + Route24Height * (Route24Width + 6) ; window
db ROUTE_5
- dw Route5Blocks, $c912 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $f6 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route5Blocks ; connection strip location
+ dw $C6EB + (CeruleanCityHeight + 3) * (CeruleanCityWidth + 6) + 5 ; current map position
+ db Route5Width, Route5Width ; bigness, width
+ db 0, (5 * -2) ; alignments (y, x)
+ dw $C6EF + Route5Width ; window
db ROUTE_4
- dw Route4Blocks - 3 + (Route4Width), $c79e ; pointers (connected, current) (strip)
- db $09, $2d ; bigness, width
- db $f8, $59 ; alignments (y, x)
- dw $c748 ; window
+ dw Route4Blocks - 3 + (Route4Width) ; connection strip location
+ dw $C6E8 + (CeruleanCityWidth + 6) * (4 + 3) ; current map position
+ db Route4Height, Route4Width ; bigness, width
+ db (4 * -2), (Route4Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route4Width ; window
db ROUTE_9
- dw Route9Blocks + (Route9Width * 0), $c7b5 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $f8, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route9Blocks + (Route9Width * 0) ; connection strip location
+ dw $C6E5 + (CeruleanCityWidth + 6) * (4 + 4) ; current map position
+ db Route9Height, Route9Width ; bigness, width
+ db (4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route9Width ; window
- ; end connection data
+ ; end connections data
dw CeruleanCityObject ; objects
@@ -8407,18 +8416,20 @@
; connections data
db ROUTE_6
- dw Route6Blocks + (Route6Height - 3) * Route6Width, $c6f0 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $23, $f6 ; alignments (y, x)
- dw $c809 ; window
+ dw Route6Blocks + (Route6Height - 3) * Route6Width ; connection strip location
+ dw $C6EB + 5 ; current map position
+ db Route6Width, Route6Width ; bigness, width
+ db (Route6Height * 2) - 1, (5 * -2) ; alignments (y, x)
+ dw $C6E9 + Route6Height * (Route6Width + 6) ; window
db ROUTE_11
- dw Route11Blocks + (Route11Width * 0), $c7b5 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $f8, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route11Blocks + (Route11Width * 0) ; connection strip location
+ dw $C6E5 + (VermilionCityWidth + 6) * (4 + 4) ; current map position
+ db Route11Height, Route11Width ; bigness, width
+ db (4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route11Width ; window
- ; end connection data
+ ; end connections data
dw VermilionCityObject ; objects
@@ -8476,24 +8487,27 @@
; connections data
db ROUTE_19
- dw Route19Blocks, $c912 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $f6 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route19Blocks ; connection strip location
+ dw $C6EB + (FuchsiaCityHeight + 3) * (FuchsiaCityWidth + 6) + 5 ; current map position
+ db Route19Width, Route19Width ; bigness, width
+ db 0, (5 * -2) ; alignments (y, x)
+ dw $C6EF + Route19Width ; window
db ROUTE_18
- dw Route18Blocks - 3 + (Route18Width), $c79e ; pointers (connected, current) (strip)
- db $09, $19 ; bigness, width
- db $f8, $31 ; alignments (y, x)
- dw $c720 ; window
+ dw Route18Blocks - 3 + (Route18Width) ; connection strip location
+ dw $C6E8 + (FuchsiaCityWidth + 6) * (4 + 3) ; current map position
+ db Route18Height, Route18Width ; bigness, width
+ db (4 * -2), (Route18Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route18Width ; window
db ROUTE_15
- dw Route15Blocks + (Route15Width * 0), $c7b5 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $f8, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route15Blocks + (Route15Width * 0) ; connection strip location
+ dw $C6E5 + (FuchsiaCityWidth + 6) * (4 + 4) ; current map position
+ db Route15Height, Route15Width ; bigness, width
+ db (4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route15Width ; window
- ; end connection data
+ ; end connections data
dw FuchsiaCityObject ; objects
@@ -10393,18 +10407,20 @@
; connections data
db ROUTE_21
- dw Route21Blocks + (Route21Height - 3) * Route21Width, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $59, $00 ; alignments (y, x)
- dw $c9b9 ; window
+ dw Route21Blocks + (Route21Height - 3) * Route21Width ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db Route21Width, Route21Width ; bigness, width
+ db (Route21Height * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + Route21Height * (Route21Width + 6) ; window
db ROUTE_20
- dw Route20Blocks + (Route20Width * 0), $c725 ; pointers (connected, current) (strip)
- db $09, $32 ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c721 ; window
+ dw Route20Blocks + (Route20Width * 0) ; connection strip location
+ dw $C6E5 + (CinnabarIslandWidth + 6) * (0 + 4) ; current map position
+ db Route20Height, Route20Width ; bigness, width
+ db (0 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route20Width ; window
- ; end connection data
+ ; end connections data
dw CinnabarIslandObject ; objects
@@ -10459,7 +10475,7 @@
db $00, $00 ; alignments (y, x)
dw $c6f9 ; window
- ; end connection data
+ ; end connections data
dw Route1Object ; objects
@@ -20415,24 +20431,27 @@
; connections data
db ROUTE_10
- dw Route10Blocks + (Route10Height - 3) * Route10Width, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $47, $00 ; alignments (y, x)
- dw $c929 ; window
+ dw Route10Blocks + (Route10Height - 3) * Route10Width ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db Route10Width, Route10Width ; bigness, width
+ db (Route10Height * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + Route10Height * (Route10Width + 6) ; window
db ROUTE_12
- dw Route12Blocks, $c7ab ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route12Blocks ; connection strip location
+ dw $C6EB + (LavenderTownHeight + 3) * (LavenderTownWidth + 6) + 0 ; current map position
+ db Route12Width, Route12Width ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + Route12Width ; window
db ROUTE_8
- dw Route8Blocks - 3 + (Route8Width), $c718 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $00, $3b ; alignments (y, x)
- dw $c72a ; window
+ dw Route8Blocks - 3 + (Route8Width) ; connection strip location
+ dw $C6E8 + (LavenderTownWidth + 6) * (0 + 3) ; current map position
+ db Route8Height, Route8Width ; bigness, width
+ db (0 * -2), (Route8Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route8Width ; window
- ; end connection data
+ ; end connections data
dw LavenderTownObject ; objects
@@ -22447,18 +22466,20 @@
; connections data
db CELADON_CITY
- dw CeladonCityBlocks - 3 + (CeladonCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $19 ; bigness, width
- db $08, $31 ; alignments (y, x)
- dw $c720 ; window
+ dw CeladonCityBlocks - 3 + (CeladonCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route7Width + 6) * (-3 + 3) ; current map position
+ db $f, CeladonCityWidth ; bigness, width
+ db (-4 * -2), (CeladonCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * CeladonCityWidth ; window
db SAFFRON_CITY
- dw SaffronCityBlocks + (SaffronCityWidth), $c6f5 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $00 ; alignments (y, x)
- dw $c703 ; window
+ dw SaffronCityBlocks + (SaffronCityWidth) ; connection strip location
+ dw $C6E5 + (Route7Width + 6) * (-3 + 4) ; current map position
+ db $f, SaffronCityWidth ; bigness, width
+ db (-4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + SaffronCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route7Object ; objects
@@ -25573,18 +25594,20 @@
; connections data
db ROUTE_23
- dw Route23Blocks + (Route23Height - 3) * Route23Width, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $8f, $00 ; alignments (y, x)
- dw $cb69 ; window
+ dw Route23Blocks + (Route23Height - 3) * Route23Width ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db Route23Width, Route23Width ; bigness, width
+ db (Route23Height * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + Route23Height * (Route23Width + 6) ; window
db VIRIDIAN_CITY
- dw ViridianCityBlocks + (ViridianCityWidth), $c6ff ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $00 ; alignments (y, x)
- dw $c703 ; window
+ dw ViridianCityBlocks + (ViridianCityWidth) ; connection strip location
+ dw $C6E5 + (Route22Width + 6) * (-3 + 4) ; current map position
+ db $f, ViridianCityWidth ; bigness, width
+ db (-4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + ViridianCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route22Object ; objects
@@ -25616,18 +25639,20 @@
; connections data
db CINNABAR_ISLAND
- dw CinnabarIslandBlocks - 3 + (CinnabarIslandWidth), $c790 ; pointers (connected, current) (strip)
- db $09, $0a ; bigness, width
- db $00, $13 ; alignments (y, x)
- dw $c702 ; window
+ dw CinnabarIslandBlocks - 3 + (CinnabarIslandWidth) ; connection strip location
+ dw $C6E8 + (Route20Width + 6) * (0 + 3) ; current map position
+ db CinnabarIslandHeight, CinnabarIslandWidth ; bigness, width
+ db (0 * -2), (CinnabarIslandWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * CinnabarIslandWidth ; window
db ROUTE_19
- dw Route19Blocks + (Route19Width * 15), $c71d ; pointers (connected, current) (strip)
- db $0c, $0a ; bigness, width
- db $24, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route19Blocks + (Route19Width * 15) ; connection strip location
+ dw $C6E5 + (Route20Width + 6) * (-3 + 4) ; current map position
+ db $c, Route19Width ; bigness, width
+ db (-18 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route19Width ; window
- ; end connection data
+ ; end connections data
dw Route20Object ; objects
@@ -25670,18 +25695,20 @@
; connections data
db INDIGO_PLATEAU
- dw IndigoPlateauBlocks + (IndigoPlateauHeight - 3) * IndigoPlateauWidth, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $11, $00 ; alignments (y, x)
- dw $c779 ; window
+ dw IndigoPlateauBlocks + (IndigoPlateauHeight - 3) * IndigoPlateauWidth ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db IndigoPlateauWidth, IndigoPlateauWidth ; bigness, width
+ db (IndigoPlateauHeight * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + IndigoPlateauHeight * (IndigoPlateauWidth + 6) ; window
db ROUTE_22
- dw Route22Blocks, $cb9b ; pointers (connected, current) (strip)
- db $0d, $14 ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c703 ; window
+ dw Route22Blocks ; connection strip location
+ dw $C6EB + (Route23Height + 3) * (Route23Width + 6) + 0 ; current map position
+ db $d, Route22Width ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + Route22Width ; window
- ; end connection data
+ ; end connections data
dw Route23Object ; objects
@@ -25724,18 +25751,20 @@
; connections data
db CERULEAN_CITY
- dw CeruleanCityBlocks + 2, $c838 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $00, $0a ; alignments (y, x)
- dw $c703 ; window
+ dw CeruleanCityBlocks + 2 ; connection strip location
+ dw $C6EB + (Route24Height + 3) * (Route24Width + 6) + -3 ; current map position
+ db $10, CeruleanCityWidth ; bigness, width
+ db 0, (-5 * -2) ; alignments (y, x)
+ dw $C6EF + CeruleanCityWidth ; window
db ROUTE_25
- dw Route25Blocks + (Route25Width * 0), $c725 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route25Blocks + (Route25Width * 0) ; connection strip location
+ dw $C6E5 + (Route24Width + 6) * (0 + 4) ; current map position
+ db Route25Height, Route25Width ; bigness, width
+ db (0 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route25Width ; window
- ; end connection data
+ ; end connections data
dw Route24Object ; objects
@@ -25768,12 +25797,13 @@
; connections data
db ROUTE_24
- dw Route24Blocks - 3 + (Route24Width), $c754 ; pointers (connected, current) (strip)
- db $0c, $0a ; bigness, width
- db $00, $13 ; alignments (y, x)
- dw $c702 ; window
+ dw Route24Blocks - 3 + (Route24Width) ; connection strip location
+ dw $C6E8 + (Route25Width + 6) * (0 + 3) ; current map position
+ db $c, Route24Width ; bigness, width
+ db (0 * -2), (Route24Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route24Width ; window
- ; end connection data
+ ; end connections data
dw Route25Object ; objects
@@ -25813,12 +25843,13 @@
; connections data
db ROUTE_23
- dw Route23Blocks, $c7ab ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route23Blocks ; connection strip location
+ dw $C6EB + (IndigoPlateauHeight + 3) * (IndigoPlateauWidth + 6) + 0 ; current map position
+ db Route23Width, Route23Width ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + Route23Width ; window
- ; end connection data
+ ; end connections data
dw IndigoPlateauObject ; objects
@@ -25854,30 +25885,34 @@
; connections data
db ROUTE_5
- dw Route5Blocks + (Route5Height - 3) * Route5Width, $c6f0 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $23, $f6 ; alignments (y, x)
- dw $c809 ; window
+ dw Route5Blocks + (Route5Height - 3) * Route5Width ; connection strip location
+ dw $C6EB + 5 ; current map position
+ db Route5Width, Route5Width ; bigness, width
+ db (Route5Height * 2) - 1, (5 * -2) ; alignments (y, x)
+ dw $C6E9 + Route5Height * (Route5Width + 6) ; window
db ROUTE_6
- dw Route6Blocks, $c912 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $f6 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route6Blocks ; connection strip location
+ dw $C6EB + (SaffronCityHeight + 3) * (SaffronCityWidth + 6) + 5 ; current map position
+ db Route6Width, Route6Width ; bigness, width
+ db 0, (5 * -2) ; alignments (y, x)
+ dw $C6EF + Route6Width ; window
db ROUTE_7
- dw Route7Blocks - 3 + (Route7Width), $c79e ; pointers (connected, current) (strip)
- db $09, $0a ; bigness, width
- db $f8, $13 ; alignments (y, x)
- dw $c702 ; window
+ dw Route7Blocks - 3 + (Route7Width) ; connection strip location
+ dw $C6E8 + (SaffronCityWidth + 6) * (4 + 3) ; current map position
+ db Route7Height, Route7Width ; bigness, width
+ db (4 * -2), (Route7Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route7Width ; window
db ROUTE_8
- dw Route8Blocks + (Route8Width * 0), $c7b5 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $f8, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route8Blocks + (Route8Width * 0) ; connection strip location
+ dw $C6E5 + (SaffronCityWidth + 6) * (4 + 4) ; current map position
+ db Route8Height, Route8Width ; bigness, width
+ db (4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route8Width ; window
- ; end connection data
+ ; end connections data
dw SaffronCityObject ; objects
@@ -27627,18 +27662,20 @@
; connections data
db ROUTE_4
- dw Route4Blocks + (Route4Height - 3) * Route4Width, $c704 ; pointers (connected, current) (strip)
- db $0d, $2d ; bigness, width
- db $11, $ce ; alignments (y, x)
- dw $c8b4 ; window
+ dw Route4Blocks + (Route4Height - 3) * Route4Width ; connection strip location
+ dw $C6EB + 25 ; current map position
+ db $d, Route4Width ; bigness, width
+ db (Route4Height * 2) - 1, (25 * -2) ; alignments (y, x)
+ dw $C6E9 + Route4Height * (Route4Width + 6) ; window
db PEWTER_CITY
- dw PewterCityBlocks - 3 + (PewterCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw PewterCityBlocks - 3 + (PewterCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route3Width + 6) * (-3 + 3) ; current map position
+ db $f, PewterCityWidth ; bigness, width
+ db (-4 * -2), (PewterCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * PewterCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route3Object ; objects
@@ -27673,18 +27710,20 @@
; connections data
db ROUTE_3
- dw Route3Blocks + 22, $c94c ; pointers (connected, current) (strip)
- db $0d, $23 ; bigness, width
- db $00, $32 ; alignments (y, x)
- dw $c712 ; window
+ dw Route3Blocks + 22 ; connection strip location
+ dw $C6EB + (Route4Height + 3) * (Route4Width + 6) + -3 ; current map position
+ db $d, Route3Width ; bigness, width
+ db 0, (-25 * -2) ; alignments (y, x)
+ dw $C6EF + Route3Width ; window
db CERULEAN_CITY
- dw CeruleanCityBlocks + (CeruleanCityWidth), $c718 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $00 ; alignments (y, x)
- dw $c703 ; window
+ dw CeruleanCityBlocks + (CeruleanCityWidth) ; connection strip location
+ dw $C6E5 + (Route4Width + 6) * (-3 + 4) ; current map position
+ db $f, CeruleanCityWidth ; bigness, width
+ db (-4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + CeruleanCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route4Object ; objects
@@ -27723,18 +27762,20 @@
; connections data
db CERULEAN_CITY
- dw CeruleanCityBlocks + (CeruleanCityHeight - 3) * CeruleanCityWidth + 2, $c6e8 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $23, $0a ; alignments (y, x)
- dw $c8bd ; window
+ dw CeruleanCityBlocks + (CeruleanCityHeight - 3) * CeruleanCityWidth + 2 ; connection strip location
+ dw $C6EB + -3 ; current map position
+ db $10, CeruleanCityWidth ; bigness, width
+ db (CeruleanCityHeight * 2) - 1, (-5 * -2) ; alignments (y, x)
+ dw $C6E9 + CeruleanCityHeight * (CeruleanCityWidth + 6) ; window
db SAFFRON_CITY
- dw SaffronCityBlocks + 2, $c838 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $00, $0a ; alignments (y, x)
- dw $c703 ; window
+ dw SaffronCityBlocks + 2 ; connection strip location
+ dw $C6EB + (Route5Height + 3) * (Route5Width + 6) + -3 ; current map position
+ db $10, SaffronCityWidth ; bigness, width
+ db 0, (-5 * -2) ; alignments (y, x)
+ dw $C6EF + SaffronCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route5Object ; objects
@@ -27772,18 +27813,20 @@
; connections data
db CERULEAN_CITY
- dw CeruleanCityBlocks - 3 + (CeruleanCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw CeruleanCityBlocks - 3 + (CeruleanCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route9Width + 6) * (-3 + 3) ; current map position
+ db $f, CeruleanCityWidth ; bigness, width
+ db (-4 * -2), (CeruleanCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * CeruleanCityWidth ; window
db ROUTE_10
- dw Route10Blocks + (Route10Width * 0), $c775 ; pointers (connected, current) (strip)
- db $0c, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route10Blocks + (Route10Width * 0) ; connection strip location
+ dw $C6E5 + (Route9Width + 6) * (0 + 4) ; current map position
+ db $c, Route10Width ; bigness, width
+ db (0 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route10Width ; window
- ; end connection data
+ ; end connections data
dw Route9Object ; objects
@@ -27819,18 +27862,20 @@
; connections data
db ROUTE_12
- dw Route12Blocks + (Route12Height - 3) * Route12Width, $c6ff ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $6b, $d8 ; alignments (y, x)
- dw $ca49 ; window
+ dw Route12Blocks + (Route12Height - 3) * Route12Width ; connection strip location
+ dw $C6EB + 20 ; current map position
+ db Route12Width, Route12Width ; bigness, width
+ db (Route12Height * 2) - 1, (20 * -2) ; alignments (y, x)
+ dw $C6E9 + Route12Height * (Route12Width + 6) ; window
db ROUTE_14
- dw Route14Blocks - 3 + (Route14Width), $c754 ; pointers (connected, current) (strip)
- db $0c, $0a ; bigness, width
- db $00, $13 ; alignments (y, x)
- dw $c702 ; window
+ dw Route14Blocks - 3 + (Route14Width) ; connection strip location
+ dw $C6E8 + (Route13Width + 6) * (0 + 3) ; current map position
+ db $c, Route14Width ; bigness, width
+ db (0 * -2), (Route14Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route14Width ; window
- ; end connection data
+ ; end connections data
dw Route13Object ; objects
@@ -27868,18 +27913,20 @@
; connections data
db ROUTE_15
- dw Route15Blocks - 3 + (Route15Width), $c838 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $dc, $3b ; alignments (y, x)
- dw $c72a ; window
+ dw Route15Blocks - 3 + (Route15Width) ; connection strip location
+ dw $C6E8 + (Route14Width + 6) * (18 + 3) ; current map position
+ db Route15Height, Route15Width ; bigness, width
+ db (18 * -2), (Route15Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route15Width ; window
db ROUTE_13
- dw Route13Blocks + (Route13Width * 0), $c725 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c70d ; window
+ dw Route13Blocks + (Route13Width * 0) ; connection strip location
+ dw $C6E5 + (Route14Width + 6) * (0 + 4) ; current map position
+ db Route13Height, Route13Width ; bigness, width
+ db (0 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route13Width ; window
- ; end connection data
+ ; end connections data
dw Route14Object ; objects
@@ -27915,18 +27962,20 @@
; connections data
db ROUTE_16
- dw Route16Blocks + (Route16Height - 3) * Route16Width, $c6eb ; pointers (connected, current) (strip)
- db $0d, $14 ; bigness, width
- db $11, $00 ; alignments (y, x)
- dw $c7d3 ; window
+ dw Route16Blocks + (Route16Height - 3) * Route16Width ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db $d, Route16Width ; bigness, width
+ db (Route16Height * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + Route16Height * (Route16Width + 6) ; window
db ROUTE_18
- dw Route18Blocks, $cb9b ; pointers (connected, current) (strip)
- db $0d, $19 ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c708 ; window
+ dw Route18Blocks ; connection strip location
+ dw $C6EB + (Route17Height + 3) * (Route17Width + 6) + 0 ; current map position
+ db $d, Route18Width ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + Route18Width ; window
- ; end connection data
+ ; end connections data
dw Route17Object ; objects
@@ -27967,18 +28016,20 @@
; connections data
db FUCHSIA_CITY
- dw FuchsiaCityBlocks + (FuchsiaCityHeight - 3) * FuchsiaCityWidth + 2, $c6e8 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $23, $0a ; alignments (y, x)
- dw $c8bd ; window
+ dw FuchsiaCityBlocks + (FuchsiaCityHeight - 3) * FuchsiaCityWidth + 2 ; connection strip location
+ dw $C6EB + -3 ; current map position
+ db $10, FuchsiaCityWidth ; bigness, width
+ db (FuchsiaCityHeight * 2) - 1, (-5 * -2) ; alignments (y, x)
+ dw $C6E9 + FuchsiaCityHeight * (FuchsiaCityWidth + 6) ; window
db ROUTE_20
- dw Route20Blocks - 3 + (Route20Width), $c838 ; pointers (connected, current) (strip)
- db $09, $32 ; bigness, width
- db $dc, $63 ; alignments (y, x)
- dw $c752 ; window
+ dw Route20Blocks - 3 + (Route20Width) ; connection strip location
+ dw $C6E8 + (Route19Width + 6) * (18 + 3) ; current map position
+ db Route20Height, Route20Width ; bigness, width
+ db (18 * -2), (Route20Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route20Width ; window
- ; end connection data
+ ; end connections data
dw Route19Object ; objects
@@ -28014,18 +28065,20 @@
; connections data
db PALLET_TOWN
- dw PalletTownBlocks + (PalletTownHeight - 3) * PalletTownWidth, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $11, $00 ; alignments (y, x)
- dw $c779 ; window
+ dw PalletTownBlocks + (PalletTownHeight - 3) * PalletTownWidth ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db PalletTownWidth, PalletTownWidth ; bigness, width
+ db (PalletTownHeight * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + PalletTownHeight * (PalletTownWidth + 6) ; window
db CINNABAR_ISLAND
- dw CinnabarIslandBlocks, $c9eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw CinnabarIslandBlocks ; connection strip location
+ dw $C6EB + (Route21Height + 3) * (Route21Width + 6) + 0 ; current map position
+ db CinnabarIslandWidth, CinnabarIslandWidth ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + CinnabarIslandWidth ; window
- ; end connection data
+ ; end connections data
dw Route21Object ; objects
@@ -29209,18 +29262,20 @@
; connections data
db SAFFRON_CITY
- dw SaffronCityBlocks + (SaffronCityHeight - 3) * SaffronCityWidth + 2, $c6e8 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $23, $0a ; alignments (y, x)
- dw $c8bd ; window
+ dw SaffronCityBlocks + (SaffronCityHeight - 3) * SaffronCityWidth + 2 ; connection strip location
+ dw $C6EB + -3 ; current map position
+ db $10, SaffronCityWidth ; bigness, width
+ db (SaffronCityHeight * 2) - 1, (-5 * -2) ; alignments (y, x)
+ dw $C6E9 + SaffronCityHeight * (SaffronCityWidth + 6) ; window
db VERMILION_CITY
- dw VermilionCityBlocks + 2, $c838 ; pointers (connected, current) (strip)
- db $10, $14 ; bigness, width
- db $00, $0a ; alignments (y, x)
- dw $c703 ; window
+ dw VermilionCityBlocks + 2 ; connection strip location
+ dw $C6EB + (Route6Height + 3) * (Route6Width + 6) + -3 ; current map position
+ db $10, VermilionCityWidth ; bigness, width
+ db 0, (-5 * -2) ; alignments (y, x)
+ dw $C6EF + VermilionCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route6Object ; objects
@@ -29262,18 +29317,20 @@
; connections data
db SAFFRON_CITY
- dw SaffronCityBlocks - 3 + (SaffronCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw SaffronCityBlocks - 3 + (SaffronCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route8Width + 6) * (-3 + 3) ; current map position
+ db $f, SaffronCityWidth ; bigness, width
+ db (-4 * -2), (SaffronCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * SaffronCityWidth ; window
db LAVENDER_TOWN
- dw LavenderTownBlocks + (LavenderTownWidth * 0), $c775 ; pointers (connected, current) (strip)
- db $09, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw LavenderTownBlocks + (LavenderTownWidth * 0) ; connection strip location
+ dw $C6E5 + (Route8Width + 6) * (0 + 4) ; current map position
+ db LavenderTownHeight, LavenderTownWidth ; bigness, width
+ db (0 * -2), 0 ; alignments (y, x)
+ dw $C6EF + LavenderTownWidth ; window
- ; end connection data
+ ; end connections data
dw Route8Object ; objects
@@ -29320,18 +29377,20 @@
; connections data
db LAVENDER_TOWN
- dw LavenderTownBlocks, $c95b ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw LavenderTownBlocks ; connection strip location
+ dw $C6EB + (Route10Height + 3) * (Route10Width + 6) + 0 ; current map position
+ db LavenderTownWidth, LavenderTownWidth ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + LavenderTownWidth ; window
db ROUTE_9
- dw Route9Blocks - 3 + (Route9Width), $c718 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $00, $3b ; alignments (y, x)
- dw $c72a ; window
+ dw Route9Blocks - 3 + (Route9Width) ; connection strip location
+ dw $C6E8 + (Route10Width + 6) * (0 + 3) ; current map position
+ db Route9Height, Route9Width ; bigness, width
+ db (0 * -2), (Route9Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route9Width ; window
- ; end connection data
+ ; end connections data
dw Route10Object ; objects
@@ -29376,18 +29435,20 @@
; connections data
db VERMILION_CITY
- dw VermilionCityBlocks - 3 + (VermilionCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw VermilionCityBlocks - 3 + (VermilionCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route11Width + 6) * (-3 + 3) ; current map position
+ db $f, VermilionCityWidth ; bigness, width
+ db (-4 * -2), (VermilionCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * VermilionCityWidth ; window
db ROUTE_12
- dw Route12Blocks + (Route12Width * 24), $c709 ; pointers (connected, current) (strip)
- db $0f, $0a ; bigness, width
- db $36, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route12Blocks + (Route12Width * 24) ; connection strip location
+ dw $C6E5 + (Route11Width + 6) * (-3 + 4) ; current map position
+ db $f, Route12Width ; bigness, width
+ db (-27 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route12Width ; window
- ; end connection data
+ ; end connections data
dw Route11Object ; objects
@@ -29435,24 +29496,27 @@
; connections data
db LAVENDER_TOWN
- dw LavenderTownBlocks + (LavenderTownHeight - 3) * LavenderTownWidth, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $11, $00 ; alignments (y, x)
- dw $c779 ; window
+ dw LavenderTownBlocks + (LavenderTownHeight - 3) * LavenderTownWidth ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db LavenderTownWidth, LavenderTownWidth ; bigness, width
+ db (LavenderTownHeight * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + LavenderTownHeight * (LavenderTownWidth + 6) ; window
db ROUTE_13
- dw Route13Blocks + 17, $ca78 ; pointers (connected, current) (strip)
- db $0d, $1e ; bigness, width
- db $00, $28 ; alignments (y, x)
- dw $c70d ; window
+ dw Route13Blocks + 17 ; connection strip location
+ dw $C6EB + (Route12Height + 3) * (Route12Width + 6) + -3 ; current map position
+ db $d, Route13Width ; bigness, width
+ db 0, (-20 * -2) ; alignments (y, x)
+ dw $C6EF + Route13Width ; window
db ROUTE_11
- dw Route11Blocks - 3 + (Route11Width), $c8c8 ; pointers (connected, current) (strip)
- db $09, $1e ; bigness, width
- db $ca, $3b ; alignments (y, x)
- dw $c72a ; window
+ dw Route11Blocks - 3 + (Route11Width) ; connection strip location
+ dw $C6E8 + (Route12Width + 6) * (27 + 3) ; current map position
+ db Route11Height, Route11Width ; bigness, width
+ db (27 * -2), (Route11Width * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * Route11Width ; window
- ; end connection data
+ ; end connections data
dw Route12Object ; objects
@@ -29499,18 +29563,20 @@
; connections data
db FUCHSIA_CITY
- dw FuchsiaCityBlocks - 3 + (FuchsiaCityWidth * 2), $c6e8 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $27 ; alignments (y, x)
- dw $c716 ; window
+ dw FuchsiaCityBlocks - 3 + (FuchsiaCityWidth * 2) ; connection strip location
+ dw $C6E8 + (Route15Width + 6) * (-3 + 3) ; current map position
+ db $f, FuchsiaCityWidth ; bigness, width
+ db (-4 * -2), (FuchsiaCityWidth * 2) - 1 ; alignments (y, x)
+ dw $C6EE + 2 * FuchsiaCityWidth ; window
db ROUTE_14
- dw Route14Blocks + (Route14Width * 15), $c709 ; pointers (connected, current) (strip)
- db $0c, $0a ; bigness, width
- db $24, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route14Blocks + (Route14Width * 15) ; connection strip location
+ dw $C6E5 + (Route15Width + 6) * (-3 + 4) ; current map position
+ db $c, Route14Width ; bigness, width
+ db (-18 * -2), 0 ; alignments (y, x)
+ dw $C6EF + Route14Width ; window
- ; end connection data
+ ; end connections data
dw Route15Object ; objects
@@ -29557,18 +29623,20 @@
; connections data
db ROUTE_17
- dw Route17Blocks, $c823 ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $00, $00 ; alignments (y, x)
- dw $c6f9 ; window
+ dw Route17Blocks ; connection strip location
+ dw $C6EB + (Route16Height + 3) * (Route16Width + 6) + 0 ; current map position
+ db Route17Width, Route17Width ; bigness, width
+ db 0, (0 * -2) ; alignments (y, x)
+ dw $C6EF + Route17Width ; window
db CELADON_CITY
- dw CeladonCityBlocks + (CeladonCityWidth), $c6ff ; pointers (connected, current) (strip)
- db $0f, $19 ; bigness, width
- db $08, $00 ; alignments (y, x)
- dw $c708 ; window
+ dw CeladonCityBlocks + (CeladonCityWidth) ; connection strip location
+ dw $C6E5 + (Route16Width + 6) * (-3 + 4) ; current map position
+ db $f, CeladonCityWidth ; bigness, width
+ db (-4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + CeladonCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route16Object ; objects
@@ -29622,18 +29690,20 @@
; connections data
db ROUTE_17
- dw Route17Blocks + (Route17Height - 3) * Route17Width, $c6eb ; pointers (connected, current) (strip)
- db $0a, $0a ; bigness, width
- db $8f, $00 ; alignments (y, x)
- dw $cb69 ; window
+ dw Route17Blocks + (Route17Height - 3) * Route17Width ; connection strip location
+ dw $C6EB + 0 ; current map position
+ db Route17Width, Route17Width ; bigness, width
+ db (Route17Height * 2) - 1, (0 * -2) ; alignments (y, x)
+ dw $C6E9 + Route17Height * (Route17Width + 6) ; window
db FUCHSIA_CITY
- dw FuchsiaCityBlocks + (FuchsiaCityWidth), $c704 ; pointers (connected, current) (strip)
- db $0f, $14 ; bigness, width
- db $08, $00 ; alignments (y, x)
- dw $c703 ; window
+ dw FuchsiaCityBlocks + (FuchsiaCityWidth) ; connection strip location
+ dw $C6E5 + (Route18Width + 6) * (-3 + 4) ; current map position
+ db $f, FuchsiaCityWidth ; bigness, width
+ db (-4 * -2), 0 ; alignments (y, x)
+ dw $C6EF + FuchsiaCityWidth ; window
- ; end connection data
+ ; end connections data
dw Route18Object ; objects
--- a/extras/connection_helper.py
+++ b/extras/connection_helper.py
@@ -56,7 +56,7 @@
shift = result
calculated = map2_blocks_pointer + shift
output += "shift: " + str(shift) + "\n"
- formula += "Blocks + " + str(shift)
+ formula += " + " + str(shift)
elif direction == "WEST":
calculated = map2_blocks_pointer - 3 + (map2_width)
result = connected_pointer - calculated
--- a/extras/replace_dimensions.py
+++ b/extras/replace_dimensions.py
@@ -6,7 +6,35 @@
from add_map_labels_to_map_headers import find_with_start_of_line
from pretty_map_headers import map_name_cleaner, spacing, offset_to_pointer, map_constants
from connection_helper import print_connections
+from ctypes import c_int8
+# X/Y_Movement_Of_Connection
+#~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# A X movement is how many map blocks there are to the left of one of your north/south connections.
+# A Y movement is how many map blocks there are above your west/east connection.
+
+#===============================================================================
+# #4-#5 : Current Map Position
+#===============================================================================
+#
+# This points to the part of the current map (further up in RAM)
+# that the connection strips upperleft block is placed on the current map.
+#
+# ____________________
+# Connection |
+# Direction | Formula
+# ___________|_______
+#
+# North: C6EB + X_Movement_of_Connection Strip
+#
+# South: C6EB + (Height of Map + 3) * (Width of Map + 6) +
+# X_Movement_of_Connection Strip
+#
+# West: C6E8 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 3)
+#
+# East: C6E5 + (Width of Map + 6) * (Y_Movement_of_"Connection Strip" + 4)
+
asm = None
asm_lines = None
def load_asm():
@@ -14,6 +42,35 @@
asm = open("../common.asm", "r").read()
asm_lines = asm.split("\n")
+def get_xy_movement_of_connection_strip(map_id, connection_id):
+ map1 = extract_maps.map_headers[map_id]
+ connections = map1["connections"]
+ connection = connections[connection_id]
+ direction = connection["direction"]
+ current_map_location = int(connection["current_map_tile_pointer"], 16)
+
+ map2 = extract_maps.map_headers[connection["map_id"]]
+ map2_height = int(map2["y"], 16)
+ map2_width = int(map2["x"], 16)
+
+ y_mov = None
+ #if direction == "WEST":
+ # y_mov = ((current_map_location - 0xC6E8) / (map2_width + 6)) - 3
+ #elif direction == "EAST":
+ # y_mov = ((current_map_location - 0xC6E5) / (map2_width + 6)) - 4
+ if direction in ["WEST", "EAST"]:
+ y_mov = c_int8(connection["y"]).value / -2
+
+ x_mov = None
+ #if direction == "NORTH":
+ # x_mov = current_map_location - 0xC6EB
+ #elif direction == "SOUTH":
+ # x_mov = current_map_location - 0xC6EB - ((map2_height + 3) * (map2_width + 6))
+ if direction in ["NORTH", "SOUTH"]:
+ x_mov = c_int8(connection["x"]).value / -2
+
+ return {"y_mov": y_mov, "x_mov": x_mov}
+
def find_line_starting_with(value):
global asm_lines
id = 0
@@ -24,10 +81,56 @@
id += 1
return False #not found
+def current_map_position_formula(map_id, connection_id):
+ map1_id = map_id
+ map1 = extract_maps.map_headers[map_id]
+ connections = map1["connections"]
+ connection = connections[connection_id]
+ map1_height = int(map1["y"], 16)
+ map1_width = int(map1["x"], 16)
+ map1_name = map1["name"]
+ map1_name = map_name_cleaner(map1_name, None)[:-2]
+
+ direction = connection["direction"]
+ current_map_location = int(connection["current_map_tile_pointer"], 16)
+
+ map2_id = connection["map_id"]
+ map2 = extract_maps.map_headers[map2_id]
+ map2_name = map2["name"]
+ map2_name = map_name_cleaner(map2_name, None)[:-2]
+ map2_height = int(map2["y"], 16)
+ map2_width = int(map2["x"], 16)
+
+ y_mov = None
+ if direction == "WEST":
+ y_mov = ((current_map_location - 0xC6E8) / (map1_width + 6)) - 3
+ elif direction == "EAST":
+ y_mov = ((current_map_location - 0xC6E5) / (map1_width + 6)) - 4
+
+ x_mov = None
+ if direction == "NORTH":
+ x_mov = current_map_location - 0xC6EB
+ elif direction == "SOUTH":
+ x_mov = current_map_location - 0xC6EB - ((map1_height + 3) * (map1_width + 6))
+
+ formula = ""
+ if direction == "NORTH":
+ formula = "$C6EB + " + str(x_mov)
+ elif direction == "SOUTH":
+ formula = "$C6EB + (" + map1_name + "Height + 3) * (" + map1_name + "Width + 6) + " + str(x_mov)
+ elif direction == "WEST":
+ formula = "$C6E8 + (" + map1_name + "Width + 6) * (" + str(y_mov) + " + 3)"
+ elif direction == "EAST":
+ formula = "$C6E5 + (" + map1_name + "Width + 6) * (" + str(y_mov) + " + 4)"
+
+ return formula
+
def replace_values():
- global asm_lines
- for map_id in extract_maps.map_headers.keys():
+ global asm_lines #0-15 ok
+ for map_id in [3]: #extract_maps.map_headers.keys():
if map_id in extract_maps.bad_maps: continue #skip
+ if map_id == 12: continue #skip Route 1
+
map1 = extract_maps.map_headers[map_id]
label_name = map_name_cleaner(map1["name"], None)
clean_name = label_name[:-2]
@@ -46,16 +149,90 @@
connection_offset = line_number + 8
for connection_id in map1["connections"]:
- if "dw $" in asm_lines[connection_offset + 1]:
+ connection = map1["connections"][connection_id]
+ direction = connection["direction"]
+ map2_id = connection["map_id"]
+ map2 = extract_maps.map_headers[map2_id]
+ map2_name = map_name_cleaner(map2["name"], None)[:-2]
+ map2_height = int(map2["y"], 16)
+ map2_width = int(map2["x"], 16)
+
+ movements = get_xy_movement_of_connection_strip(map_id, connection_id)
+ y_mov = movements["y_mov"]
+ x_mov = movements["x_mov"]
+
+ #replace the first two pointers
+ if " dw " in asm_lines[connection_offset + 1]:
formula = print_connections(map_id, in_connection_id=connection_id)
+ formula2 = current_map_position_formula(map_id, connection_id)
temp_line = asm_lines[connection_offset + 1]
- temp_line = spacing + "dw " + formula + temp_line[12:]
+ temp_line = spacing + "dw " + formula + " ; connection strip location\n" #connection strip location
+ temp_line += spacing + "dw " + formula2 + " ; current map position" #current map position
asm_lines[connection_offset + 1] = temp_line
+ #bigness, width
+ if "bigness, width" in asm_lines[connection_offset + 2]:
+ temp_line = spacing + "db "
+
+ if int(connection["bigness"],16) == map2_width:
+ temp_line += map2_name + "Width"
+ elif int(connection["bigness"],16) == map2_height:
+ temp_line += map2_name + "Height"
+ else: #dunno wtf to do
+ temp_line += "$" + hex(int(connection["bigness"],16))[2:]
+ #if direction in ["NORTH", "SOUTH"]:
+ # temp_line += map2_name + "Width"
+ #elif direction in ["WEST", "EAST"]:
+ # temp_line += map2_name + "Height"
+
+ temp_line += ", " + map2_name + "Width"
+
+ temp_line += " ; bigness, width"
+ asm_lines[connection_offset + 2] = temp_line
+
+ #alignments (y, x)
+ if "alignments (y, x)" in asm_lines[connection_offset + 3]:
+ temp_line = spacing + "db "
+
+ if direction == "NORTH":
+ temp_line += "(" + map2_name + "Height * 2) - 1"
+ elif direction == "SOUTH":
+ temp_line += "0"
+ elif direction in ["WEST", "EAST"]:
+ #TODO: this might be y_mov/4 ??
+ temp_line += "(" + str(y_mov) + " * -2)"
+
+ temp_line += ", "
+
+ #Relative X-Position of player after entering connected map.
+ if direction in ["NORTH", "SOUTH"]:
+ temp_line += "(" + str(x_mov) + " * -2)"
+ elif direction == "WEST":
+ temp_line += "(" + map2_name + "Width * 2) - 1"
+ elif direction == "EAST":
+ temp_line += "0"
+
+ temp_line += " ; alignments (y, x)"
+ asm_lines[connection_offset + 3] = temp_line
+
+ #window
+ if "; window" in asm_lines[connection_offset + 4]:
+ temp_line = spacing + "dw "
+
+ if direction == "NORTH":
+ temp_line += "$C6E9 + " + map2_name + "Height * (" + map2_name + "Width + 6)"
+ elif direction in ["SOUTH", "EAST"]:
+ temp_line += "$C6EF + " + map2_name + "Width"
+ elif direction == "WEST":
+ temp_line += "$C6EE + 2 * " + map2_name + "Width"
+
+ temp_line += " ; window"
+ asm_lines[connection_offset + 4] = temp_line
+
+ #jump to the next connection
connection_offset += 6
-
if __name__ == "__main__":
import extract_maps