diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-04-08 16:09:00 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-04-08 16:09:00 -0500 |
commit | 2939eb997b42d15007e5d8ff3da527f6621899a2 (patch) | |
tree | bca9a60f0c590c867b4e939b206ce7f5b72d90a8 /crystal.py | |
parent | 67a38c52960231e4816fe5ebac182469e2d63c03 (diff) |
winlosstext does not always point to a value
original-commit-id: 247469f740e97c161cbd5f36a72e69d3c496a659
Diffstat (limited to 'crystal.py')
-rw-r--r-- | crystal.py | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -2335,7 +2335,8 @@ class TextPointerLabelParam(PointerLabelParam): def parse(self): PointerLabelParam.parse(self) address = calculate_pointer_from_bytes_at(self.address, bank=self.bank) - self.text = parse_text_engine_script_at(address, map_group=self.map_group, map_id=self.map_id, force=self.force, debug=self.debug) + if address != None and address != 0: + self.text = parse_text_engine_script_at(address, map_group=self.map_group, map_id=self.map_id, force=self.force, debug=self.debug) class MovementPointerLabelParam(PointerLabelParam): pass class MapDataPointerParam(PointerLabelParam): @@ -2755,6 +2756,7 @@ class Script(): """ global command_classes, rom, script_parse_table current_address = start_address + print "Script.parse address="+hex(self.address) if start_address in stop_points and force == False: print "script parsing is stopping at stop_point=" + hex(start_address) + " at map_group="+str(map_group)+" map_id="+str(map_id) return None @@ -2801,6 +2803,7 @@ class Script(): def old_parse(self, *args, **kwargs): """parses a script-engine script; force=True if you want to re-parse and get the debug information""" + print "Script.old_parse address="+hex(self.address) #can't handle more than one argument if len(args) > 1: raise Exception, "Script.parse_script doesn't know how to handle positional arguments" @@ -3983,10 +3986,17 @@ class Script(): #* When pointer = 0000 then "Blackout" instead of return to gameplay. """ size = 5 + #sometimes win/lost can be a pointer to 0000 or None? command["won_pointer"] = calculate_pointer_from_bytes_at(start_address+1, bank=False) command["lost_pointer"] = calculate_pointer_from_bytes_at(start_address+3, bank=False) - command["text_won"] = parse_text_engine_script_at(command["won_pointer"], map_group=map_id, map_id=map_id, debug=debug) - command["text_lost"] = parse_text_engine_script_at(command["lost_pointer"], map_group=map_id, map_id=map_id, debug=debug) + if command["won_pointer"] == None: + command["won_pointer"] = 0 + else: + command["text_won"] = parse_text_engine_script_at(command["won_pointer"], map_group=map_id, map_id=map_id, debug=debug) + if command["lost_pointer"] == None: + command["lost_pointer"] = 0 + else: + command["text_lost"] = parse_text_engine_script_at(command["lost_pointer"], map_group=map_id, map_id=map_id, debug=debug) elif command_byte == 0x65: #Script talk-after #XXX this is a really poor description of whatever this is info = "? Load the trainer talk-after script" @@ -6033,7 +6043,8 @@ def get_label_for(address): """returns a label assigned to a particular address""" global all_labels if type(address) != int: - raise Exception, "get_label_for requires an integer address" + print "get_label_for requires an integer address" + return None #the old way for thing in all_labels: |