aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/vqa_decoder.cpp
diff options
context:
space:
mode:
authorPeter Kohaut2018-01-31 00:37:19 +0100
committerPeter Kohaut2018-02-04 17:34:43 +0100
commit6e9a340640686fe7dd95efbea34cbf3b7f4209af (patch)
treefe0adec0b85f3e2b387097c4378ce8337b731460 /engines/bladerunner/vqa_decoder.cpp
parent0300979bdd8d2ca451110d77cb8e05c84365bbec (diff)
downloadscummvm-rg350-6e9a340640686fe7dd95efbea34cbf3b7f4209af.tar.gz
scummvm-rg350-6e9a340640686fe7dd95efbea34cbf3b7f4209af.tar.bz2
scummvm-rg350-6e9a340640686fe7dd95efbea34cbf3b7f4209af.zip
BLADERUNNER: ESPER interface
Diffstat (limited to 'engines/bladerunner/vqa_decoder.cpp')
-rw-r--r--engines/bladerunner/vqa_decoder.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index aec4d18e5d..7dc7616fe9 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -25,6 +25,7 @@
#include "bladerunner/bladerunner.h"
#include "bladerunner/decompress_lcw.h"
#include "bladerunner/decompress_lzo.h"
+#include "bladerunner/game_info.h"
#include "bladerunner/lights.h"
#include "bladerunner/screen_effects.h"
#include "bladerunner/view.h"
@@ -116,9 +117,8 @@ const char *strTag(uint32 tag) {
return s;
}
-VQADecoder::VQADecoder(Graphics::Surface *surface) :
+VQADecoder::VQADecoder() :
_s(nullptr),
- _surface(surface),
_frameInfo(nullptr),
_videoTrack(nullptr),
_audioTrack(nullptr),
@@ -179,7 +179,7 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *s) {
}
} while (chd.id != kFINF);
- _videoTrack = new VQAVideoTrack(this, _surface);
+ _videoTrack = new VQAVideoTrack(this);
_audioTrack = new VQAAudioTrack(this);
#if BLADERUNNER_DEBUG_CONSOLE
@@ -194,9 +194,9 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *s) {
return true;
}
-void VQADecoder::decodeVideoFrame(int frame, bool forceDraw) {
+void VQADecoder::decodeVideoFrame(Graphics::Surface *surface, int frame, bool forceDraw) {
_decodingFrame = frame;
- _videoTrack->decodeVideoFrame(forceDraw);
+ _videoTrack->decodeVideoFrame(surface, forceDraw);
}
void VQADecoder::decodeZBuffer(ZBuffer *zbuffer) {
@@ -573,9 +573,8 @@ bool VQADecoder::readMFCI(Common::SeekableReadStream *s, uint32 size) {
return true;
}
-VQADecoder::VQAVideoTrack::VQAVideoTrack(VQADecoder *vqaDecoder, Graphics::Surface *surface) {
+VQADecoder::VQAVideoTrack::VQAVideoTrack(VQADecoder *vqaDecoder) {
_vqaDecoder = vqaDecoder;
- _surface = surface;
_hasNewFrame = false;
VQADecoder::Header *header = &vqaDecoder->_header;
@@ -635,9 +634,10 @@ Common::Rational VQADecoder::VQAVideoTrack::getFrameRate() const {
return _frameRate;
}
-void VQADecoder::VQAVideoTrack::decodeVideoFrame(bool forceDraw) {
+void VQADecoder::VQAVideoTrack::decodeVideoFrame(Graphics::Surface *surface, bool forceDraw) {
if (_hasNewFrame || forceDraw) {
- decodeFrame((uint16 *)_surface->getPixels());
+ assert(surface);
+ decodeFrame(surface);
_hasNewFrame = false;
}
}
@@ -807,11 +807,12 @@ bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 s
return true;
}
-void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha) {
- uint16 frame_width = _width;
- uint32 frame_stride = 640;
- uint16 block_width = _blockW;
- uint16 block_height = _blockH;
+void VQADecoder::VQAVideoTrack::VPTRWriteBlock(Graphics::Surface *surface, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha) {
+ uint16 *frame = (uint16 *)surface->getPixels();
+ uint16 frame_width = _width;
+ uint32 frame_stride = surface->w;
+ uint16 block_width = _blockW;
+ uint16 block_height = _blockH;
const uint8 *const block_src =
&_codebook[2 * srcBlock * block_width * block_height];
@@ -845,7 +846,7 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(uint16 *frame, unsigned int dstBl
} while (--count);
}
-bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) {
+bool VQADecoder::VQAVideoTrack::decodeFrame(Graphics::Surface *surface) {
CodebookInfo &codebookInfo = _vqaDecoder->codebookInfoForFrame(_vqaDecoder->_decodingFrame);
if (!codebookInfo.data) {
@@ -876,19 +877,19 @@ bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) {
count = 2 * (((command >> 8) & 0x1f) + 1);
srcBlock = command & 0x00ff;
- VPTRWriteBlock(frame, dstBlock, srcBlock, count);
+ VPTRWriteBlock(surface, dstBlock, srcBlock, count);
dstBlock += count;
break;
case 2:
count = 2 * (((command >> 8) & 0x1f) + 1);
srcBlock = command & 0x00ff;
- VPTRWriteBlock(frame, dstBlock, srcBlock, 1);
+ VPTRWriteBlock(surface, dstBlock, srcBlock, 1);
++dstBlock;
for (int i = 0; i < count; ++i) {
srcBlock = *src++;
- VPTRWriteBlock(frame, dstBlock, srcBlock, 1);
+ VPTRWriteBlock(surface, dstBlock, srcBlock, 1);
++dstBlock;
}
break;
@@ -897,7 +898,7 @@ bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) {
count = 1;
srcBlock = command & 0x1fff;
- VPTRWriteBlock(frame, dstBlock, srcBlock, count, prefix == 4);
+ VPTRWriteBlock(surface, dstBlock, srcBlock, count, prefix == 4);
++dstBlock;
break;
case 5:
@@ -905,7 +906,7 @@ bool VQADecoder::VQAVideoTrack::decodeFrame(uint16 *frame) {
count = *src++;
srcBlock = command & 0x1fff;
- VPTRWriteBlock(frame, dstBlock, srcBlock, count, prefix == 6);
+ VPTRWriteBlock(surface, dstBlock, srcBlock, count, prefix == 6);
dstBlock += count;
break;
default: