Mercurial > touhou
comparison pytouhou/formats/std.py @ 111:340fcda8e64a
Fix a few, minor things
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 06 Sep 2011 21:28:44 +0200 |
parents | 3ac41b966fed |
children | c596a1a69402 |
comparison
equal
deleted
inserted
replaced
110:3ac41b966fed | 111:340fcda8e64a |
---|---|
18 | 18 |
19 logger = get_logger(__name__) | 19 logger = get_logger(__name__) |
20 | 20 |
21 | 21 |
22 class Model(object): | 22 class Model(object): |
23 def __init__(self): | 23 def __init__(self, unknown=0, bounding_box=None, quads=None): |
24 self.unknown = 0 | 24 self.unknown = 0 |
25 self.bounding_box = (0., 0., 0., | 25 self.bounding_box = bounding_box or (0., 0., 0., |
26 0., 0., 0.) | 26 0., 0., 0.) |
27 self.quads = [] | 27 self.quads = quads or [] |
28 | 28 |
29 | 29 |
30 | 30 |
31 class Stage(object): | 31 class Stage(object): |
32 _instructions = {0: ('fff', 'set_viewpos'), | 32 _instructions = {0: ('fff', 'set_viewpos'), |
33 1: ('BBBBff', 'set_fog'), | 33 1: ('BBBxff', 'set_fog'), |
34 2: ('fff', 'set_viewpos2'), | 34 2: ('fff', 'set_viewpos2'), |
35 3: ('III', 'start_interpolating_viewpos2'), | 35 3: ('III', 'start_interpolating_viewpos2'), |
36 4: ('III', 'start_interpolating_fog')} | 36 4: ('III', 'start_interpolating_fog')} |
37 | 37 |
38 def __init__(self): | 38 def __init__(self): |
39 self.name = '' | 39 self.name = '' |
40 self.bgms = (('', ''), ('', ''), ('', '')) | 40 self.bgms = (('', ''), ('', ''), ('', ''), ('', '')) |
41 self.models = [] | 41 self.models = [] |
42 self.object_instances = [] | 42 self.object_instances = [] |
43 self.script = [] | 43 self.script = [] |
44 | 44 |
45 | 45 |
68 | 68 |
69 # Read model definitions | 69 # Read model definitions |
70 offsets = unpack('<%s' % ('I' * nb_models), file.read(4 * nb_models)) | 70 offsets = unpack('<%s' % ('I' * nb_models), file.read(4 * nb_models)) |
71 for offset in offsets: | 71 for offset in offsets: |
72 model = Model() | 72 model = Model() |
73 file.seek(offset) | |
73 id_, unknown, x, y, z, width, height, depth = unpack('<HHffffff', file.read(28)) | 74 id_, unknown, x, y, z, width, height, depth = unpack('<HHffffff', file.read(28)) |
74 model.unknown = unknown | 75 model.unknown = unknown |
75 model.bounding_box = x, y, z, width, height, depth #TODO: check | 76 model.bounding_box = x, y, z, width, height, depth #TODO: check |
76 while True: | 77 while True: |
77 unknown, size = unpack('<HH', file.read(4)) | 78 unknown, size = unpack('<HH', file.read(4)) |