diff options
author | Sven Hesse | 2011-09-12 17:11:31 +0200 |
---|---|---|
committer | Sven Hesse | 2011-09-14 18:54:28 +0200 |
commit | a43794b9c4e7cfd5b5bba760c08e19350c7d0c98 (patch) | |
tree | e1a0f1a3cae78bd2759a37679c0d501f7c704b67 /engines | |
parent | ac3593c63143e7bea9dfab6b237a812186c9dcee (diff) | |
download | scummvm-rg350-a43794b9c4e7cfd5b5bba760c08e19350c7d0c98.tar.gz scummvm-rg350-a43794b9c4e7cfd5b5bba760c08e19350c7d0c98.tar.bz2 scummvm-rg350-a43794b9c4e7cfd5b5bba760c08e19350c7d0c98.zip |
GOB: Add ANIObject animation mode
Play the animation continuously or only once.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/aniobject.cpp | 12 | ||||
-rw-r--r-- | engines/gob/aniobject.h | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp index 9974874bbf..c689145b75 100644 --- a/engines/gob/aniobject.cpp +++ b/engines/gob/aniobject.cpp @@ -27,7 +27,8 @@ namespace Gob { ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani), - _visible(false), _paused(false), _x(0), _y(0), _background(0), _drawn(false) { + _visible(false), _paused(false), _mode(kModeContinuous), + _x(0), _y(0), _background(0), _drawn(false) { setAnimation(0); setPosition(); @@ -53,6 +54,10 @@ bool ANIObject::isPaused() const { return _paused; } +void ANIObject::setMode(Mode mode) { + _mode = mode; +} + void ANIObject::setAnimation(uint16 animation) { _animation = animation; _frame = 0; @@ -173,6 +178,11 @@ void ANIObject::advance() { if (_frame == 0) { _x += animation.deltaX; _y += animation.deltaY; + + if (_mode == kModeOnce) { + _paused = true; + _visible = false; + } } } diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h index c5352dd2b5..dfadf79b06 100644 --- a/engines/gob/aniobject.h +++ b/engines/gob/aniobject.h @@ -33,6 +33,11 @@ class Surface; /** An ANI object, controlling an animation within an ANI file. */ class ANIObject { public: + enum Mode { + kModeContinuous, ///< Play the animation continuously. + kModeOnce ///< Play the animation only once. + }; + ANIObject(const ANIFile &ani); virtual ~ANIObject(); @@ -48,6 +53,9 @@ public: /** Is the animation currently paused? */ bool isPaused() const; + /** Set the animation mode. */ + void setMode(Mode mode); + /** Set the current position to the animation's default. */ void setPosition(); /** Set the current position. */ @@ -89,6 +97,8 @@ private: bool _visible; ///< Is the object currently visible? bool _paused; ///< Is the animation currently paused? + Mode _mode; ///< The animation mode. + int16 _x; ///< The current X position. int16 _y; ///< The current Y position. |