From b93b50809a302c994f36bea82a4178e5e9ca61dc Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 30 Mar 2005 14:12:57 +0000 Subject: Correct return values were lost in last commit. Also revert cleanup from scumm/akos.cpp revision 1.185. Clipping isn't compatible, due to possible negative values. svn-id: r17294 --- scumm/akos.cpp | 30 ++++++++++++++++++++++++++---- scumm/wiz_he.cpp | 7 ++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 920141d4af..dc33dec3b4 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -1219,15 +1219,37 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { dst.left = _actorX + xmoveCur; } + src.top = src.left = 0; + src.right = _width; + src.bottom = _height; + dst.top = _actorY + ymoveCur; dst.right = dst.left + _width; dst.bottom = dst.top + _height; - dst.clip(_clipOverride); - src = dst; - src.moveTo(0, 0); + int diff; + diff = dst.left - _clipOverride.left; + if (diff < 0) { + src.left -= diff; + dst.left -= diff; + } + diff = dst.right - _clipOverride.right; + if (diff > 0) { + src.right -= diff; + dst.right -= diff; + } + diff = dst.top - _clipOverride.top; + if (diff < 0) { + src.top -= diff; + dst.top -= diff; + } + diff = dst.bottom - _clipOverride.bottom; + if (diff > 0) { + src.bottom -= diff; + dst.bottom -= diff; + } - markRectAsDirty(dst); + _vm->markRectAsDirty(kMainVirtScreen, dst); if (_draw_top > dst.top) _draw_top = dst.top; diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index 77240387ba..625fae3655 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -231,8 +231,6 @@ void Wiz::copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int } static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h, const Common::Rect *rect, Common::Rect &srcRect, Common::Rect &dstRect) { - srcRect = Common::Rect(0, 0, src_w, src_h); - dstRect = Common::Rect(src_x, src_y, src_x + src_w, src_y + src_h); Common::Rect r3; int diff; @@ -268,7 +266,7 @@ static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, dstRect.bottom -= diff; } - return true; + return srcRect.isValidRect() && dstRect.isValidRect(); } void Wiz::copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect) { @@ -325,6 +323,9 @@ void Wiz::copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int } void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect, const uint8 *imagePal) { + printf("SRC left %d right %d top %d bottom %d\n", srcRect.left, srcRect.right, srcRect.top, srcRect.bottom); + printf("DST left %d right %d top %d bottom %d\n", dstRect.left, dstRect.right, dstRect.top, dstRect.bottom); + const uint8 *dataPtr, *dataPtrNext; uint8 *dstPtr, *dstPtrNext; uint32 code; -- cgit v1.2.3