ref: 1f38d74c65b9c5ccc9a792c7df73853fc64fbd55
parent: 6fcf678ac9bffb2436ff9938576672ed52db69ac
parent: dc673d1233c96a0d2871479314b9d0649e4f694a
author: IIMarckus <[email protected]>
date: Sun Jan 15 07:38:56 EST 2012
Merge. hg-commit-id: d0e367fd9cb4
--- a/extras/extract_maps.py
+++ b/extras/extract_maps.py
@@ -549,6 +549,21 @@
return size
+def get_direction(connection_byte, connection_id):
+ """given a connection byte and a connection id, which direction is this connection?
+ the 0th connection of $5 is SOUTH and the 1st connection is EAST"""
+ connection_options = [0b1000, 0b0100, 0b0010, 0b0001]
+ results = ["NORTH", "SOUTH", "WEST", "EAST"]
+ for option in connection_options:
+ if (option & connection_byte) == 0:
+ results[connection_options.index(option)] = ""
+ #prune results
+ while "" in results:
+ results.remove("")
+ print results
+ print "connection_id is: " + str(connection_id) + " and byte is: " + hex(connection_byte)
+ return results[connection_id]
+
def read_map_header(address, bank):
address = int(address, base)
bank = int(bank, base)
@@ -608,6 +623,7 @@
base_connection_address = address + 10 + (11 * connection)
connection_bytes = rom[base_connection_address : base_connection_address + 11]
connection_data = read_connection_bytes(connection_bytes, bank)
+ connection_data["direction"] = get_direction(connection_byte, connection)
connections[connection] = connection_data
@@ -654,6 +670,7 @@
if len(map_pointers) == 0: load_map_pointers()
for map_id in map_pointers.keys():
+ if map_id in bad_maps: continue
map2 = map_pointers[map_id]
map_header = read_map_header(map2["address"], map2["bank"])