ref: 8a064dfb4538319e6e8f860e99700db298933dde
parent: 2489165312a0ee2cc45d2a03edbed7623f124b73
author: Bryan Bishop <[email protected]>
date: Fri May 4 19:03:03 EDT 2012
use a $50 macro to stop some text scripts
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -385,7 +385,8 @@
#info1 += " long_info: " + long_info
return info1
-class NewTextScript:
+all_texts = []
+class TextScript:
""" A text is a sequence of bytes (and sometimes commands). It's not the
same thing as a Script. The bytes are translated into characters based
on the lookup table (see chars.py). The in-text commands are for including
@@ -394,8 +395,11 @@
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):
+ def __init__(self, address, map_group=None, map_id=None, debug=False, label=None, force=False, show=None):
self.address = address
+ # $91, $84, $82, $54, $8c
+ if address in [0x26f2, 0x6ee, 0x1071, 0x5ce33, 0x69523, 0x7ee98, 0x72176, 0x7a578, 0x19c09b]:
+ return None
self.map_group, self.map_id, self.debug = map_group, map_id, debug
self.dependencies = None
self.commands = None
@@ -487,7 +491,8 @@
# store the script in the global table/map thing
script_parse_table[start_address:current_address] = self
-
+ all_texts.append(self)
+
if self.debug:
asm_output = "\n".join([command.to_asm() for command in commands])
print "--------------\n"+asm_output
@@ -501,8 +506,7 @@
asm_output = "\n".join([command.to_asm() for command in self.commands])
return asm_output
-all_texts = []
-class TextScript:
+class OldTextScript:
"a text is a sequence of commands different from a script-engine script"
base_label = "UnknownText_"
def __init__(self, address, map_group=None, map_id=None, debug=True, show=True, force=False, label=None):
@@ -1999,6 +2003,7 @@
new_line = True
was_comma = False
end = True
+ self.end = True
elif byte == 0x57:
# close any quotes
if in_quotes:
@@ -2074,6 +2079,8 @@
if output[-1] == "\n":
output = output[:-1]
+ self.size = len(self.bytes)
+
return output
class WriteTextFromRAM(TextCommand):
@@ -2266,6 +2273,15 @@
param_types = {
0: {"name": "text", "class": TextPointerLabelAfterBankParam},
}
+# this is needed because sometimes a script ends with $50 $50
+class TextEndingCommand(TextCommand):
+ id = 0x50
+ macro_name = "db"
+ override_byte_check = False
+ size = 1
+ end = True
+ def to_asm(self):
+ return "db $50"
text_command_classes = inspect.getmembers(sys.modules[__name__], \
lambda obj: inspect.isclass(obj) and \