summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-22 21:28:19 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-22 21:28:19 -0600
commit504d9cc896db356012f6bf16894355f19f9469a4 (patch)
tree99678641fa64b7758c38af60e8ca1c32121e9e11
parent80588db61ce02cbc9128eea1f2522c4b09f799d1 (diff)
fixup TextScript to store script_parse_table ref
-rw-r--r--pokemontools/crystal.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py
index b1e252f..83ee7dd 100644
--- a/pokemontools/crystal.py
+++ b/pokemontools/crystal.py
@@ -174,7 +174,7 @@ def how_many_until(byte, starting, rom):
def load_map_group_offsets(map_group_pointer_table, map_group_count, rom=None):
"""reads the map group table for the list of pointers"""
map_group_offsets = [] # otherwise this method can only be used once
- data = rom.interval(map_group_pointer_table, map_group_count*2, strings=False, rom=rom)
+ data = rom.interval(map_group_pointer_table, map_group_count*2, strings=False)
data = helpers.grouper(data)
for pointer_parts in data:
pointer = pointer_parts[0] + (pointer_parts[1] << 8)
@@ -249,7 +249,10 @@ class TextScript:
see: http://hax.iimarck.us/files/scriptingcodes_eng.htm#InText
"""
base_label = "UnknownText_"
- def __init__(self, address, map_group=None, map_id=None, debug=False, label=None, force=False, show=None):
+ def __init__(self, address, map_group=None, map_id=None, debug=False, label=None, force=False, show=None, script_parse_table=None, text_command_classes=None):
+ self.text_command_classes = text_command_classes
+ self.script_parse_table = script_parse_table
+
self.address = address
# $91, $84, $82, $54, $8c
# 0x19768c is a a weird problem?
@@ -425,7 +428,7 @@ def parse_text_engine_script_at(address, map_group=None, map_id=None, debug=True
"""
if is_script_already_parsed_at(address) and not force:
return script_parse_table[address]
- return TextScript(address, map_group=map_group, map_id=map_id, debug=debug, show=show, force=force)
+ return TextScript(address, map_group=map_group, map_id=map_id, debug=debug, show=show, force=force, script_parse_table=script_parse_table, text_command_classes=text_command_classes)
def find_text_addresses():
"""returns a list of text pointers
@@ -560,7 +563,7 @@ def parse_text_at3(address, map_group=None, map_id=None, debug=False):
if deh:
return deh
else:
- text = TextScript(address, map_group=map_group, map_id=map_id, debug=debug)
+ text = TextScript(address, map_group=map_group, map_id=map_id, debug=debug, script_parse_table=script_parse_table, text_command_classes=text_command_classes)
if text.is_valid():
return text
else: