comparison pytouhou/formats/std.py @ 15:07fba4e1da65

Refactor
author Thibaut Girka <thib@sitedethib.com>
date Fri, 05 Aug 2011 21:21:06 +0200
parents 58bc264aba38
children 6ebf9539c077
comparison
equal deleted inserted replaced
14:07a7f28c8aaa 15:07fba4e1da65
9 self.quads = [] 9 self.quads = []
10 10
11 11
12 12
13 class Stage(object): 13 class Stage(object):
14 def __init__(self): 14 def __init__(self, num):
15 self.num = num
15 self.name = '' 16 self.name = ''
16 self.bgms = (('', ''), ('', ''), ('', '')) 17 self.bgms = (('', ''), ('', ''), ('', ''))
17 self.objects = [] 18 self.objects = []
18 self.object_instances = [] 19 self.object_instances = []
19 self.script = [] 20 self.script = []
20 21
21 22
22 @classmethod 23 @classmethod
23 def read(cls, file): 24 def read(cls, file, num):
24 stage = Stage() 25 stage = Stage(num)
25 26
26 nb_objects, nb_faces = unpack('<HH', file.read(4)) 27 nb_objects, nb_faces = unpack('<HH', file.read(4))
27 object_instances_offset, script_offset = unpack('<II', file.read(8)) 28 object_instances_offset, script_offset = unpack('<II', file.read(8))
28 if file.read(4) != b'\x00\x00\x00\x00': 29 if file.read(4) != b'\x00\x00\x00\x00':
29 raise Exception #TODO 30 raise Exception #TODO