shithub: pokecrystal

Download patch

ref: ca0981eb36a86c1cd868e6f8ca13b42162afdc3f
parent: e91fb8ac14da977a3d4ef76ea74c76c867247660
parent: a429bce189ab81139020299e516d4d693facc17b
author: Bryan Bishop <[email protected]>
date: Sat Aug 31 04:27:21 EDT 2013

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

Function to make the preprocessor "macros" list.

--- a/preprocessor.py
+++ b/preprocessor.py
@@ -16,21 +16,29 @@
     effect_classes,
 )
 
-even_more_macros = [
-    Warp,
-    XYTrigger,
-    Signpost,
-    PeopleEvent,
-    DataByteWordMacro,
-]
+def load_pokecrystal_macros():
+    """
+    Construct a list of macros that are needed for pokecrystal preprocessing.
+    """
+    ourmacros = []
 
-macros = command_classes
-macros += even_more_macros
-macros += [each[1] for each in text_command_classes]
-macros += movement_command_classes
-macros += music_classes
-macros += effect_classes
+    even_more_macros = [
+        Warp,
+        XYTrigger,
+        Signpost,
+        PeopleEvent,
+        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 = {
 "ガ": 0x05,
 "ギ": 0x06,
@@ -650,4 +658,4 @@
 
 # only run against stdin when not included as a module
 if __name__ == "__main__":
-    preprocess(macros)
+    preprocess(load_pokecrystal_macros())
--- a/prequeue.py
+++ b/prequeue.py
@@ -14,4 +14,4 @@
         dest = os.path.splitext(source)[0] + '.tx'
         sys.stdin  = open(source, 'r')
         sys.stdout = open(dest, 'w')
-        preprocessor.preprocess(preprocessor.macros)
+        preprocessor.preprocess(preprocessor.load_pokecrystal_macros())