# HG changeset patch # User Emmanuel Gil Peyrot # Date 1344286342 -7200 # Node ID 704bea2e43605a5d137b43b5d923744ee9307245 # Parent 6702bc0215dc8c188a26a31a1d5d7a6ef3ab9733 Use a future-proof ECL parser. diff --git a/eosd b/eosd --- a/eosd +++ b/eosd @@ -49,7 +49,8 @@ class EoSDGameBossRush(EoSDGame): def cleanup(self): - if not (self.boss or self.msg_wait or self.ecl_runner.boss_wait): + boss_wait = any(ecl_runner.boss_wait for ecl_runner in self.ecl_runners) + if not (self.boss or self.msg_wait or boss_wait): self.enemies = [enemy for enemy in self.enemies if enemy.boss_callback != -1 or enemy.frame > 1] self.lasers = [laser for laser in self.lasers if laser.frame > 1] diff --git a/pytouhou/formats/ecl.py b/pytouhou/formats/ecl.py --- a/pytouhou/formats/ecl.py +++ b/pytouhou/formats/ecl.py @@ -37,7 +37,7 @@ class ECL(object): enemy waves, triggering dialogs and level completion. Instance variables: - main -- list of instructions describing waves and triggering dialogs + mains -- list of lists of instructions describing waves and triggering dialogs subs -- list of subroutines """ @@ -162,28 +162,32 @@ class ECL(object): 10: ('II', 'resume_ecl'), 12: ('', 'stop_time')} + _parameters = {6: {'main_count': 1, + 'nb_main_offsets': 3, + 'jumps_list': {2: 1, 3: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 34: 1}}} + def __init__(self): - self.main = [] - self.subs = [[]] + self.mains = [] + self.subs = [] @classmethod - def read(cls, file): + def read(cls, file, version=6): """Read an ECL file. Raise an exception if the file is invalid. Return a ECL instance otherwise. """ - sub_count, main_offset = unpack('