aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/vqa.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2014-01-18 03:18:40 +0100
committerJohannes Schickel2014-01-18 03:18:40 +0100
commit238aa2be2aeefda17cb5c2023f89e3934bed8424 (patch)
tree475fdf913d207ed16cebd168da2f7762e3ecc0d2 /engines/kyra/vqa.cpp
parent19cb3499f587630f2429c3e99b4fcadf491836cb (diff)
downloadscummvm-rg350-238aa2be2aeefda17cb5c2023f89e3934bed8424.tar.gz
scummvm-rg350-238aa2be2aeefda17cb5c2023f89e3934bed8424.tar.bz2
scummvm-rg350-238aa2be2aeefda17cb5c2023f89e3934bed8424.zip
KYRA: Let the VQA decoder draw directly to the backend
As an alternative to using the Screen class's functions, we can let the VQA decoder draw directly to the backend. This won't work if the game uses "hi-res mode", but I don't think that's ever the case for Malcolm's Revenge. I believe the KyraEngine_MR::playVQA() function ensures that the screen is properly updated after the movie has finished. This almost limits the VQA rewrite to vqa.cpp and vqa.h. Whether it's better this way than changing the Screen functions to take a 'pitch' parameter...? I don't know. But it's an alternative.
Diffstat (limited to 'engines/kyra/vqa.cpp')
-rw-r--r--engines/kyra/vqa.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 76e5c7285a..975a763715 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -38,6 +38,7 @@
#include "common/system.h"
#include "common/events.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
namespace Kyra {
@@ -594,7 +595,6 @@ VQAMovie::VQAMovie(KyraEngine_v1 *vm, OSystem *system) {
_vm = vm;
_screen = _vm->screen();
_decoder = new VQADecoder();
- _drawPage = -1;
}
VQAMovie::~VQAMovie() {
@@ -602,10 +602,6 @@ VQAMovie::~VQAMovie() {
delete _decoder;
}
-void VQAMovie::setDrawPage(int page) {
- _drawPage = page;
-}
-
bool VQAMovie::open(const char *filename) {
if (_file.open(filename)) {
return true;
@@ -652,14 +648,18 @@ void VQAMovie::play() {
if (_decoder->needsUpdate()) {
const Graphics::Surface *surface = _decoder->decodeNextFrame();
if (_decoder->hasDirtyPalette()) {
- memcpy(_screen->getPalette(0).getData(), _decoder->getPalette(), 3 * 256);
- _screen->setScreenPalette(_screen->getPalette(0));
+ const byte *decoderPalette = _decoder->getPalette();
+ byte systemPalette[256 * 3];
+ for (int i = 0; i < ARRAYSIZE(systemPalette); i++) {
+ systemPalette[i] = (decoderPalette[i] * 0xFF) / 0x3F;
+ }
+ _system->getPaletteManager()->setPalette(systemPalette, 0, 256);
}
- _screen->copyBlockToPage(_drawPage, surface->pitch, x, y, width, height, (const byte *)surface->getBasePtr(0, 0));
+ _system->copyRectToScreen((const byte *)surface->getBasePtr(0, 0), surface->pitch, x, y, width, height);
}
- _screen->updateScreen();
+ _system->updateScreen();
_system->delayMillis(10);
}
}