aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/animation.cpp28
-rw-r--r--engines/draci/animation.h11
2 files changed, 33 insertions, 6 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index 94c12d1c51..5e6578de57 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -28,16 +28,31 @@
namespace Draci {
-void Animation::addAnimation(uint id, uint z) {
+void Animation::addAnimation(uint id, uint z, bool playing) {
AnimObj *obj = new AnimObj();
obj->_id = id;
obj->_z = z;
obj->_currentFrame = 0;
+ obj->_playing = playing;
insertAnimation(*obj);
}
+void Animation::play(uint id) {
+
+ AnimObj &obj = *getAnimation(id);
+
+ obj._playing = true;
+}
+
+void Animation::stop(uint id) {
+
+ AnimObj &obj = *getAnimation(id);
+
+ obj._playing = false;
+}
+
Common::List<AnimObj>::iterator Animation::getAnimation(uint id) {
Common::List<AnimObj>::iterator it;
@@ -75,6 +90,7 @@ void Animation::addOverlay(Drawable *overlay, uint z) {
obj->_id = kOverlayImage;
obj->_z = z;
obj->_currentFrame = 0;
+ obj->_playing = true;
obj->_frames.push_back(overlay);
insertAnimation(*obj);
@@ -85,7 +101,11 @@ void Animation::drawScene(Surface *surf) {
Common::List<AnimObj>::iterator it;
for (it = _animObjects.begin(); it != _animObjects.end(); ++it) {
- if(it->_id == kOverlayImage) {
+ if (!it->_playing) {
+ continue;
+ }
+
+ if (it->_id == kOverlayImage) {
it->_frames[it->_currentFrame]->draw(surf, false);
}
else {
@@ -98,7 +118,7 @@ void Animation::deleteAnimation(uint id) {
Common::List<AnimObj>::iterator it = getAnimation(id);
- for(uint i = 0; i < it->_frames.size(); ++i) {
+ for (uint i = 0; i < it->_frames.size(); ++i) {
delete it->_frames[i];
}
@@ -110,7 +130,7 @@ void Animation::deleteAll() {
Common::List<AnimObj>::iterator it;
for (it = _animObjects.begin(); it != _animObjects.end(); ++it) {
- for(uint i = 0; i < it->_frames.size(); ++i) {
+ for (uint i = 0; i < it->_frames.size(); ++i) {
delete it->_frames[i];
}
}
diff --git a/engines/draci/animation.h b/engines/draci/animation.h
index c654155a03..c69947ea28 100644
--- a/engines/draci/animation.h
+++ b/engines/draci/animation.h
@@ -38,6 +38,7 @@ struct AnimObj {
uint _id;
uint _currentFrame;
uint _z;
+ bool _playing;
Common::Array<Drawable*> _frames;
};
@@ -47,12 +48,18 @@ public:
Animation(DraciEngine *vm) : _vm(vm) {};
~Animation() { deleteAll(); }
- void addAnimation(uint id, uint z = 0);
+ void addAnimation(uint id, uint z, bool playing = false);
void addFrame(uint id, Drawable *frame);
- void addOverlay(Drawable *overlay, uint z = 0);
+ void addOverlay(Drawable *overlay, uint z);
+
+ void play(uint id);
+ void stop(uint id);
+
void deleteAnimation(uint id);
void deleteAll();
+
void drawScene(Surface *surf);
+
Common::List<AnimObj>::iterator getAnimation(uint id);
private: