comparison pytouhou/vm/eclrunner.py @ 590:e15672733c93

Switch to Python 3.x instead of 2.7.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 30 Sep 2014 17:14:24 +0200
parents e4c9eafab6d0
children d18c0bf11138
comparison
equal deleted inserted replaced
589:0768122da817 590:e15672733c93
21 21
22 logger = get_logger(__name__) 22 logger = get_logger(__name__)
23 23
24 24
25 25
26 class ECLMainRunner(object): 26 class ECLMainRunner(metaclass=MetaRegistry):
27 __metaclass__ = MetaRegistry
28 __slots__ = ('_main', '_subs', '_game', 'frame', 27 __slots__ = ('_main', '_subs', '_game', 'frame',
29 'instruction_pointer', 'boss_wait', 'handlers') 28 'instruction_pointer', 'boss_wait', 'handlers')
30 29
31 def __init__(self, main, subs, game): 30 def __init__(self, main, subs, game):
32 self._main = main 31 self._main = main
116 self.boss_wait = True 115 self.boss_wait = True
117 116
118 117
119 118
120 119
121 class ECLRunner(object): 120 class ECLRunner(metaclass=MetaRegistry):
122 __metaclass__ = MetaRegistry
123 __slots__ = ('_subs', '_enemy', '_game', '_pop_enemy', 'variables', 'sub', 121 __slots__ = ('_subs', '_enemy', '_game', '_pop_enemy', 'variables', 'sub',
124 'frame', 'instruction_pointer', 'comparison_reg', 'stack', 122 'frame', 'instruction_pointer', 'comparison_reg', 'stack',
125 'running', 'handlers') 123 'running', 'handlers')
126 124
127 def __init__(self, subs, sub, enemy, game, pop_enemy): 125 def __init__(self, subs, sub, enemy, game, pop_enemy):
932 if number > 0: 930 if number > 0:
933 #TODO: find the real formula in the binary. 931 #TODO: find the real formula in the binary.
934 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128, 932 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128,
935 self._enemy.y - 64 + self._game.prng.rand_double() * 128, 933 self._enemy.y - 64 + self._game.prng.rand_double() * 128,
936 2) 934 2)
937 for i in xrange(number - 1): 935 for i in range(number - 1):
938 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128, 936 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128,
939 self._enemy.y - 64 + self._game.prng.rand_double() * 128, 937 self._enemy.y - 64 + self._game.prng.rand_double() * 128,
940 0) 938 0)
941 else: 939 else:
942 for i in xrange(number): 940 for i in range(number):
943 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128, 941 self._game.drop_bonus(self._enemy.x - 64 + self._game.prng.rand_double() * 128,
944 self._enemy.y - 64 + self._game.prng.rand_double() * 128, 942 self._enemy.y - 64 + self._game.prng.rand_double() * 128,
945 1) 943 1)
946 944
947 945
984 self._game.time_stop = True 982 self._game.time_stop = True
985 else: 983 else:
986 self._game.time_stop = False 984 self._game.time_stop = False
987 elif function == 7: # Remilia’s laser webs 985 elif function == 7: # Remilia’s laser webs
988 base_angle = self._game.prng.rand_double() * 2 * pi 986 base_angle = self._game.prng.rand_double() * 2 * pi
989 for i in xrange(16): 987 for i in range(16):
990 delta = [+pi / 4., -pi / 4.][i % 2] 988 delta = [+pi / 4., -pi / 4.][i % 2]
991 ox, oy = self._enemy.bullet_launch_offset 989 ox, oy = self._enemy.bullet_launch_offset
992 length = 32. #TODO: check 990 length = 32. #TODO: check
993 991
994 # Inner circle 992 # Inner circle