Fix bug when some animations were playing too fast.

svn-id: r28924
This commit is contained in:
Eugene Sandulenko 2007-09-16 11:37:14 +00:00
parent dfde70d218
commit 9778bec419
3 changed files with 15 additions and 2 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}