comparison pytouhou/formats/std.py @ 97:ac2e5e1c2c3c

Refactor \o/
author Thibaut Girka <thib@sitedethib.com>
date Sun, 04 Sep 2011 23:50:00 +0200
parents ca571697ec83
children 3ac41b966fed
comparison
equal deleted inserted replaced
96:54929d495654 97:ac2e5e1c2c3c
27 self.quads = [] 27 self.quads = []
28 28
29 29
30 30
31 class Stage(object): 31 class Stage(object):
32 def __init__(self, num): 32 def __init__(self):
33 self.num = num
34 self.name = '' 33 self.name = ''
35 self.bgms = (('', ''), ('', ''), ('', '')) 34 self.bgms = (('', ''), ('', ''), ('', ''))
36 self.models = [] 35 self.models = []
37 self.object_instances = [] 36 self.object_instances = []
38 self.script = [] 37 self.script = []
39 38
40 39
41 @classmethod 40 @classmethod
42 def read(cls, file, num): 41 def read(cls, file):
43 stage = Stage(num) 42 stage = Stage()
44 43
45 nb_models, nb_faces = unpack('<HH', file.read(4)) 44 nb_models, nb_faces = unpack('<HH', file.read(4))
46 object_instances_offset, script_offset = unpack('<II', file.read(8)) 45 object_instances_offset, script_offset = unpack('<II', file.read(8))
47 if file.read(4) != b'\x00\x00\x00\x00': 46 if file.read(4) != b'\x00\x00\x00\x00':
48 raise Exception #TODO 47 raise Exception #TODO