Mercurial > touhou
comparison anmviewer @ 430:c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 03 Aug 2013 15:49:04 +0200 |
parents | 1104dc2553ee |
children | 77c0e9a53795 |
comparison
equal
deleted
inserted
replaced
429:40d5f3083ebc | 430:c9433188ffdb |
---|---|
22 from pytouhou.ui.window import Window | 22 from pytouhou.ui.window import Window |
23 from pytouhou.resource.loader import Loader | 23 from pytouhou.resource.loader import Loader |
24 from pytouhou.ui.anmrenderer import ANMRenderer | 24 from pytouhou.ui.anmrenderer import ANMRenderer |
25 | 25 |
26 | 26 |
27 def main(path, data, name, script, sprites, fixed_pipeline): | 27 def main(path, data, name, script, entry, sprites, fixed_pipeline): |
28 resource_loader = Loader() | 28 resource_loader = Loader() |
29 resource_loader.scan_archives(os.path.join(path, name) for name in data) | 29 resource_loader.scan_archives(os.path.join(path, name) for name in data) |
30 | 30 |
31 window = Window((384, 448), fixed_pipeline=fixed_pipeline, sound=False) | 31 window = Window((384, 448), fixed_pipeline=fixed_pipeline, sound=False) |
32 | 32 |
33 # Get out animation | 33 # Get out animation |
34 anm_wrapper = resource_loader.get_anm_wrapper(name.split(',')) | 34 anm = resource_loader.get_anm(name) |
35 anm = ANMRenderer(window, resource_loader, anm_wrapper, script, sprites) | 35 renderer = ANMRenderer(window, resource_loader, anm[entry], script, sprites) |
36 window.set_runner(anm) | 36 window.set_runner(renderer) |
37 window.run() | 37 window.run() |
38 | 38 |
39 | 39 |
40 parser = argparse.ArgumentParser(description='Viewer of ANM files, archives containing animations used in Touhou games.') | 40 parser = argparse.ArgumentParser(description='Viewer of ANM files, archives containing animations used in Touhou games.') |
41 | 41 |
42 parser.add_argument('data', metavar='DAT', default=('CM.DAT', 'ST.DAT'), nargs='*', help='Game’s .DAT data files') | 42 parser.add_argument('data', metavar='DAT', default=('CM.DAT', 'ST.DAT'), nargs='*', help='Game’s .DAT data files') |
43 parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') | 43 parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') |
44 parser.add_argument('--anm', metavar='ANM', required=True, help='Select an ANM') | 44 parser.add_argument('--anm', metavar='ANM', required=True, help='Select an ANM') |
45 parser.add_argument('--script', metavar='SCRIPT', type=int, default=0, help='First script to play') | 45 parser.add_argument('--script', metavar='SCRIPT', type=int, default=0, help='First script to play') |
46 parser.add_argument('--entry', metavar='ENTRY', type=int, default=0, help='Entry to display, in multi-entries ANMs.') | |
46 parser.add_argument('--sprites', action='store_true', default=False, help='Display sprites instead of scripts.') | 47 parser.add_argument('--sprites', action='store_true', default=False, help='Display sprites instead of scripts.') |
47 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') | 48 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') |
48 | 49 |
49 args = parser.parse_args() | 50 args = parser.parse_args() |
50 | 51 |
51 main(args.path, tuple(args.data), args.anm, args.script, args.sprites, | 52 main(args.path, tuple(args.data), args.anm, args.script, args.entry, args.sprites, |
52 args.fixed_pipeline) | 53 args.fixed_pipeline) |