From 9616ec94c9f5318505f4e3ecdf105439d973cb43 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Apr 2008 23:13:38 +0000 Subject: Fixed yet another two long standing bugs in Screen::encodeShape. svn-id: r31633 --- engines/kyra/screen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 773cd98949..6dff6a0fa4 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2242,6 +2242,8 @@ uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) { src = _animBlockPtr; memcpy(dst, src, shapeSize2); dst = newShape; + if (_vm->gameFlags().useAltShapeHeader) + dst += 2; flags = READ_LE_UINT16(dst); flags |= 2; WRITE_LE_UINT16(dst, flags); @@ -2326,7 +2328,8 @@ int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) { byte *fromBackUp = from; byte *toBackUp = to; --to; - for (int i = 0; i < (fromPtrEnd - from); ++i) { + const int checkSize = fromPtrEnd - from; + for (int i = 0; i < checkSize; ++i) { if (*from++ != *to++) break; } -- cgit v1.2.3