Mercurial > touhou
comparison eosd @ 404:6c0cb3eee33e
Add MoF’s hints support, and fix the Text timeout interface.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 24 Mar 2013 10:29:37 +0100 |
parents | 11d895b6c0dc |
children | b4be9b50557e |
comparison
equal
deleted
inserted
replaced
403:9589a01e6edf | 404:6c0cb3eee33e |
---|---|
28 from pytouhou.game.game import GameOver | 28 from pytouhou.game.game import GameOver |
29 from pytouhou.game.player import PlayerState | 29 from pytouhou.game.player import PlayerState |
30 from pytouhou.formats.t6rp import T6RP, Level | 30 from pytouhou.formats.t6rp import T6RP, Level |
31 from pytouhou.utils.random import Random | 31 from pytouhou.utils.random import Random |
32 from pytouhou.vm.msgrunner import NextStage | 32 from pytouhou.vm.msgrunner import NextStage |
33 from pytouhou.formats.hint import Hint | |
33 | 34 |
34 | 35 |
35 class EoSDGameBossRush(EoSDGame): | 36 class EoSDGameBossRush(EoSDGame): |
36 def run_iter(self, keystate): | 37 def run_iter(self, keystate): |
37 for i in range(20): | 38 for i in range(20): |
62 | 63 |
63 | 64 |
64 | 65 |
65 def main(path, data, stage_num, rank, character, replay, save_filename, | 66 def main(path, data, stage_num, rank, character, replay, save_filename, |
66 skip_replay, boss_rush, fps_limit, single_buffer, debug, | 67 skip_replay, boss_rush, fps_limit, single_buffer, debug, |
67 fixed_pipeline, display_background): | 68 fixed_pipeline, display_background, hints): |
68 | 69 |
69 resource_loader = Loader(path) | 70 resource_loader = Loader(path) |
70 | 71 |
71 try: | 72 try: |
72 resource_loader.scan_archives(data) | 73 resource_loader.scan_archives(data) |
95 save_keystates = None | 96 save_keystates = None |
96 if save_filename: | 97 if save_filename: |
97 save_replay = T6RP() | 98 save_replay = T6RP() |
98 save_replay.rank = rank | 99 save_replay.rank = rank |
99 save_replay.character = character | 100 save_replay.character = character |
101 | |
102 if hints: | |
103 with open(hints, 'rb') as file: | |
104 hints = Hint.read(file) | |
100 | 105 |
101 difficulty = 16 | 106 difficulty = 16 |
102 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] | 107 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] |
103 states = [PlayerState(character=character, power=default_power)] | 108 states = [PlayerState(character=character, power=default_power)] |
104 | 109 |
137 level.lives = states[0].lives | 142 level.lives = states[0].lives |
138 level.bombs = states[0].bombs | 143 level.bombs = states[0].bombs |
139 level.difficulty = difficulty | 144 level.difficulty = difficulty |
140 save_keystates = [] | 145 save_keystates = [] |
141 | 146 |
147 hints_stage = hints.stages[stage_num - 1] if hints else None | |
148 | |
142 # Load stage data | 149 # Load stage data |
143 stage = resource_loader.get_stage('stage%d.std' % stage_num) | 150 stage = resource_loader.get_stage('stage%d.std' % stage_num) |
144 | 151 |
145 game = game_class(resource_loader, states, stage_num, rank, difficulty, prng=prng, continues=continues) | 152 game = game_class(resource_loader, states, stage_num, rank, difficulty, prng=prng, continues=continues, hints=hints_stage) |
146 | 153 |
147 if display_background: | 154 if display_background: |
148 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) | 155 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) |
149 background = Background(stage, background_anm_wrapper) | 156 background = Background(stage, background_anm_wrapper) |
150 else: | 157 else: |
199 parser.add_argument('--single-buffer', action='store_true', help='Disable double buffering') | 206 parser.add_argument('--single-buffer', action='store_true', help='Disable double buffering') |
200 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit') | 207 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit') |
201 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') | 208 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') |
202 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') | 209 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') |
203 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') | 210 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') |
211 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') | |
204 | 212 |
205 args = parser.parse_args() | 213 args = parser.parse_args() |
206 | 214 |
207 main(args.path, tuple(args.data), args.stage, args.rank, args.character, | 215 main(args.path, tuple(args.data), args.stage, args.rank, args.character, |
208 args.replay, args.save_replay, args.skip_replay, args.boss_rush, | 216 args.replay, args.save_replay, args.skip_replay, args.boss_rush, |
209 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, | 217 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, |
210 args.no_background) | 218 args.no_background, args.hints) |