Mercurial > touhou
comparison eosd @ 428:f41a26971a19
Remove all Loader uses from outside pytouhou.games, and add a --no-music option to disable bgm.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 16 Jul 2013 21:17:22 +0200 |
parents | 52829ebe2561 |
children | 77c0e9a53795 |
comparison
equal
deleted
inserted
replaced
427:0604f4fbbe3c | 428:f41a26971a19 |
---|---|
40 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit') | 40 parser.add_argument('--fps-limit', metavar='FPS', default=60, type=int, help='Set fps limit') |
41 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') | 41 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') |
42 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') | 42 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') |
43 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') | 43 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') |
44 parser.add_argument('--no-particles', action='store_false', help='Disable particles handling (huge performance boost on slow systems).') | 44 parser.add_argument('--no-particles', action='store_false', help='Disable particles handling (huge performance boost on slow systems).') |
45 parser.add_argument('--no-music', action='store_false', help='Disable background music.') | |
45 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') | 46 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') |
46 parser.add_argument('--verbosity', metavar='VERBOSITY', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Select the wanted logging level.') | 47 parser.add_argument('--verbosity', metavar='VERBOSITY', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Select the wanted logging level.') |
47 | 48 |
48 args = parser.parse_args() | 49 args = parser.parse_args() |
49 | 50 |
54 import pyximport | 55 import pyximport |
55 pyximport.install() | 56 pyximport.install() |
56 | 57 |
57 from pytouhou.ui.window import Window | 58 from pytouhou.ui.window import Window |
58 from pytouhou.resource.loader import Loader | 59 from pytouhou.resource.loader import Loader |
59 from pytouhou.game.background import Background | |
60 from pytouhou.ui.gamerunner import GameRunner | 60 from pytouhou.ui.gamerunner import GameRunner |
61 from pytouhou.games.eosd import EoSDGame | 61 from pytouhou.games.eosd import EoSDGame |
62 from pytouhou.game.game import GameOver | 62 from pytouhou.game.game import GameOver |
63 from pytouhou.game.player import PlayerState | 63 from pytouhou.game.player import PlayerState |
64 from pytouhou.formats.t6rp import T6RP, Level | 64 from pytouhou.formats.t6rp import T6RP, Level |
95 EoSDGame.cleanup(self) | 95 EoSDGame.cleanup(self) |
96 | 96 |
97 | 97 |
98 def main(path, data, stage_num, rank, character, replay, save_filename, | 98 def main(path, data, stage_num, rank, character, replay, save_filename, |
99 skip_replay, boss_rush, fps_limit, single_buffer, debug, | 99 skip_replay, boss_rush, fps_limit, single_buffer, debug, |
100 fixed_pipeline, display_background, display_particles, hints, | 100 fixed_pipeline, enable_background, enable_particles, enable_music, |
101 verbosity): | 101 hints, verbosity): |
102 | 102 |
103 resource_loader = Loader(path) | 103 resource_loader = Loader(path) |
104 | 104 |
105 try: | 105 try: |
106 resource_loader.scan_archives(data) | 106 resource_loader.scan_archives(data) |
183 level.difficulty = difficulty | 183 level.difficulty = difficulty |
184 save_keystates = [] | 184 save_keystates = [] |
185 | 185 |
186 hints_stage = hints.stages[stage_num - 1] if hints else None | 186 hints_stage = hints.stages[stage_num - 1] if hints else None |
187 | 187 |
188 # Load stage data | |
189 stage = resource_loader.get_stage('stage%d.std' % stage_num) | |
190 | |
191 game = game_class(resource_loader, states, stage_num, rank, difficulty, prng=prng, continues=continues, hints=hints_stage) | 188 game = game_class(resource_loader, states, stage_num, rank, difficulty, prng=prng, continues=continues, hints=hints_stage) |
192 | 189 |
193 if not display_particles: | 190 if not enable_particles: |
194 def new_particle(pos, anim, amp, number=1, reverse=False, duration=24): | 191 def new_particle(pos, anim, amp, number=1, reverse=False, duration=24): |
195 pass | 192 pass |
196 game.new_particle = new_particle | 193 game.new_particle = new_particle |
197 | 194 |
198 if display_background: | 195 background = game.background if enable_background else None |
199 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) | 196 bgms = game.std.bgms if enable_music else None |
200 background = Background(stage, background_anm_wrapper) | |
201 else: | |
202 background = None | |
203 | 197 |
204 # Main loop | 198 # Main loop |
205 runner.load_game(game, background, stage.bgms, replay, save_keystates) | 199 runner.load_game(game, background, bgms, replay, save_keystates) |
206 window.set_runner(runner) | 200 window.set_runner(runner) |
207 try: | 201 try: |
208 window.run() | 202 window.run() |
209 break | 203 break |
210 except NextStage: | 204 except NextStage: |
229 | 223 |
230 | 224 |
231 main(args.path, tuple(args.data), args.stage, args.rank, args.character, | 225 main(args.path, tuple(args.data), args.stage, args.rank, args.character, |
232 args.replay, args.save_replay, args.skip_replay, args.boss_rush, | 226 args.replay, args.save_replay, args.skip_replay, args.boss_rush, |
233 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, | 227 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, |
234 args.no_background, args.no_particles, args.hints, args.verbosity) | 228 args.no_background, args.no_particles, args.no_music, args.hints, |
229 args.verbosity) |