restart default animation in the slot after custom animation has ended.

svn-id: r45750
This commit is contained in:
Vladimir Menshakov 2009-11-08 11:04:22 +00:00
parent 75bbe04280
commit 4e662b22ca
3 changed files with 10 additions and 0 deletions

View File

@ -84,6 +84,10 @@ Surface *Animation::currentFrame(int dt) {
return r;
}
void Animation::restart() {
paused = false;
index = 0;
}
void Animation::free() {
id = 0;

View File

@ -48,6 +48,7 @@ public:
~Animation();
bool empty() const { return frames == NULL; }
void restart();
//uint16 width() const { return frames? frames[0].w: 0; }
//uint16 height() const { return frames? frames[0].h: 0; }

View File

@ -392,6 +392,11 @@ bool Scene::render(OSystem *system) {
got_any_animation = true;
} else {
a = animation + i;
if (!custom_animation[i].empty()) {
debug(0, "custom animation ended, restart animation in the same slot.");
custom_animation[i].free();
a->restart();
}
s = a->currentFrame();
}