Mercurial > touhou
comparison pytouhou/formats/t6rp.py @ 374:6a63fd3deb76
Use an iterator to get the keystates from a replay.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 05 Aug 2012 18:19:42 +0200 |
parents | 6deab6ad8be8 |
children | 70e2ed71b09c |
comparison
equal
deleted
inserted
replaced
373:6deab6ad8be8 | 374:6a63fd3deb76 |
---|---|
39 self.lives = 2 | 39 self.lives = 2 |
40 self.bombs = 3 | 40 self.bombs = 3 |
41 self.difficulty = 16 | 41 self.difficulty = 16 |
42 self.unknown = 0 | 42 self.unknown = 0 |
43 self.keys = [] | 43 self.keys = [] |
44 | |
45 | |
46 def iter_keystates(self): | |
47 counter = 0 | |
48 previous = 0 | |
49 for frame, keystate, unknown in self.keys: | |
50 while frame >= counter: | |
51 yield previous | |
52 counter += 1 | |
53 previous = keystate | |
54 | |
44 | 55 |
45 | 56 |
46 class T6RP(object): | 57 class T6RP(object): |
47 def __init__(self): | 58 def __init__(self): |
48 self.version = 0x102 | 59 self.version = 0x102 |