aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/animation.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2007-08-25 23:46:04 +0000
committerFilippos Karapetis2007-08-25 23:46:04 +0000
commit40ec12f64e95ed324003d032cbea9ca78717aa59 (patch)
tree6a48bfdbc89468c6fe8741e153e8984a1f3423ee /engines/saga/animation.cpp
parent8493c06d1dcc2ce0b7327f188a31a71a7e69316e (diff)
downloadscummvm-rg350-40ec12f64e95ed324003d032cbea9ca78717aa59.tar.gz
scummvm-rg350-40ec12f64e95ed324003d032cbea9ca78717aa59.tar.bz2
scummvm-rg350-40ec12f64e95ed324003d032cbea9ca78717aa59.zip
Added a temporary workaround for an issue with animations
svn-id: r28738
Diffstat (limited to 'engines/saga/animation.cpp')
-rw-r--r--engines/saga/animation.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 13174ba38c..b01f0b9492 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -379,7 +379,9 @@ void Anim::load(uint16 animId, const byte *animResourceData, size_t animResource
fillFrameOffsets(anim);
// Set animation data
- anim->currentFrame = 0;
+ // HACK: We set currentFrame to -1, as the first frame of the animation is never drawn otherwise
+ // (check Anim::play)
+ anim->currentFrame = -1;
anim->completed = 0;
anim->cycles = anim->maxFrame;
@@ -462,23 +464,29 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
return;
}
+ // HACK: The first frame of the animation is never shown when entering a scene
+ // For now, we initialize currentFrame to be -1 instead of 0 and we draw the
+ // first frame of the animation on the next iteration of Anim::play
+ // FIXME: find out why this occurs and remove this hack. Note that when this
+ // hack is removed, currentFrame should be initialized to 0 again in Anim::load
+ if (anim->currentFrame < 0) {
+ anim->currentFrame = 0;
+ event.type = kEvTOneshot;
+ event.code = kAnimEvent;
+ event.op = kEventFrame;
+ event.param = animId;
+ event.time = 0;
+
+ _vm->_events->queue(&event);
+ return;
+ }
+
if (anim->completed < anim->cycles) {
if (anim->currentFrame < 0)
anim->currentFrame = 0;
frame = anim->currentFrame;
- // WORKAROUND for a buggy animation in IHNM. Animation 0 in scene 67 (the mob of angry prisoners) should
- // start from frame 0, not frame 1. Frame 0 is the background of the animation (the mob of prisoners), whereas
- // the rest of the frames are their animated arms. Therefore, in order for the prisoners to appear correctly,
- // frame 0 should be displayed as the first frame, but anim->currentframe is set to 1, which means that the
- // prisoners will never be shown. In the original, the prisoners (first frame in the animation) are shown a
- // bit after the animation is started (which is wrong again, but not that apparent), whereas in ScummVM the
- // first frame is never shown. Therefore, make sure that for this animation, frame 0 is shown first
- if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 4 &&
- _vm->_scene->currentSceneNumber() == 67 && animId == 0 && anim->completed == 1)
- frame = 0;
-
// FIXME: if start > 0, then this works incorrectly
decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight());
_vm->_frameCount++;