Mercurial > touhou
changeset 546:94dd9862c470
Rename the eosd script into pytouhou, and remove the obsolete pcb one.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 21 May 2014 20:52:42 +0200 |
parents | bcff39c920ab |
children | e35bef07290d |
files | anmviewer eosd pcb pytouhou/games/pcb.py scripts/anmviewer scripts/pytouhou setup.py |
diffstat | 5 files changed, 2 insertions(+), 181 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100755 --- a/pcb +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python2 -# -*- encoding: utf-8 -*- -## -## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published -## by the Free Software Foundation; version 3 only. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## - -import argparse -import os - -import pyximport -pyximport.install() - -from pytouhou.resource.loader import Loader -from pytouhou.game.background import Background -from pytouhou.ui.gamerunner import GameRunner -from pytouhou.games.pcb import PCBGame -from pytouhou.game.player import PlayerState - - -def main(path, stage_num, rank, character, data): - resource_loader = Loader(path) - resource_loader.scan_archives(data) - game = PCBGame(resource_loader, [PlayerState(character=character)], stage_num, rank, 16) - - # Load stage data - stage = resource_loader.get_stage('stage%d.std' % stage_num) - - background_anm_wrapper = resource_loader.get_anm_wrapper(('stg%dbg.anm' % stage_num,)) - background = Background(stage, background_anm_wrapper) - - # Main loop - runner = GameRunner(resource_loader, game, background) - runner.start() - - -parser = argparse.ArgumentParser(description='Libre reimplementation of the Touhou 6 engine.') - -parser.add_argument('data', metavar='DAT', default=('Th07.dat'), nargs='*', help='Game’s .DAT data files') -parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') -parser.add_argument('-s', '--stage', metavar='STAGE', type=int, required=True, help='Stage, 1 to 6, 7 (Extra) and 8 (Phantasm).') -parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') -parser.add_argument('-c', '--character', metavar='CHARACTER', type=int, default=0, help='Select the character to use, from 0 (ReimuA, default) to 5 (SakuyaB).') - -args = parser.parse_args() - -main(args.path, args.stage, args.rank, args.character, tuple(args.data))
deleted file mode 100644 --- a/pytouhou/games/pcb.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- encoding: utf-8 -*- -## -## Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published -## by the Free Software Foundation; version 3 only. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## - -from pytouhou.utils.interpolator import Interpolator - -from pytouhou.game.game import Game -from pytouhou.game.bullettype import BulletType -from pytouhou.game.bullettype import LaserType -from pytouhou.game.itemtype import ItemType -from pytouhou.game.player import Player -from pytouhou.game.orb import Orb - -from math import pi - - -class PCBGame(Game): - def __init__(self, resource_loader, player_states, stage, rank, difficulty, - bullet_types=None, laser_types=None, item_types=None, - nb_bullets_max=640, width=384, height=448, prng=None): - if not bullet_types: - etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) - etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) - bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4), - BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6), - BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4), - BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6), - BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5), - BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4), - BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16), - BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11), - BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9), - BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)] - - if not laser_types: - laser_types = [] #TODO - - if not item_types: - item_types = [ItemType(etama3, 0, 7), #Power - ItemType(etama3, 1, 8), #Point - ItemType(etama3, 2, 9), #Big power - ItemType(etama3, 3, 10), #Bomb - ItemType(etama3, 4, 11), #Full power - ItemType(etama3, 5, 12), #1up - ItemType(etama3, 6, 13)] #Star - - players = [PCBPlayer(state, self, resource_loader) for state in player_states] - - Game.__init__(self, resource_loader, players, stage, rank, difficulty, - bullet_types, laser_types, item_types, nb_bullets_max, - width, height, prng) - - - -class PCBPlayer(Player): - def __init__(self, state, game, resource_loader): - number = '%d%s' % (state.character // 2, 'b' if state.character % 2 else 'a') - self.sht = resource_loader.get_sht('ply0%s.sht' % number) - self.focused_sht = resource_loader.get_sht('ply0%ss.sht' % number) - anm_wrapper = resource_loader.get_anm_wrapper(('player0%d.anm' % (state.character // 2),)) - self.anm_wrapper = anm_wrapper - - Player.__init__(self, state, game, anm_wrapper) - - self.orbs = [Orb(self.anm_wrapper, 128, self.state, None), - Orb(self.anm_wrapper, 129, self.state, None)] - - self.orbs[0].offset_x = -24 - self.orbs[1].offset_x = 24 - - self.orb_dx_interpolator = None - self.orb_dy_interpolator = None - - - def start_focusing(self): - self.orb_dx_interpolator = Interpolator((24,), self._game.frame, - (8,), self._game.frame + 8, - lambda x: x ** 2) - self.orb_dy_interpolator = Interpolator((0,), self._game.frame, - (-32,), self._game.frame + 8) - self.state.focused = True - - - def stop_focusing(self): - self.orb_dx_interpolator = Interpolator((8,), self._game.frame, - (24,), self._game.frame + 8, - lambda x: x ** 2) - self.orb_dy_interpolator = Interpolator((-32,), self._game.frame, - (0,), self._game.frame + 8) - self.state.focused = False - - - def objects(self): - return self.orbs - - - def update(self, keystate): - Player.update(self, keystate) - - if self.death_time == 0 or self._game.frame - self.death_time > 60: - if self.orb_dx_interpolator: - self.orb_dx_interpolator.update(self._game.frame) - dx, = self.orb_dx_interpolator.values - self.orbs[0].offset_x = -dx - self.orbs[1].offset_x = dx - if self.orb_dy_interpolator: - self.orb_dy_interpolator.update(self._game.frame) - dy, = self.orb_dy_interpolator.values - self.orbs[0].offset_y = dy - self.orbs[1].offset_y = dy - - for orb in self.orbs: - orb.update() -
--- a/setup.py +++ b/setup.py @@ -129,7 +129,7 @@ else: nthreads = None # It seems Windows can’t compile in parallel. base = 'Win32GUI' if sys.platform == 'win32' else None extra = {'options': {'build_exe': {'includes': extension_names + ['glob', 'socket', 'select']}}, - 'executables': [Executable(script='eosd', base=base)]} + 'executables': [Executable(script='scripts/pytouhou', base=base)]} setup(name='PyTouhou', @@ -148,5 +148,5 @@ setup(name='PyTouhou', 'MAX_SOUNDS': 26, 'USE_OPENGL': use_opengl, 'USE_GLEW': is_windows}), - scripts=['eosd'] + (['anmviewer'] if anmviewer else []), + scripts=['scripts/pytouhou'] + (['scripts/anmviewer'] if anmviewer else []), **extra)