From bed502a7c70c122a097d8f9ad7ca2330e69bdccb Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 22 Aug 2009 09:39:55 +0000 Subject: Fix endian issue in copyFrameToBuffer(). svn-id: r43633 --- engines/scumm/he/animation_he.cpp | 21 +++++++++++++++------ engines/scumm/he/animation_he.h | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 47b25c57d1..cf071fc4aa 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -66,7 +66,7 @@ int MoviePlayer::load(const char *filename, int flags, int image) { return 0; } -void MoviePlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { +void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch) { uint h = getHeight(); uint w = getWidth(); @@ -76,8 +76,17 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { 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); + uint16 color = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2); + switch (dstType) { + case kDstScreen: + WRITE_UINT16(dst + i * 2, color); + break; + case kDstResource: + WRITE_LE_UINT16(dst + i * 2, color); + break; + default: + error("copyFrameToBuffer: Unknown dstType %d", dstType); + } } dst += pitch; src += w; @@ -106,14 +115,14 @@ void MoviePlayer::handleNextFrame() { assert(dstPtr); uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0); assert(dst); - copyFrameToBuffer(dst, 0, 0, _vm->_screenWidth * _vm->_bitDepth); + copyFrameToBuffer(dst, kDstResource, 0, 0, _vm->_screenWidth * _vm->_bitDepth); } else if (_flags & 1) { - copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, pvs->pitch); + copyFrameToBuffer(pvs->getBackPixels(0, 0), kDstScreen, 0, 0, pvs->pitch); Common::Rect imageRect(getWidth(), getHeight()); _vm->restoreBackgroundHE(imageRect); } else { - copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, pvs->pitch); + copyFrameToBuffer(pvs->getPixels(0, 0), kDstScreen, 0, 0, pvs->pitch); Common::Rect imageRect(getWidth(), getHeight()); _vm->markRectAsDirty(kMainVirtScreen, imageRect); diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h index 0adba35d53..86ded31940 100644 --- a/engines/scumm/he/animation_he.h +++ b/engines/scumm/he/animation_he.h @@ -54,7 +54,7 @@ public: int getImageNum(); int load(const char *filename, int flags, int image = 0); - void copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch); + void copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch); void handleNextFrame(); protected: -- cgit v1.2.3