summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-01-04 01:57:15 -0600
committerBryan Bishop <kanzure@gmail.com>2012-01-04 01:57:15 -0600
commit27af4ea2ab8cb52b5e6049eb3f5574068ab695be (patch)
treeee0f6425ecc8aed1fa45b1f834b0de6fad49e13d /extras
parent8ef51d4697b61cc77dd78a42c1c0e5c16a4781eb (diff)
add block labels to map headers
.. and a tool for assisting with that. hg-commit-id: f832fa6e62f9
Diffstat (limited to 'extras')
-rw-r--r--extras/add_map_labels_to_map_headers.py42
-rw-r--r--extras/map_block_dumper.py6
2 files changed, 45 insertions, 3 deletions
diff --git a/extras/add_map_labels_to_map_headers.py b/extras/add_map_labels_to_map_headers.py
new file mode 100644
index 00000000..61657e9e
--- /dev/null
+++ b/extras/add_map_labels_to_map_headers.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+#author: Bryan Bishop <kanzure@gmail.com>
+#date: 2011-01-04
+#purpose: insert labels into map headers
+import sys
+
+asm = None
+asm_lines = []
+def load_asm():
+ global asm, asm_lines
+ asm = open("../pokered.asm", "r").read()
+ asm_lines = asm.split("\n")
+
+def find_with_start_of_line(name):
+ global asm_lines
+ for line in asm_lines:
+ if len(line) > len(name) and ": " in line:
+ if line[:len(name)] == name: return True
+ return False
+
+def process_lines():
+ global asm, asm_lines
+ for line in asm_lines:
+ if not "_h:" in line: continue #skip
+ index = asm_lines.index(line)
+ name = line.split("_h:")[0]
+
+ if "Blocks" in asm_lines[index+3]: continue #skip, already done
+ #if not (str(name + "Blocks:") in asm): continue #skip, no block label found
+ if not find_with_start_of_line(name + "Blocks:"): continue #skip
+
+ orig_line = asm_lines[index+3]
+ fixed_line = orig_line.split(",")
+ fixed_line[0] = " dw " + name + "Blocks"
+ fixed_line = ",".join(fixed_line)
+
+ asm_lines[index+3] = fixed_line
+
+if __name__ == "__main__":
+ load_asm()
+ process_lines()
+ sys.stdout.write("\n".join(asm_lines))
diff --git a/extras/map_block_dumper.py b/extras/map_block_dumper.py
index 871c44a1..f961dfb4 100644
--- a/extras/map_block_dumper.py
+++ b/extras/map_block_dumper.py
@@ -123,11 +123,11 @@ def insert_all_labels():
if not ("cat" in mapmap["name"]) and "copy" in mapmap["name"].lower(): continue #skip this one
#bill's house breaks things?
- if mapmap["name"] == "Bill's House": continue
+ #if mapmap["name"] == "Bill's House": continue
if mapmap["name"] == "Viridian Forest": continue
- if mapmap["name"] == "Cerulean Mart": continue
+ #if mapmap["name"] == "Cerulean Mart": continue
if mapmap["name"] == "Virdian Forest Exit": continue
- if "copy" in mapmap["name"].lower(): continue #skip this one too..
+ #if "copy" in mapmap["name"].lower(): continue #skip this one too..
if mapmap["map_pointer"] in used_map_pointers: continue #skip for sure