aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/animation_he.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/he/animation_he.cpp')
-rw-r--r--engines/scumm/he/animation_he.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp
index 2ca17161db..47b25c57d1 100644
--- a/engines/scumm/he/animation_he.cpp
+++ b/engines/scumm/he/animation_he.cpp
@@ -66,6 +66,32 @@ int MoviePlayer::load(const char *filename, int flags, int image) {
return 0;
}
+void MoviePlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
+ uint h = getHeight();
+ uint w = getWidth();
+
+ byte *src = _videoFrameBuffer;
+
+ if (_vm->_game.features & GF_16BIT_COLOR) {
+ dst += y * pitch + x * 2;
+ do {
+ for (uint i = 0; i < w; i++) {
+ uint16 col = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2);
+ WRITE_UINT16(dst + i * 2, col);
+ }
+ dst += pitch;
+ src += w;
+ } while (--h);
+ } else {
+ dst += y * pitch + x;
+ do {
+ memcpy(dst, src, w);
+ dst += pitch;
+ src += w;
+ } while (--h);
+ }
+}
+
void MoviePlayer::handleNextFrame() {
if (!isVideoLoaded()) {
return;
@@ -80,14 +106,14 @@ void MoviePlayer::handleNextFrame() {
assert(dstPtr);
uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
assert(dst);
- copyFrameToBuffer(dst, 0, 0, _vm->_screenWidth);
+ copyFrameToBuffer(dst, 0, 0, _vm->_screenWidth * _vm->_bitDepth);
} else if (_flags & 1) {
- copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, _vm->_screenWidth);
+ copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, pvs->pitch);
Common::Rect imageRect(getWidth(), getHeight());
_vm->restoreBackgroundHE(imageRect);
} else {
- copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, _vm->_screenWidth);
+ copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, pvs->pitch);
Common::Rect imageRect(getWidth(), getHeight());
_vm->markRectAsDirty(kMainVirtScreen, imageRect);