Mercurial > touhou
comparison pcb @ 220:0595315d3880
Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 18 Dec 2011 14:14:32 +0100 |
parents | |
children | 9bb26dbb8438 |
comparison
equal
deleted
inserted
replaced
219:091301805cce | 220:0595315d3880 |
---|---|
1 #!/usr/bin/env python | |
2 # -*- encoding: utf-8 -*- | |
3 ## | |
4 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> | |
5 ## | |
6 ## This program is free software; you can redistribute it and/or modify | |
7 ## it under the terms of the GNU General Public License as published | |
8 ## by the Free Software Foundation; version 3 only. | |
9 ## | |
10 ## This program is distributed in the hope that it will be useful, | |
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ## GNU General Public License for more details. | |
14 ## | |
15 | |
16 import argparse | |
17 import os | |
18 | |
19 import pyximport | |
20 pyximport.install() | |
21 | |
22 from pytouhou.resource.loader import Loader | |
23 from pytouhou.game.background import Background | |
24 from pytouhou.ui.gamerunner import GameRunner | |
25 from pytouhou.games.pcb import PCBGame | |
26 from pytouhou.game.player import PlayerState | |
27 | |
28 | |
29 def main(path, stage_num, rank, character, data): | |
30 resource_loader = Loader() | |
31 resource_loader.scan_archives(os.path.join(path, name) | |
32 for name in data) | |
33 game = PCBGame(resource_loader, [PlayerState(character=character)], stage_num, rank, 16) | |
34 | |
35 # Load stage data | |
36 stage = resource_loader.get_stage('stage%d.std' % stage_num) | |
37 | |
38 background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) | |
39 background = Background(stage, background_anm_wrapper) | |
40 | |
41 # Let's go! | |
42 print(stage.name) | |
43 | |
44 # Main loop | |
45 runner = GameRunner(resource_loader, game, background) | |
46 runner.start() | |
47 | |
48 | |
49 parser = argparse.ArgumentParser(description='Libre reimplementation of the Touhou 6 engine.') | |
50 | |
51 parser.add_argument('data', metavar='DAT', default=('Th07.dat'), nargs='*', help='Game’s .DAT data files') | |
52 parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') | |
53 parser.add_argument('-s', '--stage', metavar='STAGE', type=int, required=True, help='Stage, 1 to 6, 7 (Extra) and 8 (Phantasm).') | |
54 parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') | |
55 parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 5 (SakuyaB).') | |
56 | |
57 args = parser.parse_args() | |
58 | |
59 main(args.path, args.stage, args.rank, args.character, tuple(args.data)) |