comparison eclviewer.py @ 137:2547df120ece

Add CLI rank choosing.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 23 Sep 2011 10:08:33 -0700
parents fab7ad2f0d8b
children 959c8b312918
comparison
equal deleted inserted replaced
136:d3005ebe797a 137:2547df120ece
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): 29 def main(path, stage_num, rank):
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, 3, 16) 33 game = EoSDGame(resource_loader, [PlayerState()], 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 = sys.argv[1:] 50 file_path, stage_num, rank = sys.argv[1:]
51 stage_num = int(stage_num) 51 stage_num = int(stage_num)
52 rank = int(rank)
52 except ValueError: 53 except ValueError:
53 print('Usage: %s game_dir_path stage_num' % sys.argv[0]) 54 print('Usage: %s game_dir_path stage_num rank' % sys.argv[0])
54 else: 55 else:
55 main(file_path, stage_num) 56 main(file_path, stage_num, rank)
56 57