mirror of https://github.com/pret/pokecrystal.git
disable macro error checking by default
This commit is contained in:
parent
fe8476d6bc
commit
849a57c9f1
|
@ -35,6 +35,9 @@ macros = command_classes + \
|
||||||
# show lines before preprocessing in stdout
|
# show lines before preprocessing in stdout
|
||||||
show_original_lines = False
|
show_original_lines = False
|
||||||
|
|
||||||
|
# helpful for debugging macros
|
||||||
|
do_macro_sanity_check = False
|
||||||
|
|
||||||
chars = {
|
chars = {
|
||||||
"ガ": 0x05,
|
"ガ": 0x05,
|
||||||
"ギ": 0x06,
|
"ギ": 0x06,
|
||||||
|
@ -462,45 +465,47 @@ def macro_translator(macro, token, line):
|
||||||
# do: all scripting macros
|
# do: all scripting macros
|
||||||
# don't: signpost, warp_def, person_event, xy_trigger
|
# don't: signpost, warp_def, person_event, xy_trigger
|
||||||
if not macro.override_byte_check:
|
if not macro.override_byte_check:
|
||||||
sys.stdout.write("db $%.2x\n" % (macro.id))
|
sys.stdout.write("db ${0:02X}\n".format(macro.id))
|
||||||
|
|
||||||
# --- long-winded sanity check goes here ---
|
# --- long-winded sanity check goes here ---
|
||||||
|
|
||||||
# sanity check... this won't work because PointerLabelBeforeBank shows
|
if do_macro_sanity_check:
|
||||||
# up as two params, so these two lengths will always be different.
|
|
||||||
#assert len(params) == len(macro.param_types), \
|
|
||||||
# "mismatched number of parameters on this line: " + \
|
|
||||||
# original_line
|
|
||||||
|
|
||||||
# v2 sanity check :) although it sorta sucks that this loop happens twice?
|
# sanity check... this won't work because PointerLabelBeforeBank shows
|
||||||
allowed_length = 0
|
# up as two params, so these two lengths will always be different.
|
||||||
for (index, param_type) in macro.param_types.items():
|
#assert len(params) == len(macro.param_types), \
|
||||||
param_klass = param_type["class"]
|
# "mismatched number of parameters on this line: " + \
|
||||||
|
# original_line
|
||||||
|
|
||||||
if param_klass.byte_type == "db":
|
# v2 sanity check :) although it sorta sucks that this loop happens twice?
|
||||||
allowed_length += 1 # just one value
|
allowed_length = 0
|
||||||
elif param_klass.byte_type == "dw":
|
for (index, param_type) in macro.param_types.items():
|
||||||
if param_klass.size == 2:
|
param_klass = param_type["class"]
|
||||||
allowed_length += 1 # just label
|
|
||||||
elif param_klass == MoneyByteParam:
|
if param_klass.byte_type == "db":
|
||||||
allowed_length += 1
|
allowed_length += 1 # just one value
|
||||||
elif param_klass.size == 3:
|
elif param_klass.byte_type == "dw":
|
||||||
allowed_length += 2 # bank and label
|
if param_klass.size == 2:
|
||||||
|
allowed_length += 1 # just label
|
||||||
|
elif param_klass == MoneyByteParam:
|
||||||
|
allowed_length += 1
|
||||||
|
elif param_klass.size == 3:
|
||||||
|
allowed_length += 2 # bank and label
|
||||||
|
else:
|
||||||
|
raise Exception, "dunno what to do with a macro param with a size > 3"
|
||||||
else:
|
else:
|
||||||
raise Exception, "dunno what to do with a macro param with a size > 3"
|
raise Exception, "dunno what to do with this non db/dw macro param: " + \
|
||||||
|
str(param_klass) + " in line: " + original_line
|
||||||
|
|
||||||
|
# sometimes the allowed length can vary
|
||||||
|
if hasattr(macro, "allowed_lengths"):
|
||||||
|
allowed_lengths = macro.allowed_lengths + [allowed_length]
|
||||||
else:
|
else:
|
||||||
raise Exception, "dunno what to do with this non db/dw macro param: " + \
|
allowed_lengths = [allowed_length]
|
||||||
str(param_klass) + " in line: " + original_line
|
|
||||||
|
|
||||||
# sometimes the allowed length can vary
|
assert len(params) in allowed_lengths, \
|
||||||
if hasattr(macro, "allowed_lengths"):
|
"mismatched number of parameters on this line: " + \
|
||||||
allowed_lengths = macro.allowed_lengths + [allowed_length]
|
original_line
|
||||||
else:
|
|
||||||
allowed_lengths = [allowed_length]
|
|
||||||
|
|
||||||
assert len(params) in allowed_lengths, \
|
|
||||||
"mismatched number of parameters on this line: " + \
|
|
||||||
original_line
|
|
||||||
|
|
||||||
# --- end of ridiculously long sanity check ---
|
# --- end of ridiculously long sanity check ---
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue