comparison pytouhou/formats/ecl.py @ 20:6ebf9539c077

Handle more enemies types and movements
author Thibaut Girka <thib@sitedethib.com>
date Thu, 11 Aug 2011 12:13:48 +0200
parents ca26a84916cb
children 1b0ca2fb89f9
comparison
equal deleted inserted replaced
19:ca7886296d4a 20:6ebf9539c077
40 time, = unpack('<H', file.read(2)) 40 time, = unpack('<H', file.read(2))
41 if time == 0xffff: 41 if time == 0xffff:
42 break 42 break
43 sub, instr_type, size = unpack('<HHH', file.read(6)) 43 sub, instr_type, size = unpack('<HHH', file.read(6))
44 data = file.read(size - 8) 44 data = file.read(size - 8)
45 if instr_type == 0: # Normal enemy 45 if instr_type in (0, 2, 4, 6): # Enemy spawn
46 args = unpack('<ffIhHHH', data)
47 elif instr_type == 2: # Mirrored enemy
48 args = unpack('<ffIhHHH', data) 46 args = unpack('<ffIhHHH', data)
49 else: 47 else:
50 print('ECL: Warning: unknown opcode %d (%r)' % (instr_type, data)) #TODO 48 print('ECL: Warning: unknown opcode %d (%r)' % (instr_type, data)) #TODO
51 args = (data,) 49 args = (data,)
52 ecl.main.append((time, sub, instr_type, args)) 50 ecl.main.append((time, sub, instr_type, args))