comparison eclviewer.py @ 162:959c8b312918

Add character choosing in CLI.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 16 Oct 2011 07:42:11 -0700
parents 2547df120ece
children 84da28ae7ee4
comparison
equal deleted inserted replaced
161:7e7368356445 162:959c8b312918
24 from pytouhou.opengl.gamerunner import GameRunner 24 from pytouhou.opengl.gamerunner import GameRunner
25 from pytouhou.game.games import EoSDGame 25 from pytouhou.game.games import EoSDGame
26 from pytouhou.game.player import PlayerState 26 from pytouhou.game.player import PlayerState
27 27
28 28
29 def main(path, stage_num, rank): 29 def main(path, stage_num, rank, character):
30 resource_loader = Loader() 30 resource_loader = Loader()
31 resource_loader.scan_archives(os.path.join(path, name) 31 resource_loader.scan_archives(os.path.join(path, name)
32 for name in ('CM.DAT', 'ST.DAT')) 32 for name in ('CM.DAT', 'ST.DAT'))
33 game = EoSDGame(resource_loader, [PlayerState()], stage_num, rank, 16) 33 game = EoSDGame(resource_loader, [PlayerState(character=character)], stage_num, rank, 16)
34 34
35 # Load stage data 35 # Load stage data
36 stage = resource_loader.get_stage('stage%d.std' % stage_num) 36 stage = resource_loader.get_stage('stage%d.std' % stage_num)
37 37
38 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) 38 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,))
45 runner = GameRunner(resource_loader, game, background) 45 runner = GameRunner(resource_loader, game, background)
46 runner.start() 46 runner.start()
47 47
48 48
49 try: 49 try:
50 file_path, stage_num, rank = sys.argv[1:] 50 file_path, stage_num, rank, character = sys.argv[1:]
51 stage_num = int(stage_num) 51 stage_num = int(stage_num)
52 rank = int(rank) 52 rank = int(rank)
53 character = int(character)
53 except ValueError: 54 except ValueError:
54 print('Usage: %s game_dir_path stage_num rank' % sys.argv[0]) 55 print('Usage: %s game_dir_path stage_num rank character' % sys.argv[0])
55 else: 56 else:
56 main(file_path, stage_num, rank) 57 main(file_path, stage_num, rank, character)
57 58