aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/aniobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/aniobject.cpp')
-rw-r--r--engines/gob/aniobject.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index c6a9234eb9..a01fe43672 100644
--- a/engines/gob/aniobject.cpp
+++ b/engines/gob/aniobject.cpp
@@ -26,7 +26,8 @@
namespace Gob {
-ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani), _visible(false),
+ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani),
+ _visible(false), _paused(false), _mode(kModeContinuous),
_x(0), _y(0), _background(0), _drawn(false) {
setAnimation(0);
@@ -45,11 +46,27 @@ bool ANIObject::isVisible() const {
return _visible;
}
+void ANIObject::setPause(bool pause) {
+ _paused = pause;
+}
+
+bool ANIObject::isPaused() const {
+ return _paused;
+}
+
+void ANIObject::setMode(Mode mode) {
+ _mode = mode;
+}
+
void ANIObject::setAnimation(uint16 animation) {
_animation = animation;
_frame = 0;
}
+void ANIObject::rewind() {
+ _frame = 0;
+}
+
void ANIObject::setPosition() {
if (_animation >= _ani->getAnimationCount())
return;
@@ -152,6 +169,9 @@ void ANIObject::clear(Surface &dest, int16 &left, int16 &top,
}
void ANIObject::advance() {
+ if (_paused)
+ return;
+
if (_animation >= _ani->getAnimationCount())
return;
@@ -162,6 +182,11 @@ void ANIObject::advance() {
if (_frame == 0) {
_x += animation.deltaX;
_y += animation.deltaY;
+
+ if (_mode == kModeOnce) {
+ _paused = true;
+ _visible = false;
+ }
}
}