aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2016-10-10 04:42:06 +0300
committerFilippos Karapetis2016-10-10 04:42:06 +0300
commit684cbfa2fdee6d2927409670a22ecc571ef31a02 (patch)
tree78cdb5680c715ffced1d119080e7b5de6c3dabea
parenta292fcdd93bb41b11ac1a22849b44150362795ab (diff)
downloadscummvm-rg350-684cbfa2fdee6d2927409670a22ecc571ef31a02.tar.gz
scummvm-rg350-684cbfa2fdee6d2927409670a22ecc571ef31a02.tar.bz2
scummvm-rg350-684cbfa2fdee6d2927409670a22ecc571ef31a02.zip
CHEWY: Add support for palette fadeout to videos
-rw-r--r--engines/chewy/graphics.cpp3
-rw-r--r--engines/chewy/video/cfo_decoder.cpp26
-rw-r--r--engines/chewy/video/cfo_decoder.h1
3 files changed, 25 insertions, 5 deletions
diff --git a/engines/chewy/graphics.cpp b/engines/chewy/graphics.cpp
index 5db2a76398..0861a344ab 100644
--- a/engines/chewy/graphics.cpp
+++ b/engines/chewy/graphics.cpp
@@ -128,7 +128,9 @@ void Graphics::playVideo(uint num) {
uint16 x = (g_system->getWidth() - cfoDecoder->getWidth()) / 2;
uint16 y = (g_system->getHeight() - cfoDecoder->getHeight()) / 2;
bool skipVideo = false;
+ byte curPalette[256 * 3];
+ g_system->getPaletteManager()->grabPalette(curPalette, 0, 256);
hideCursor();
cfoDecoder->start();
@@ -157,6 +159,7 @@ void Graphics::playVideo(uint num) {
cfoDecoder->close();
+ g_system->getPaletteManager()->setPalette(curPalette, 0, 256);
showCursor();
}
diff --git a/engines/chewy/video/cfo_decoder.cpp b/engines/chewy/video/cfo_decoder.cpp
index 30f48d27cd..0d8fcd7083 100644
--- a/engines/chewy/video/cfo_decoder.cpp
+++ b/engines/chewy/video/cfo_decoder.cpp
@@ -23,6 +23,7 @@
#include "common/events.h"
#include "common/system.h"
#include "engines/engine.h"
+#include "graphics/palette.h"
#include "video/flic_decoder.h"
#include "chewy/sound.h"
@@ -175,7 +176,7 @@ void CfoDecoder::CfoVideoTrack::handleFrame() {
void CfoDecoder::CfoVideoTrack::handleCustomFrame() {
uint16 chunkCount = _fileStream->readUint16LE();
- uint16 delay, number, channel, volume, repeat, balance;
+ uint16 number, channel, volume, repeat, balance;
// Read subchunks
for (uint32 i = 0; i < chunkCount; ++i) {
@@ -188,10 +189,8 @@ void CfoDecoder::CfoVideoTrack::handleCustomFrame() {
break;
case kChunkFadeOut:
// Used in video 0
- delay = _fileStream->readUint16LE();
-
- warning("kChunkFadeOut, delay %d", delay);
- // TODO
+ _fileStream->skip(2); // delay, unused
+ fadeOut();
break;
case kChunkLoadMusic:
// Used in videos 0, 18, 34, 71
@@ -300,4 +299,21 @@ void CfoDecoder::CfoVideoTrack::handleCustomFrame() {
}
}
+void CfoDecoder::CfoVideoTrack::fadeOut() {
+ for (int j = 0; j < 64; j++) {
+ for (int i = 0; i < 256; i++) {
+ if (_palette[i * 3 + 0] > 0)
+ --_palette[i * 3 + 0];
+ if (_palette[i * 3 + 1] > 0)
+ --_palette[i * 3 + 1];
+ if (_palette[i * 3 + 2] > 0)
+ --_palette[i * 3 + 2];
+ }
+
+ g_system->getPaletteManager()->setPalette(_palette, 0, 256);
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+}
+
} // End of namespace Chewy
diff --git a/engines/chewy/video/cfo_decoder.h b/engines/chewy/video/cfo_decoder.h
index 26b97ec4ff..1495821674 100644
--- a/engines/chewy/video/cfo_decoder.h
+++ b/engines/chewy/video/cfo_decoder.h
@@ -58,6 +58,7 @@ private:
private:
void handleFrame();
void handleCustomFrame();
+ void fadeOut();
Sound *_sound;