comparison scripts/pytouhou @ 548:1e9ea6519f3c

Make EoSDInterface separate from EoSD game.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 21 May 2014 20:56:53 +0200
parents e35bef07290d
children 56bca8ce4b68
comparison
equal deleted inserted replaced
547:e35bef07290d 548:1e9ea6519f3c
36 game_group.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra), nothing means story mode.') 36 game_group.add_argument('-s', '--stage', metavar='STAGE', type=int, default=None, help='Stage, 1 to 7 (Extra), nothing means story mode.')
37 game_group.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') 37 game_group.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).')
38 game_group.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).') 38 game_group.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 3 (MarisaB).')
39 game_group.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses.') 39 game_group.add_argument('-b', '--boss-rush', action='store_true', help='Fight only bosses.')
40 game_group.add_argument('--game', metavar='GAME', choices=['EoSD'], default='EoSD', help='Select the game engine to use.') 40 game_group.add_argument('--game', metavar='GAME', choices=['EoSD'], default='EoSD', help='Select the game engine to use.')
41 game_group.add_argument('--interface', metavar='INTERFACE', choices=['EoSD'], default='EoSD', help='Select the interface to use.')
41 game_group.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') 42 game_group.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.')
42 43
43 replay_group = parser.add_argument_group('Replay options') 44 replay_group = parser.add_argument_group('Replay options')
44 replay_group.add_argument('--replay', metavar='REPLAY', help='Select a file to replay.') 45 replay_group.add_argument('--replay', metavar='REPLAY', help='Select a file to replay.')
45 replay_group.add_argument('--save-replay', metavar='REPLAY', help='Save the upcoming game into a replay file.') 46 replay_group.add_argument('--save-replay', metavar='REPLAY', help='Save the upcoming game into a replay file.')
66 import logging 67 import logging
67 68
68 69
69 if args.game == 'EoSD': 70 if args.game == 'EoSD':
70 from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game 71 from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game
72
73 if args.interface == 'EoSD':
74 from pytouhou.interfaces.eosd import EoSDInterface as Interface
71 75
72 76
73 from pytouhou.lib.sdl import SDL, show_simple_message_box 77 from pytouhou.lib.sdl import SDL, show_simple_message_box
74 from pytouhou.ui.window import Window 78 from pytouhou.ui.window import Window
75 from pytouhou.resource.loader import Loader 79 from pytouhou.resource.loader import Loader
186 hints = Hint.read(file) 190 hints = Hint.read(file)
187 191
188 game_class = GameBossRush if boss_rush else Game 192 game_class = GameBossRush if boss_rush else Game
189 193
190 common = Common(resource_loader, characters, continues, stage_num - 1) 194 common = Common(resource_loader, characters, continues, stage_num - 1)
195 interface = Interface(resource_loader, common.players[0]) #XXX
196 common.interface = interface #XXX
191 renderer = GameRenderer(resource_loader, window) 197 renderer = GameRenderer(resource_loader, window)
192 runner = GameRunner(window, renderer, common, resource_loader, skip_replay, con) 198 runner = GameRunner(window, renderer, common, resource_loader, skip_replay, con)
193 window.set_runner(runner) 199 window.set_runner(runner)
194 200
195 while True: 201 while True: