comparison eosd @ 378:11d895b6c0dc

Add the debug feature to start a game at the end of a replay.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 29 Aug 2012 18:38:29 +0200
parents 8f2f3053906a
children 6c0cb3eee33e
comparison
equal deleted inserted replaced
377:70e2ed71b09c 378:11d895b6c0dc
61 EoSDGame.cleanup(self) 61 EoSDGame.cleanup(self)
62 62
63 63
64 64
65 def main(path, data, stage_num, rank, character, replay, save_filename, 65 def main(path, data, stage_num, rank, character, replay, save_filename,
66 boss_rush, fps_limit, single_buffer, debug, fixed_pipeline, 66 skip_replay, boss_rush, fps_limit, single_buffer, debug,
67 display_background): 67 fixed_pipeline, display_background):
68 68
69 resource_loader = Loader(path) 69 resource_loader = Loader(path)
70 70
71 try: 71 try:
72 resource_loader.scan_archives(data) 72 resource_loader.scan_archives(data)
102 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] 102 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1]
103 states = [PlayerState(character=character, power=default_power)] 103 states = [PlayerState(character=character, power=default_power)]
104 104
105 game_class = EoSDGameBossRush if boss_rush else EoSDGame 105 game_class = EoSDGameBossRush if boss_rush else EoSDGame
106 106
107 runner = GameRunner(resource_loader, fps_limit=fps_limit, double_buffer=(not single_buffer), fixed_pipeline=fixed_pipeline) 107 runner = GameRunner(resource_loader, fps_limit=fps_limit, double_buffer=(not single_buffer), fixed_pipeline=fixed_pipeline, skip=skip_replay)
108 while True: 108 while True:
109 if replay: 109 if replay:
110 level = replay.levels[stage_num - 1] 110 level = replay.levels[stage_num - 1]
111 if not level: 111 if not level:
112 raise Exception 112 raise Exception
192 parser.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra).') 192 parser.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra).')
193 parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') 193 parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).')
194 parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).') 194 parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).')
195 parser.add_argument('--replay', metavar='REPLAY', help='Select a replay') 195 parser.add_argument('--replay', metavar='REPLAY', help='Select a replay')
196 parser.add_argument('--save-replay', metavar='REPLAY', help='Save the upcoming game into a replay file') 196 parser.add_argument('--save-replay', metavar='REPLAY', help='Save the upcoming game into a replay file')
197 parser.add_argument('--skip-replay', action='store_true', help='Skip the replay and start to play when it’s finished')
197 parser.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses') 198 parser.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses')
198 parser.add_argument('--single-buffer', action='store_true', help='Disable double buffering') 199 parser.add_argument('--single-buffer', action='store_true', help='Disable double buffering')
199 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit') 200 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit')
200 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') 201 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.')
201 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') 202 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.')
202 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') 203 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).')
203 204
204 args = parser.parse_args() 205 args = parser.parse_args()
205 206
206 main(args.path, tuple(args.data), args.stage, args.rank, args.character, 207 main(args.path, tuple(args.data), args.stage, args.rank, args.character,
207 args.replay, args.save_replay, args.boss_rush, args.fps_limit, 208 args.replay, args.save_replay, args.skip_replay, args.boss_rush,
208 args.single_buffer, args.debug, args.fixed_pipeline, args.no_background) 209 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline,
210 args.no_background)