aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2007-09-16 11:37:14 +0000
committerEugene Sandulenko2007-09-16 11:37:14 +0000
commit9778bec4192b8fd557fb8fbd14017645d2a9c701 (patch)
tree7346572ca11d31a459483f77efcac0bfa8f4c0e4
parentdfde70d218302016bb050d2dde97d0c3643adb4f (diff)
downloadscummvm-rg350-9778bec4192b8fd557fb8fbd14017645d2a9c701.tar.gz
scummvm-rg350-9778bec4192b8fd557fb8fbd14017645d2a9c701.tar.bz2
scummvm-rg350-9778bec4192b8fd557fb8fbd14017645d2a9c701.zip
Fix bug when some animations were playing too fast.
svn-id: r28924
-rw-r--r--engines/saga/animation.cpp8
-rw-r--r--engines/saga/animation.h1
-rw-r--r--engines/saga/sfuncs.cpp8
3 files changed, 15 insertions, 2 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 99d1ee2a2a..09b2ba412d 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -668,6 +668,14 @@ int Anim::getFrameTime(uint16 animId) {
return anim->frameTime;
}
+bool Anim::isPlaying(uint16 animId) {
+ AnimationData *anim;
+
+ anim = getAnimation(animId);
+
+ return (anim->state == ANIM_PLAYING);
+}
+
int16 Anim::getCurrentFrame(uint16 animId) {
AnimationData *anim;
diff --git a/engines/saga/animation.h b/engines/saga/animation.h
index 22fc2d36c0..4306d8e00d 100644
--- a/engines/saga/animation.h
+++ b/engines/saga/animation.h
@@ -143,6 +143,7 @@ public:
int16 getCurrentFrame(uint16 animId);
int getFrameTime(uint16 animId);
int getCycles(uint16 animId);
+ bool isPlaying(uint16 animId);
bool hasAnimation(uint16 animId) {
if (animId >= MAX_ANIMATIONS) {
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 4f37cda51b..aa581db6ee 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -452,7 +452,9 @@ void Script::sfStartBgdAnim(SCRIPTFUNC_PARAMS) {
_vm->_anim->setCycles(animId, cycles);
_vm->_anim->setFrameTime(animId, _vm->ticksToMSec(kRepeatSpeedTicks));
- _vm->_anim->play(animId, 0);
+
+ if (!_vm->_anim->isPlaying(animId))
+ _vm->_anim->play(animId, 0);
debug(1, "sfStartBgdAnim(%d, %d)", animId, cycles);
}
@@ -699,7 +701,9 @@ void Script::sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
_vm->_anim->setCycles(animId, cycles);
_vm->_anim->setFrameTime(animId, _vm->ticksToMSec(speed));
- _vm->_anim->play(animId, 0);
+
+ if (!_vm->_anim->isPlaying(animId))
+ _vm->_anim->play(animId, 0);
debug(1, "sfStartBgdAnimSpeed(%d, %d, %d)", animId, cycles, speed);
}