Merge pull request #183 from kanzure/preprocessor-macro-function

Function to make the preprocessor "macros" list.
This commit is contained in:
Bryan Bishop 2013-08-31 08:27:21 -07:00
commit ca0981eb36
2 changed files with 23 additions and 15 deletions

View File

@ -16,20 +16,28 @@ from extras.pokemontools.crystal import (
effect_classes, effect_classes,
) )
even_more_macros = [ def load_pokecrystal_macros():
Warp, """
XYTrigger, Construct a list of macros that are needed for pokecrystal preprocessing.
Signpost, """
PeopleEvent, ourmacros = []
DataByteWordMacro,
]
macros = command_classes even_more_macros = [
macros += even_more_macros Warp,
macros += [each[1] for each in text_command_classes] XYTrigger,
macros += movement_command_classes Signpost,
macros += music_classes PeopleEvent,
macros += effect_classes DataByteWordMacro,
]
ourmacros += command_classes
ourmacros += even_more_macros
ourmacros += [each[1] for each in text_command_classes]
ourmacros += movement_command_classes
ourmacros += music_classes
ourmacros += effect_classes
return ourmacros
chars = { chars = {
"": 0x05, "": 0x05,
@ -650,4 +658,4 @@ def preprocess(macros, lines=None):
# only run against stdin when not included as a module # only run against stdin when not included as a module
if __name__ == "__main__": if __name__ == "__main__":
preprocess(macros) preprocess(load_pokecrystal_macros())

View File

@ -14,4 +14,4 @@ if __name__ == '__main__':
dest = os.path.splitext(source)[0] + '.tx' dest = os.path.splitext(source)[0] + '.tx'
sys.stdin = open(source, 'r') sys.stdin = open(source, 'r')
sys.stdout = open(dest, 'w') sys.stdout = open(dest, 'w')
preprocessor.preprocess(preprocessor.macros) preprocessor.preprocess(preprocessor.load_pokecrystal_macros())