diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-05-04 21:29:07 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-05-04 21:29:07 -0500 |
commit | 82d7043accd00c3b1260e3a23c2619e1fdb36ca5 (patch) | |
tree | aa7d28721ae2f0245d0f88d5dca6331089eaa383 /extras/crystal.py | |
parent | f5e5c110d1301745c4137e4c8c3fe66155a330d2 (diff) |
a better get_dependencies for NewTextScript
Diffstat (limited to 'extras/crystal.py')
-rw-r--r-- | extras/crystal.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/extras/crystal.py b/extras/crystal.py index 9043eac97..03a2ecc00 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -394,12 +394,16 @@ class NewTextScript: see: http://hax.iimarck.us/files/scriptingcodes_eng.htm#InText """ base_label = "UnknownText_" - def __init__(self, address, map_group=None, map_id=None, debug=True, label=None): + def __init__(self, address, map_group=None, map_id=None, debug=True, label=None, force=False): self.address = address self.map_group, self.map_id, self.debug = map_group, map_id, debug self.dependencies = [] self.commands = [] + self.force = force + if is_script_already_parsed_at(address) and not force: + raise Exception, "TextScript already parsed at "+hex(address) + if not label: label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self) @@ -407,15 +411,23 @@ class NewTextScript: self.parse() def get_dependencies(self, recompute=False, global_dependencies=set()): - global_dependencies.update(self.dependencies) + if self.dependencies != None and not recompute: + global_dependencies.update(self.dependencies) + return self.dependencies + dependencies = [] + for command in self.commands: + deps = command.get_dependencies(recompute=recompute, global_dependencies=global_dependencies) + dependencies.extend(deps) + self.dependencies = dependencies return self.dependencies def parse(self): global text_command_classes, script_parse_table - raise NotImplementedError, bryan_message + current_address = self.address + # TODO def to_asm(self): - pass + # TODO all_texts = [] class TextScript: |