comparison eosd @ 492:887de1309491

Add friendly fire in netplay.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 21 Sep 2013 20:26:39 +0200
parents 711c75115675
children 6be9c99a3a24
comparison
equal deleted inserted replaced
491:2276229282fd 492:887de1309491
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='Local 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 parser.add_argument('--no-friendly-fire', action='store_false', help='Allow friendly-fire during netplay.')
51 52
52 args = parser.parse_args() 53 args = parser.parse_args()
53 54
54 55
55 import sys 56 import sys
99 Game.cleanup(self) 100 Game.cleanup(self)
100 101
101 102
102 def main(window, path, data, stage_num, rank, character, replay, save_filename, 103 def main(window, path, data, stage_num, rank, character, replay, save_filename,
103 skip_replay, boss_rush, debug, enable_background, enable_particles, 104 skip_replay, boss_rush, debug, enable_background, enable_particles,
104 enable_music, hints, verbosity, port, remote): 105 enable_music, hints, verbosity, port, remote, friendly_fire):
105 106
106 resource_loader = Loader(path) 107 resource_loader = Loader(path)
107 108
108 try: 109 try:
109 resource_loader.scan_archives(data) 110 resource_loader.scan_archives(data)
151 addr = None 152 addr = None
152 selected_player = 1 153 selected_player = 1
153 154
154 prng = Random(0) 155 prng = Random(0)
155 con = Network(port, addr, selected_player) 156 con = Network(port, addr, selected_player)
156 states = [PlayerState(character=1, power=default_power, continues=continues), 157 states = [PlayerState(0, character=1, power=default_power, continues=continues),
157 PlayerState(character=3, power=default_power, continues=continues)] 158 PlayerState(1, character=3, power=default_power, continues=continues)]
158 else: 159 else:
159 con = None 160 con = None
160 selected_player = 0 161 selected_player = 0
161 states = [PlayerState(character=character, power=default_power, continues=continues)] 162 states = [PlayerState(0, character=character, power=default_power, continues=continues)]
162 163
163 if hints: 164 if hints:
164 with open(hints, 'rb') as file: 165 with open(hints, 'rb') as file:
165 hints = Hint.read(file) 166 hints = Hint.read(file)
166 167
202 level.difficulty = difficulty 203 level.difficulty = difficulty
203 save_keystates = [] 204 save_keystates = []
204 205
205 hints_stage = hints.stages[stage_num - 1] if hints else None 206 hints_stage = hints.stages[stage_num - 1] if hints else None
206 207
207 game = game_class(resource_loader, states, stage_num, rank, difficulty, common, prng=prng, hints=hints_stage) 208 game = game_class(resource_loader, states, stage_num, rank, difficulty,
209 common, prng=prng, hints=hints_stage,
210 friendly_fire=friendly_fire)
208 211
209 if not enable_particles: 212 if not enable_particles:
210 def new_particle(pos, anim, amp, number=1, reverse=False, duration=24): 213 def new_particle(pos, anim, amp, number=1, reverse=False, duration=24):
211 pass 214 pass
212 game.new_particle = new_particle 215 game.new_particle = new_particle
249 fixed_pipeline=args.fixed_pipeline) 252 fixed_pipeline=args.fixed_pipeline)
250 253
251 main(window, args.path, tuple(args.data), args.stage, args.rank, 254 main(window, args.path, tuple(args.data), args.stage, args.rank,
252 args.character, args.replay, args.save_replay, args.skip_replay, 255 args.character, args.replay, args.save_replay, args.skip_replay,
253 args.boss_rush, args.debug, args.no_background, args.no_particles, 256 args.boss_rush, args.debug, args.no_background, args.no_particles,
254 args.no_music, args.hints, args.verbosity, args.port, args.remote) 257 args.no_music, args.hints, args.verbosity, args.port, args.remote,
258 args.no_friendly_fire)
255 259
256 import gc 260 import gc
257 gc.collect() 261 gc.collect()