aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2004-11-21 21:40:51 +0000
committerGregory Montoir2004-11-21 21:40:51 +0000
commit856b58965376da25e74ef02f89b3fc19f96d16da (patch)
tree5a23a7286e98878ca19d6318ce7e7bcc176f35a9
parentcf7f878ddc99f075a6da28eeeca2b9d55122186a (diff)
downloadscummvm-rg350-856b58965376da25e74ef02f89b3fc19f96d16da.tar.gz
scummvm-rg350-856b58965376da25e74ef02f89b3fc19f96d16da.tar.bz2
scummvm-rg350-856b58965376da25e74ef02f89b3fc19f96d16da.zip
as the comment suggested, I rearranged the 3DO strip decoding function. Please, someone owning the 3DO games, test that this doesn't cause any regressions !
svn-id: r15858
-rw-r--r--scumm/gfx.cpp61
1 files changed, 19 insertions, 42 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 2bc84f7e4e..c5a45d9a45 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -2266,62 +2266,39 @@ void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int h
void Gdi::drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const {
- int destbytes, olddestbytes2, olddestbytes1;
- byte color;
-
- uint32 dataBit, data;
-
- olddestbytes1 = 0;
-
- destbytes = height << 3;
-
- if (!height)
+ if (height == 0)
return;
- // FIXME/TODO: This is a simple RLE encoding; the code could be made
- // clearer by renaming some vars and/or rearranginge the code.
+ int decSize = height * 8;
+ int curSize = 0;
do {
- data = *src++;
+ uint8 data = *src++;
+ uint8 rle = data & 1;
+ int len = (data >> 1) + 1;
- dataBit = data & 1;
- data >>= 1;
- data++;
+ len = MIN(decSize, len);
+ decSize -= len;
- destbytes -= data;
-
- // Clip!
- if (destbytes < 0)
- data += destbytes;
-
- olddestbytes2 = destbytes;
- destbytes = olddestbytes1;
-
- if (!dataBit) {
- for (; data > 0; data--, src++, dst++) {
+ if (!rle) {
+ for (; len > 0; len--, src++, dst++) {
if (!transpCheck || *src != _transparentColor)
*dst = _roomPalette[*src];
-
- destbytes++;
- if (!(destbytes & 7))
- dst += dstPitch - 8; // Next row
+ curSize++;
+ if (!(curSize & 7))
+ dst += dstPitch - 8; // Next row
}
} else {
- color = *src;
- src++;
-
- for (; data > 0; data--, dst++) {
+ byte color = *src++;
+ for (; len > 0; len--, dst++) {
if (!transpCheck || color != _transparentColor)
*dst = _roomPalette[color];
- destbytes++;
- if (!(destbytes & 7))
- dst += dstPitch - 8; // Next row
+ curSize++;
+ if (!(curSize & 7))
+ dst += dstPitch - 8; // Next row
}
}
-
- olddestbytes1 = destbytes;
- destbytes = olddestbytes2;
- } while (olddestbytes2 > 0);
+ } while (decSize > 0);
}