Mercurial > touhou
comparison pytouhou/formats/sht.py @ 229:5afc75f71fed
Add “SHT” support to EoSD, and do a little cleanup.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 30 Dec 2011 18:37:06 +0100 |
parents | 0595315d3880 |
children | e59bd7979ddc |
comparison
equal
deleted
inserted
replaced
228:8f4cd1c01d22 | 229:5afc75f71fed |
---|---|
20 | 20 |
21 | 21 |
22 class Shot(object): | 22 class Shot(object): |
23 def __init__(self): | 23 def __init__(self): |
24 self.interval = 0 | 24 self.interval = 0 |
25 self.unknown1 = None | 25 self.delay = 0 |
26 self.pos = (0., 0.) | 26 self.pos = (0., 0.) |
27 self.hitbox = (0., 0.) | 27 self.hitbox = (0., 0.) |
28 self.angle = 0. | 28 self.angle = 0. |
29 self.speed = 0. | 29 self.speed = 0. |
30 self.damage = 0 | 30 self.damage = 0 |
31 self.orb = 0 | 31 self.orb = 0 |
32 self.shot_type = 0 | |
33 self.sprite = 0 | |
34 self.unknown1 = None | |
32 self.unknown2 = None | 35 self.unknown2 = None |
33 self.sprite = 0 | |
34 self.unknown3 = None | 36 self.unknown3 = None |
35 self.unknown4 = None | 37 self.unknown4 = None |
36 self.homing = False | |
37 self.unknown5 = None | 38 self.unknown5 = None |
38 self.unknown6 = None | |
39 | 39 |
40 | 40 |
41 class SHT(object): | 41 class SHT(object): |
42 def __init__(self): | 42 def __init__(self): |
43 self.unknown1 = None | 43 self.unknown1 = None |
77 for power, offset in levels: | 77 for power, offset in levels: |
78 sht.shots[power] = [] | 78 sht.shots[power] = [] |
79 file.seek(offset) | 79 file.seek(offset) |
80 | 80 |
81 while True: | 81 while True: |
82 interval, unknown1 = unpack('<HH', file.read(4)) | 82 interval, delay = unpack('<HH', file.read(4)) |
83 if interval == 0xffff and unknown1 == 0xffff: | 83 if interval == 0xffff and delay == 0xffff: |
84 break | 84 break |
85 | 85 |
86 shot = Shot() | 86 shot = Shot() |
87 | 87 |
88 shot.interval = interval | 88 shot.interval = interval |
89 shot.unknown1 = unknown1 | 89 shot.delay = delay |
90 | 90 |
91 data = unpack('<6fHBBhh4I', file.read(48)) | 91 data = unpack('<6fHBBhh4I', file.read(48)) |
92 (x, y, hitbox_x, hitbox_y, shot.angle, shot.speed, | 92 (x, y, hitbox_x, hitbox_y, shot.angle, shot.speed, |
93 shot.damage, shot.orb, shot.unknown2, shot.sprite, | 93 shot.damage, shot.orb, shot.shot_type, shot.sprite, |
94 shot.unknown3, shot.unknown4, shot.homing, shot.unknown5, | 94 shot.unknown1, shot.unknown2, shot.unknown3, shot.unknown4, |
95 shot.unknown6) = data | 95 shot.unknown5) = data |
96 | 96 |
97 shot.pos = (x, y) | 97 shot.pos = (x, y) |
98 shot.hitbox = (hitbox_x, hitbox_y) | 98 shot.hitbox = (hitbox_x, hitbox_y) |
99 | 99 |
100 sht.shots[power].append(shot) | 100 sht.shots[power].append(shot) |