Mercurial > touhou
comparison eosd @ 487:711c75115675
Various netplay-related fixes.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 28 Sep 2013 20:11:41 +0200 |
parents | 2f53be1b2f60 |
children | 887de1309491 |
comparison
equal
deleted
inserted
replaced
486:2f53be1b2f60 | 487:711c75115675 |
---|---|
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('--no-music', action='store_false', help='Disable background music.') |
46 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.') |
47 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.') |
48 parser.add_argument('--game', metavar='GAME', choices=['EoSD'], default='EoSD', help='Select the game engine to use.') | 48 parser.add_argument('--game', metavar='GAME', choices=['EoSD'], default='EoSD', help='Select the game engine to use.') |
49 parser.add_argument('--port', metavar='PORT', type=int, default=0, help='Port to use for netplay') | 49 parser.add_argument('--port', metavar='PORT', type=int, default=0, help='Local port to use for netplay') |
50 parser.add_argument('--remote', metavar='REMOTE', default=None, help='Remote address') | 50 parser.add_argument('--remote', metavar='REMOTE', default=None, help='Remote address') |
51 | 51 |
52 args = parser.parse_args() | 52 args = parser.parse_args() |
53 | 53 |
54 | 54 |
137 if save_filename: | 137 if save_filename: |
138 save_replay = T6RP() | 138 save_replay = T6RP() |
139 save_replay.rank = rank | 139 save_replay.rank = rank |
140 save_replay.character = character | 140 save_replay.character = character |
141 | 141 |
142 difficulty = 16 | |
143 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] | |
144 | |
142 if port != 0: | 145 if port != 0: |
143 players = [PlayerState(character=0), PlayerState(character=2)] | |
144 | |
145 if remote: | 146 if remote: |
146 remote_addr, remote_port = remote.split(':') | 147 remote_addr, remote_port = remote.split(':') |
147 addr = remote_addr, int(remote_port) | 148 addr = remote_addr, int(remote_port) |
148 selected_player = 0 | 149 selected_player = 0 |
149 else: | 150 else: |
150 addr = None | 151 addr = None |
151 selected_player = 1 | 152 selected_player = 1 |
152 | 153 |
153 prng = Random(0) | 154 prng = Random(0) |
154 con = Network(port, addr, selected_player) | 155 con = Network(port, addr, selected_player) |
156 states = [PlayerState(character=1, power=default_power, continues=continues), | |
157 PlayerState(character=3, power=default_power, continues=continues)] | |
155 else: | 158 else: |
156 con = None | 159 con = None |
160 selected_player = 0 | |
161 states = [PlayerState(character=character, power=default_power, continues=continues)] | |
157 | 162 |
158 if hints: | 163 if hints: |
159 with open(hints, 'rb') as file: | 164 with open(hints, 'rb') as file: |
160 hints = Hint.read(file) | 165 hints = Hint.read(file) |
161 | 166 |
162 difficulty = 16 | |
163 default_power = [0, 64, 128, 128, 128, 128, 0][stage_num - 1] | |
164 states = [PlayerState(character=character, power=default_power, continues=continues)] | |
165 | |
166 game_class = GameBossRush if boss_rush else Game | 167 game_class = GameBossRush if boss_rush else Game |
167 | 168 |
168 common = Common(resource_loader) | 169 common = Common(resource_loader, states[selected_player]) |
169 runner = GameRunner(window, resource_loader, skip=skip_replay, con=con) | 170 runner = GameRunner(window, resource_loader, skip=skip_replay, con=con) |
170 while True: | 171 while True: |
171 if replay: | 172 if replay: |
172 level = replay.levels[stage_num - 1] | 173 level = replay.levels[stage_num - 1] |
173 if not level: | 174 if not level: |