aboutsummaryrefslogtreecommitdiff
path: root/engines/toon
diff options
context:
space:
mode:
authorSylvain Dupont2011-01-21 20:26:25 +0000
committerSylvain Dupont2011-01-21 20:26:25 +0000
commitd5cb146f4ce9a0378da443f4bbc20d9f02ad6568 (patch)
treea0259173450ae7fb6b9cbb13965787bc681145a0 /engines/toon
parentbbb1379def2f26663aa2006152e25f63df49328f (diff)
downloadscummvm-rg350-d5cb146f4ce9a0378da443f4bbc20d9f02ad6568.tar.gz
scummvm-rg350-d5cb146f4ce9a0378da443f4bbc20d9f02ad6568.tar.bz2
scummvm-rg350-d5cb146f4ce9a0378da443f4bbc20d9f02ad6568.zip
TOON: Fix all the glitches in smacker video playback
Handle manually 2x scaling when it is needed now. svn-id: r55393
Diffstat (limited to 'engines/toon')
-rw-r--r--engines/toon/movie.cpp26
-rw-r--r--engines/toon/movie.h4
2 files changed, 23 insertions, 7 deletions
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 34769f028a..8607f807fb 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -33,8 +33,7 @@ void ToonstruckSmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, ui
if (track == 1 && chunkSize == 4) {
/* uint16 width = */ _fileStream->readUint16LE();
uint16 height = _fileStream->readUint16LE();
-
- _header.flags = (height == getHeight() / 2) ? 4 : 0;
+ _lowRes = (height == getHeight() / 2);
} else
Graphics::SmackerDecoder::handleAudioTrack(track, chunkSize, unpackedSize);
}
@@ -44,21 +43,25 @@ bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename, int forc
if (Graphics::SmackerDecoder::loadFile(filename)) {
if (forcedflags & 0x10 || _surface->h == 200) {
-
- _header.flags = 4;
if (_surface) {
_surface->free();
delete _surface;
}
_surface = new Graphics::Surface();
_surface->create(640, 400, 1);
+ _lowRes = false;
+ _header.flags = 4;
}
+
return true;
}
+
+
return false;
}
ToonstruckSmackerDecoder::ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : Graphics::SmackerDecoder(mixer, soundType) {
+ _lowRes = false;
}
// decoder is deallocated with Movie destruction i.e. new ToonstruckSmackerDecoder is needed
@@ -98,8 +101,19 @@ bool Movie::playVideo() {
while (!_vm->shouldQuit() && !_decoder->endOfVideo()) {
if (_decoder->needsUpdate()) {
const Graphics::Surface *frame = _decoder->decodeNextFrame();
- if (frame)
- _vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ if (frame) {
+ if (_decoder->isLowRes()) {
+ // handle manually 2x scaling here
+ Graphics::Surface* surf = _vm->getSystem()->lockScreen();
+ for (int y = 0; y < frame->h/2; y++) {
+ memcpy(surf->getBasePtr(0, y*2+0), frame->getBasePtr(0, y), frame->pitch);
+ memcpy(surf->getBasePtr(0, y*2+1), frame->getBasePtr(0, y), frame->pitch);
+ }
+ _vm->getSystem()->unlockScreen();
+ } else {
+ _vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ }
+ }
_decoder->setSystemPalette();
_vm->getSystem()->updateScreen();
}
diff --git a/engines/toon/movie.h b/engines/toon/movie.h
index e89abb56c0..9abbcdf66f 100644
--- a/engines/toon/movie.h
+++ b/engines/toon/movie.h
@@ -37,6 +37,9 @@ public:
virtual ~ToonstruckSmackerDecoder() {}
void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
bool loadFile(const Common::String &filename, int forcedflags) ;
+ bool isLowRes() { return _lowRes; }
+protected:
+ bool _lowRes;
};
class Movie {
@@ -54,7 +57,6 @@ protected:
Audio::Mixer *_mixer;
ToonstruckSmackerDecoder *_decoder;
bool _playing;
-
};
} // End of namespace Toon