changeset 312:8d1768fa4cbb

Fix Remilia's “Red Magic”.
author Thibaut Girka <thib@sitedethib.com>
date Wed, 14 Mar 2012 19:05:23 +0100
parents 550ec10cccbc
children 2ba2462afc70
files pytouhou/game/bullettype.py pytouhou/games/eosd.py pytouhou/vm/eclrunner.py
diffstat 3 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/bullettype.py
+++ b/pytouhou/game/bullettype.py
@@ -3,7 +3,9 @@ class BulletType(object):
                  launch_anim2_index, launch_anim4_index, launch_anim8_index,
                  hitbox_size,
                  launch_anim_penalties=(0.5, 0.4, 1./3.),
-                 launch_anim_offsets=(0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0)):
+                 launch_anim_offsets=(0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0),
+                 type_id=0):
+        self.type_id = type_id
         self.anm_wrapper = anm_wrapper
         self.anim_index = anim_index
         self.cancel_anim_index = cancel_anim_index
--- a/pytouhou/games/eosd.py
+++ b/pytouhou/games/eosd.py
@@ -35,20 +35,30 @@ class EoSDGame(Game):
         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),
+            bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4,
+                                       type_id=0),
+                            BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6,
+                                       type_id=1),
+                            BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4,
+                                       type_id=2),
+                            BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6,
+                                       type_id=3),
+                            BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5,
+                                       type_id=4),
+                            BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4,
+                                       type_id=5),
                             BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16,
-                                       launch_anim_offsets=(0, 1, 1, 2, 2, 3, 4, 0)),
+                                       launch_anim_offsets=(0, 1, 1, 2, 2, 3, 4, 0),
+                                       type_id=6),
                             BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11,
-                                       launch_anim_offsets=(1,)*28),
+                                       launch_anim_offsets=(1,)*28,
+                                       type_id=7),
                             BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9,
-                                       launch_anim_offsets=(0, 1, 1, 2, 2, 3, 4, 0)),
+                                       launch_anim_offsets=(0, 1, 1, 2, 2, 3, 4, 0),
+                                       type_id=8),
                             BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32,
-                                       launch_anim_offsets=(0, 1, 2, 3, 4, 5, 6, 7, 8))]
+                                       launch_anim_offsets=(0, 1, 2, 3, 4, 5, 6, 7, 8),
+                                       type_id=9)]
 
         if not laser_types:
             laser_types = [LaserType(etama3, 9),
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -1063,7 +1063,7 @@ class ECLRunner(object):
             bullet_attributes = [70, 1, 1, 1, 1, 0., 0., 0., 0.7, 0]
             n = 0
             for bullet in self._game.bullets:
-                if bullet._bullet_type.anim_index < 5:
+                if bullet._bullet_type.type_id < 5:
                     continue
                 n += 1
                 bullet_attributes[8] = bullet.angle
@@ -1074,7 +1074,7 @@ class ECLRunner(object):
             self._game.new_effect((self._enemy.x, self._enemy.y), 17)
             self._game.prng.rand_double() #TODO: what is it for?
             for bullet in self._game.bullets: #TODO Bullet order is WRONG
-                if bullet._bullet_type.anim_index < 5 and bullet.speed == 0.:
+                if bullet._bullet_type.type_id < 5 and bullet.speed == 0.:
                     bullet.flags = 16 #TODO: check
                     angle = pi + self._game.prng.rand_double() * 2. * pi
                     bullet.attributes[4:6] = [0.01, angle] #TODO: check