Mercurial > touhou
comparison pytouhou/formats/std.py @ 13:58bc264aba38
Refactor
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 05 Aug 2011 13:23:33 +0200 |
parents | 57667251d040 |
children | 07fba4e1da65 |
comparison
equal
deleted
inserted
replaced
12:776453783743 | 13:58bc264aba38 |
---|---|
77 if (frame, message_type, size) == (0xffffffff, 0xffff, 0xffff): | 77 if (frame, message_type, size) == (0xffffffff, 0xffff, 0xffff): |
78 break | 78 break |
79 if size != 0x0c: | 79 if size != 0x0c: |
80 raise Exception #TODO | 80 raise Exception #TODO |
81 data = file.read(12) | 81 data = file.read(12) |
82 #TODO: maybe add another class for instructions... | 82 #TODO: maybe add a name somewhere |
83 stage.script.append((frame, message_type, data)) | 83 if message_type == 0: # ViewPos |
84 args = unpack('<fff', data) | |
85 elif message_type == 1: # Color | |
86 args = unpack('<BBBBff', data) | |
87 elif message_type == 2: # ViewPos2 | |
88 args = unpack('<Iff', data) | |
89 elif message_type == 3: # StartInterpolatingViewPos2 | |
90 args = tuple(unpack('<III', data)[:1]) | |
91 elif message_type == 4: # StartInterpolatingFog | |
92 args = tuple(unpack('<III', data)[:1]) | |
93 else: | |
94 args = (data,) | |
95 print('Warning: unknown opcode %d' % message_type) #TODO | |
96 stage.script.append((frame, message_type, args)) | |
84 | 97 |
85 return stage | 98 return stage |
86 | 99 |