aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-20 11:52:08 +0000
committerJohannes Schickel2008-04-20 11:52:08 +0000
commit01bbe8cb6c44d5e735fb893d9e783b5a2f7055ec (patch)
tree1c344e552c618f4818e0a5b8c10bf656dfe359d2 /engines/kyra/screen.cpp
parent8a881ea45464eb63e646b0c74edeb2bbb4c55e3d (diff)
downloadscummvm-rg350-01bbe8cb6c44d5e735fb893d9e783b5a2f7055ec.tar.gz
scummvm-rg350-01bbe8cb6c44d5e735fb893d9e783b5a2f7055ec.tar.bz2
scummvm-rg350-01bbe8cb6c44d5e735fb893d9e783b5a2f7055ec.zip
Fixed long standing bug in encodeShape.
svn-id: r31593
Diffstat (limited to 'engines/kyra/screen.cpp')
-rw-r--r--engines/kyra/screen.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 1857c2cdb7..773cd98949 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -2300,7 +2300,7 @@ int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) {
to = curToPtr;
*to++ = 0xFE;
WRITE_LE_UINT16(to, diffSize); to += 2;
- *to++ = (size >> 8) & 0xFF;
+ *to++ = curPixel;
curToPtr = to;
to = toBackUp;
continue;
@@ -2319,9 +2319,9 @@ int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) {
if (*to++ == curPixel)
break;
}
- if (*to == curPixel) {
- if (*(from+size-1) == *(to+size-2))
- break;
+ if (*(to-1) == curPixel) {
+ if (*(from+size-1) != *(to+size-2))
+ continue;
byte *fromBackUp = from;
byte *toBackUp = to;
@@ -2355,7 +2355,7 @@ int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) {
uint16 word = 0;
if (size <= 0x0A) {
uint16 diffSize = from - tempPtr;
- if (size <= 0x0FFF) {
+ if (diffSize <= 0x0FFF) {
byte highByte = ((diffSize & 0xFF00) >> 8) + (((size & 0xFF) - 3) << 4);
word = ((diffSize & 0xFF) << 8) | highByte;
WRITE_LE_UINT16(to, word); to += 2;