Mercurial > touhou
comparison pytouhou/game/game.py @ 188:008f90ebfdc0
Fix replay handling and add support for encrypted replays
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Thu, 27 Oct 2011 14:24:07 +0200 |
parents | 54eb6b254b7b |
children | dbe6b7b2d3fc |
comparison
equal
deleted
inserted
replaced
187:46793ccfedca | 188:008f90ebfdc0 |
---|---|
25 | 25 |
26 | 26 |
27 | 27 |
28 class Game(object): | 28 class Game(object): |
29 def __init__(self, resource_loader, player_states, stage, rank, difficulty, | 29 def __init__(self, resource_loader, player_states, stage, rank, difficulty, |
30 bullet_types, item_types, characters, nb_bullets_max=None): | 30 bullet_types, item_types, characters, prng=None, nb_bullets_max=None): |
31 self.resource_loader = resource_loader | 31 self.resource_loader = resource_loader |
32 | 32 |
33 self.nb_bullets_max = nb_bullets_max | 33 self.nb_bullets_max = nb_bullets_max |
34 self.bullet_types = bullet_types | 34 self.bullet_types = bullet_types |
35 self.item_types = item_types | 35 self.item_types = item_types |
46 self.stage = stage | 46 self.stage = stage |
47 self.rank = rank | 47 self.rank = rank |
48 self.difficulty = difficulty | 48 self.difficulty = difficulty |
49 self.boss = None | 49 self.boss = None |
50 self.spellcard = None | 50 self.spellcard = None |
51 self.prng = Random() | 51 self.prng = prng or Random() |
52 self.frame = 0 | 52 self.frame = 0 |
53 | 53 |
54 self.enm_anm_wrapper = resource_loader.get_anm_wrapper2(('stg%denm.anm' % stage, | 54 self.enm_anm_wrapper = resource_loader.get_anm_wrapper2(('stg%denm.anm' % stage, |
55 'stg%denm2.anm' % stage)) | 55 'stg%denm2.anm' % stage)) |
56 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) | 56 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) |
57 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) | 57 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) |
58 self.ecl_runner = ECLMainRunner(ecl, self) | 58 self.ecl_runner = ECLMainRunner(ecl, self) |
59 | |
60 #TODO: The game calls it two times. What for? | |
61 # See 102h.exe@0x413220 if you think you're brave enough. | |
62 self.prng.rand_uint16() | |
63 self.prng.rand_uint16() | |
59 | 64 |
60 | 65 |
61 def drop_bonus(self, x, y, _type, end_pos=None): | 66 def drop_bonus(self, x, y, _type, end_pos=None): |
62 player = self.players[0] #TODO | 67 player = self.players[0] #TODO |
63 if _type > 6: | 68 if _type > 6: |