forked from Rangi42/polishedcrystal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreprocessor.py
72 lines (60 loc) · 1.57 KB
/
preprocessor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import extras.pokemontools.configuration as configuration
import extras.pokemontools.preprocessor as preprocessor
from extras.pokemontools.crystal import (
command_classes,
Warp,
XYTrigger,
Signpost,
PeopleEvent,
DataByteWordMacro,
text_command_classes,
movement_command_classes,
music_classes,
effect_classes,
ChannelCommand,
OctaveCommand,
)
from extras.pokemontools.audio import (
Note,
)
from extras.pokemontools.battle_animations import (
BattleAnimWait,
battle_animation_classes,
)
def load_pokecrystal_macros():
"""
Construct a list of macros that are needed for pokecrystal preprocessing.
"""
ourmacros = []
even_more_macros = [
Warp,
XYTrigger,
Signpost,
PeopleEvent,
DataByteWordMacro,
ChannelCommand,
OctaveCommand,
Note,
]
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
ourmacros += battle_animation_classes + [BattleAnimWait]
return ourmacros
def setup_processor():
config = configuration.Config()
macros = load_pokecrystal_macros()
processor = preprocessor.Preprocessor(config, macros)
return processor
def main():
processor = setup_processor()
processor.preprocess()
# only run against stdin when not included as a module
if __name__ == "__main__":
main()