Cleanup VQA player a bit.

svn-id: r41879
This commit is contained in:
Johannes Schickel 2009-06-25 19:55:25 +00:00
parent c3672f8433
commit b21dd2cb43
2 changed files with 22 additions and 7 deletions

View File

@ -32,12 +32,14 @@
// The jung2.vqa movie does work, but only thanks to a grotesque hack.
#include "kyra/vqa.h"
#include "common/system.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
#include "kyra/sound.h"
#include "kyra/screen.h"
#include "kyra/vqa.h"
#include "kyra/resource.h"
namespace Kyra {
@ -45,6 +47,7 @@ namespace Kyra {
VQAMovie::VQAMovie(KyraEngine_v1 *vm, OSystem *system) {
_system = system;
_vm = vm;
_screen = _vm->screen();
_opened = false;
_x = _y = _drawPage = -1;
}
@ -474,13 +477,13 @@ void VQAMovie::displayFrame(uint frameNum) {
case MKID_BE('CPL0'): // Palette
assert(size <= 3 * 256);
_file->read(_vm->screen()->getPalette(0).getData(), size);
_file->read(_screen->getPalette(0).getData(), size);
break;
case MKID_BE('CPLZ'): // Palette
inbuf = (byte *)allocBuffer(0, size);
_file->read(inbuf, size);
Screen::decodeFrame4(inbuf, _vm->screen()->getPalette(0).getData(), 768);
Screen::decodeFrame4(inbuf, _screen->getPalette(0).getData(), 768);
break;
case MKID_BE('VPT0'): // Frame data
@ -521,7 +524,7 @@ void VQAMovie::displayFrame(uint frameNum) {
// The frame has been decoded
if (_frameInfo[frameNum] & 0x80000000)
_vm->screen()->setScreenPalette(_vm->screen()->getPalette(0));
_screen->setScreenPalette(_screen->getPalette(0));
int blockPitch = _header.width / _header.blockW;
@ -561,7 +564,7 @@ void VQAMovie::displayFrame(uint frameNum) {
_partialCodeBookSize = 0;
}
_vm->screen()->copyBlockToPage(_drawPage, _x, _y, _header.width, _header.height, _frame);
_screen->copyBlockToPage(_drawPage, _x, _y, _header.width, _header.height, _frame);
}
void VQAMovie::play() {
@ -675,7 +678,7 @@ void VQAMovie::play() {
_system->delayMillis(10);
}
_vm->screen()->updateScreen();
_screen->updateScreen();
}
// TODO: Wait for the sound to finish?

View File

@ -26,13 +26,24 @@
#ifndef KYRA_VQA_H
#define KYRA_VQA_H
#include "common/stream.h"
#include "common/scummsys.h"
#include "sound/mixer.h"
class OSystem;
namespace Audio {
class AppendableAudioStream;
} // end of namespace Audio
namespace Common {
class SeekableReadStream;
} // end of namespace Common
namespace Kyra {
class KyraEngine_v1;
class Screen;
class VQAMovie {
public:
@ -57,6 +68,7 @@ public:
protected:
OSystem *_system;
KyraEngine_v1 *_vm;
Screen *_screen;
bool _opened;
int _x, _y;