aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bacca2004-03-04 18:54:35 +0000
committerNicolas Bacca2004-03-04 18:54:35 +0000
commit9e1fa63575347e109cb713275b4d733f27a0fe6e (patch)
treef50c09b5da6b75c47a9e80c73675d27c7bcf3b86
parentece97788ac5c06ceef8c1954b9a21f42eac6b1ec (diff)
downloadscummvm-rg350-9e1fa63575347e109cb713275b4d733f27a0fe6e.tar.gz
scummvm-rg350-9e1fa63575347e109cb713275b4d733f27a0fe6e.tar.bz2
scummvm-rg350-9e1fa63575347e109cb713275b4d733f27a0fe6e.zip
Apply patch #907359 : Broken Sword videos improved frameskip
svn-id: r13180
-rw-r--r--sword1/animation.cpp21
-rw-r--r--sword1/animation.h1
-rw-r--r--sword2/driver/animation.cpp23
-rw-r--r--sword2/driver/animation.h1
4 files changed, 36 insertions, 10 deletions
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index a1cfccf725..3dc114d503 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -134,6 +134,7 @@ bool AnimationState::init(const char *name) {
info = mpeg2_info(decoder);
framenum = 0;
+ frameskipped = 0;
ticks = _sys->get_msecs();
/* Play audio - TODO: Sync with video?*/
@@ -313,7 +314,11 @@ bool AnimationState::decodeFrame() {
#ifdef BACKEND_8BIT
if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
+ ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ if (frameskipped > 10) {
+ warning("force frame %i redraw", framenum);
+ frameskipped = 0;
+ }
_scr->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
if (bgSoundStream) {
@@ -325,14 +330,20 @@ bool AnimationState::decodeFrame() {
_sys->delay_msecs(10);
}
- } else
+ } else {
warning("dropped frame %i", framenum);
+ frameskipped++;
+ }
buildLookup(palnum + 1, lutcalcnum);
#else
- if ((bgSoundStream == NULL) || ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
+ if ((bgSoundStream == NULL) || ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ if (frameskipped > 10) {
+ warning("force frame %i redraw", framenum);
+ frameskipped = 0;
+ }
plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
if (bgSoundStream) {
@@ -344,8 +355,10 @@ bool AnimationState::decodeFrame() {
_sys->delay_msecs(10);
}
- } else
+ } else {
warning("dropped frame %i", framenum);
+ frameskipped++;
+ }
#endif
diff --git a/sword1/animation.h b/sword1/animation.h
index 29f4f41bce..58b1be61ee 100644
--- a/sword1/animation.h
+++ b/sword1/animation.h
@@ -77,6 +77,7 @@ private:
OSystem *_sys;
uint framenum;
+ uint frameskipped;
uint32 ticks;
#ifdef USE_MPEG2
diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp
index 14accf6604..211c6b5fdb 100644
--- a/sword2/driver/animation.cpp
+++ b/sword2/driver/animation.cpp
@@ -142,6 +142,7 @@ bool AnimationState::init(const char *name) {
info = mpeg2_info(decoder);
framenum = 0;
+ frameskipped = 0;
ticks = _vm->_system->get_msecs();
// Play audio
@@ -358,8 +359,11 @@ bool AnimationState::decodeFrame() {
#ifdef BACKEND_8BIT
if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
-
+ ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ if (frameskipped > 10) {
+ warning("force frame %i redraw", framenum);
+ frameskipped = 0;
+ }
_vm->_graphics->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
if (bgSoundStream) {
@@ -372,16 +376,21 @@ bool AnimationState::decodeFrame() {
_vm->_graphics->setNeedFullRedraw();
- } else
+ } else {
warning("dropped frame %i", framenum);
+ frameskipped++;
+ }
buildLookup(palnum + 1, lutcalcnum);
#else
if ((bgSoundStream == NULL) ||
- ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
-
+ ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ if (frameskipped > 10) {
+ warning("force frame %i redraw", framenum);
+ frameskipped = 0;
+ }
plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
if (bgSoundStream) {
@@ -392,8 +401,10 @@ bool AnimationState::decodeFrame() {
_vm->sleepUntil(ticks);
}
- } else
+ } else {
warning("dropped frame %i", framenum);
+ frameskipped++;
+ }
#endif
diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h
index 28399d06d4..84e7d70637 100644
--- a/sword2/driver/animation.h
+++ b/sword2/driver/animation.h
@@ -71,6 +71,7 @@ private:
Sword2Engine *_vm;
uint framenum;
+ uint frameskipped;
int ticks;
#ifdef USE_MPEG2