aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-03-22 01:40:24 +0000
committerMax Horn2004-03-22 01:40:24 +0000
commit838d3e3a9387d63819fd2c8b137d53041de9abdb (patch)
tree5b886711ee1735dc92b4ecb7c18a768368884bc8
parent4466a855986d08d20c6fc6296baec191e1f5e027 (diff)
downloadscummvm-rg350-838d3e3a9387d63819fd2c8b137d53041de9abdb.tar.gz
scummvm-rg350-838d3e3a9387d63819fd2c8b137d53041de9abdb.tar.bz2
scummvm-rg350-838d3e3a9387d63819fd2c8b137d53041de9abdb.zip
some more cleanup
svn-id: r13359
-rw-r--r--graphics/animation.cpp32
-rw-r--r--graphics/animation.h2
-rw-r--r--sword1/animation.cpp35
-rw-r--r--sword2/driver/animation.cpp35
4 files changed, 34 insertions, 70 deletions
diff --git a/graphics/animation.cpp b/graphics/animation.cpp
index 65aca29b00..d8219c5a55 100644
--- a/graphics/animation.cpp
+++ b/graphics/animation.cpp
@@ -48,6 +48,23 @@ BaseAnimationState::~BaseAnimationState() {
+bool BaseAnimationState::checkPaletteSwitch() {
+#ifdef BACKEND_8BIT
+ // if we have reached the last image with this palette, switch to new one
+ if (framenum == palettes[palnum].end) {
+ unsigned char *l = lut2;
+ palnum++;
+ setPalette(palettes[palnum].pal);
+ lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2);
+ lut2 = lut;
+ lut = l;
+ return true;
+ }
+#endif
+
+ return false;
+}
+
#ifdef BACKEND_8BIT
/**
@@ -100,21 +117,6 @@ void BaseAnimationState::buildLookup(int p, int lines) {
}
}
-bool BaseAnimationState::checkPaletteSwitch() {
- // if we have reached the last image with this palette, switch to new one
- if (framenum == palettes[palnum].end) {
- unsigned char *l = lut2;
- palnum++;
- setPalette(palettes[palnum].pal);
- lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2);
- lut2 = lut;
- lut = l;
- return true;
- }
-
- return false;
-}
-
#else
OverlayColor *BaseAnimationState::lookup = 0;
diff --git a/graphics/animation.h b/graphics/animation.h
index cfd96b3d78..0ddaf76e5c 100644
--- a/graphics/animation.h
+++ b/graphics/animation.h
@@ -123,9 +123,9 @@ public:
virtual ~BaseAnimationState();
protected:
+ bool checkPaletteSwitch();
#ifdef BACKEND_8BIT
void buildLookup(int p, int lines);
- bool checkPaletteSwitch();
virtual void setPalette(byte *pal) = 0;
#else
void buildLookup(void);
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index f1ea311b1c..7f571e84a2 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -122,7 +122,7 @@ bool AnimationState::init(const char *name) {
frameskipped = 0;
ticks = _sys->get_msecs();
- /* Play audio - TODO: Sync with video?*/
+ // Play audio
sndfile = new File();
bgSoundStream = AudioStream::openStreamFile(name, sndfile);
@@ -176,42 +176,19 @@ bool AnimationState::decodeFrame() {
if (bgSoundStream && !bgSound.isActive())
return false;
-#ifdef BACKEND_8BIT
if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) ||
+ frameskipped > 10) {
if (frameskipped > 10) {
warning("force frame %i redraw", framenum);
frameskipped = 0;
}
+#ifdef BACKEND_8BIT
_scr->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
-
- if (bgSoundStream) {
- while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum)
- _sys->delay_msecs(10);
- } else {
- ticks += 83;
- while (_sys->get_msecs() < ticks)
- _sys->delay_msecs(10);
- }
-
- } else {
- warning("dropped frame %i", framenum);
- frameskipped++;
- }
-
- buildLookup(palnum + 1, lutcalcnum);
-
#else
-
- 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);
-
_sys->copy_rect_overlay(overlay, MOVIE_WIDTH, 0, 40, MOVIE_WIDTH, MOVIE_HEIGHT);
+#endif
if (bgSoundStream) {
while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum)
@@ -227,6 +204,8 @@ bool AnimationState::decodeFrame() {
frameskipped++;
}
+#ifdef BACKEND_8BIT
+ buildLookup(palnum + 1, lutcalcnum);
#endif
framenum++;
diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp
index 94302dc631..302300f051 100644
--- a/sword2/driver/animation.cpp
+++ b/sword2/driver/animation.cpp
@@ -222,14 +222,18 @@ bool AnimationState::decodeFrame() {
if (bgSoundStream && !bgSound.isActive())
return false;
-#ifdef BACKEND_8BIT
if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
+ ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) ||
+ frameskipped > 10) {
if (frameskipped > 10) {
warning("force frame %i redraw", framenum);
frameskipped = 0;
}
+#ifdef BACKEND_8BIT
_vm->_graphics->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
+#else
+ plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
+#endif
if (bgSoundStream) {
while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum)
@@ -239,38 +243,17 @@ bool AnimationState::decodeFrame() {
_vm->sleepUntil(ticks);
}
+#ifdef BACKEND_8BIT
_vm->_graphics->setNeedFullRedraw();
+#endif
} else {
warning("dropped frame %i", framenum);
frameskipped++;
}
+#ifdef BACKEND_8BIT
buildLookup(palnum + 1, lutcalcnum);
-
-#else
-
- 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) {
- while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum)
- _sys->delay_msecs(10);
- } else {
- ticks += 83;
- _vm->sleepUntil(ticks);
- }
-
- } else {
- warning("dropped frame %i", framenum);
- frameskipped++;
- }
-
#endif
framenum++;