diff options
-rw-r--r-- | engines/teenagent/animation.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/animation.h | 1 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp index 1f5919ebd3..ee7e05cbd3 100644 --- a/engines/teenagent/animation.cpp +++ b/engines/teenagent/animation.cpp @@ -84,6 +84,10 @@ Surface *Animation::currentFrame(int dt) { return r; } +void Animation::restart() { + paused = false; + index = 0; +} void Animation::free() { id = 0; diff --git a/engines/teenagent/animation.h b/engines/teenagent/animation.h index 3a05f20d26..5936905b5c 100644 --- a/engines/teenagent/animation.h +++ b/engines/teenagent/animation.h @@ -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; } diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index d6a4e89915..a097fd3f13 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -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(); } |