aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/gfx.cpp
diff options
context:
space:
mode:
authorTravis Howell2009-06-04 01:05:47 +0000
committerTravis Howell2009-06-04 01:05:47 +0000
commit3a64d35dfd9126d7912c4d4496030f7ed120d660 (patch)
treed31b135a189e23fbebe806d77b9c5675ba2ed244 /engines/scumm/gfx.cpp
parent8447a3650e7de2fc780c1c354f70bf0d119622b3 (diff)
downloadscummvm-rg350-3a64d35dfd9126d7912c4d4496030f7ed120d660.tar.gz
scummvm-rg350-3a64d35dfd9126d7912c4d4496030f7ed120d660.tar.bz2
scummvm-rg350-3a64d35dfd9126d7912c4d4496030f7ed120d660.zip
Add 16bit color support for later HE games.
svn-id: r41153
Diffstat (limited to 'engines/scumm/gfx.cpp')
-rw-r--r--engines/scumm/gfx.cpp245
1 files changed, 150 insertions, 95 deletions
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 62e18561d3..a141d51735 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -43,12 +43,12 @@ extern "C" void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height
namespace Scumm {
-static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h);
-static void fill(byte *dst, int dstPitch, byte color, int w, int h);
+static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h, uint8 bitDepth);
+static void fill(byte *dst, int dstPitch, uint16 color, int w, int h, uint8 bitDepth);
#ifndef USE_ARM_GFX_ASM
-static void copy8Col(byte *dst, int dstPitch, const byte *src, int height);
+static void copy8Col(byte *dst, int dstPitch, const byte *src, int height, uint8 bitDepth);
#endif
-static void clear8Col(byte *dst, int dstPitch, int height);
+static void clear8Col(byte *dst, int dstPitch, int height, uint8 bitDepth);
static void ditherHerc(byte *src, byte *hercbuf, int srcPitch, int *x, int *y, int *width, int *height);
static void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h);
@@ -341,8 +341,8 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int
vs->hasTwoBuffers = twobufs;
vs->xstart = 0;
vs->backBuf = NULL;
- vs->bytesPerPixel = 1;
- vs->pitch = width;
+ vs->bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
+ vs->pitch = width * vs->bytesPerPixel;
if (_game.version >= 7) {
// Increase the pitch by one; needed to accomodate the extra screen
@@ -586,7 +586,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
vsPitch = _screenWidth * m - width * m;
} else {
- vsPitch = vs->pitch - width;
+ vsPitch = vs->pitch - width * vs->bytesPerPixel;
}
@@ -612,36 +612,49 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
#else
// We blit four pixels at a time, for improved performance.
const uint32 *src32 = (const uint32 *)src;
- const uint32 *text32 = (const uint32 *)text;
uint32 *dst32 = (uint32 *)_compositeBuf;
vsPitch >>= 2;
- const int textPitch = (_textSurface.pitch - width * m) >> 2;
- for (int h = height * m; h > 0; --h) {
- for (int w = width*m; w > 0; w-=4) {
- uint32 temp = *text32++;
-
- // Generate a byte mask for those text pixels (bytes) with
- // value CHARSET_MASK_TRANSPARENCY. In the end, each byte
- // in mask will be either equal to 0x00 or 0xFF.
- // Doing it this way avoids branches and bytewise operations,
- // at the cost of readability ;).
- uint32 mask = temp ^ CHARSET_MASK_TRANSPARENCY_32;
- mask = (((mask & 0x7f7f7f7f) + 0x7f7f7f7f) | mask) & 0x80808080;
- mask = ((mask >> 7) + 0x7f7f7f7f) ^ 0x80808080;
-
- // The following line is equivalent to this code:
- // *dst32++ = (*src32++ & mask) | (temp & ~mask);
- // However, some compilers can generate somewhat better
- // machine code for this equivalent statement:
- *dst32++ = ((temp ^ *src32++) & mask) ^ temp;
+
+ if (_bitDepth == 2) {
+ // Sprites always seem to be used for subtitles in 16Bit color HE games, and not
+ // the charset renderer, so charset masking isn't required.
+ for (int h = height * m; h > 0; --h) {
+ for (int w = width * m; w > 0; w -= 4) {
+ *dst32++ = *src32++;
+ *dst32++ = *src32++;
+ }
+ src32 += vsPitch;
+ }
+ } else {
+ const uint32 *text32 = (const uint32 *)text;
+ const int textPitch = (_textSurface.pitch - width * m) >> 2;
+ for (int h = height * m; h > 0; --h) {
+ for (int w = width * m; w > 0; w -= 4) {
+ uint32 temp = *text32++;
+
+ // Generate a byte mask for those text pixels (bytes) with
+ // value CHARSET_MASK_TRANSPARENCY. In the end, each byte
+ // in mask will be either equal to 0x00 or 0xFF.
+ // Doing it this way avoids branches and bytewise operations,
+ // at the cost of readability ;).
+ uint32 mask = temp ^ CHARSET_MASK_TRANSPARENCY_32;
+ mask = (((mask & 0x7f7f7f7f) + 0x7f7f7f7f) | mask) & 0x80808080;
+ mask = ((mask >> 7) + 0x7f7f7f7f) ^ 0x80808080;
+
+ // The following line is equivalent to this code:
+ // *dst32++ = (*src32++ & mask) | (temp & ~mask);
+ // However, some compilers can generate somewhat better
+ // machine code for this equivalent statement:
+ *dst32++ = ((temp ^ *src32++) & mask) ^ temp;
+ }
+ src32 += vsPitch;
+ text32 += textPitch;
}
- src32 += vsPitch;
- text32 += textPitch;
}
#endif
src = _compositeBuf;
- pitch = width;
+ pitch = width * vs->bytesPerPixel;
if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
ditherHerc(_compositeBuf, _herculesBuf, width, &x, &y, &width, &height);
@@ -976,13 +989,13 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) {
return;
if (vs->hasTwoBuffers && _currentRoom != 0 && isLightOn()) {
- blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height);
+ blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height, vs->bytesPerPixel);
if (vs->number == kMainVirtScreen && _charset->_hasMask) {
byte *mask = (byte *)_textSurface.getBasePtr(rect.left, rect.top - _screenTop);
- fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width, height);
+ fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width, height, _textSurface.bytesPerPixel);
}
} else {
- fill(screenBuf, vs->pitch, backColor, width, height);
+ fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel);
}
}
@@ -1011,7 +1024,7 @@ void ScummEngine::restoreCharsetBg() {
if (vs->number != kMainVirtScreen) {
// Restore from back buffer
const byte *backBuf = vs->getBackPixels(0, 0);
- blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h);
+ blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h, vs->bytesPerPixel);
}
} else {
// Clear area
@@ -1047,34 +1060,42 @@ byte *Gdi::getMaskBuffer(int x, int y, int z) {
#pragma mark --- Misc ---
#pragma mark -
-static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h) {
+static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h, uint8 bitDepth) {
assert(w > 0);
assert(h > 0);
assert(src != NULL);
assert(dst != NULL);
- if (w == srcPitch && w == dstPitch) {
- memcpy(dst, src, w*h);
+ if ((w * bitDepth == srcPitch) && (w * bitDepth == dstPitch)) {
+ memcpy(dst, src, w * h * bitDepth);
} else {
do {
- memcpy(dst, src, w);
+ memcpy(dst, src, w * bitDepth);
dst += dstPitch;
src += srcPitch;
} while (--h);
}
}
-static void fill(byte *dst, int dstPitch, byte color, int w, int h) {
+static void fill(byte *dst, int dstPitch, uint16 color, int w, int h, uint8 bitDepth) {
assert(h > 0);
assert(dst != NULL);
- if (w == dstPitch) {
- memset(dst, color, w*h);
- } else {
+ if (bitDepth == 2) {
do {
- memset(dst, color, w);
+ for (int i = 0; i < w; i++)
+ WRITE_UINT16(dst + i * 2, color);
dst += dstPitch;
} while (--h);
+ } else {
+ if (w == dstPitch) {
+ memset(dst, color, w * h);
+ } else {
+ do {
+ memset(dst, color, w);
+ dst += dstPitch;
+ } while (--h);
+ }
}
}
@@ -1084,14 +1105,18 @@ static void fill(byte *dst, int dstPitch, byte color, int w, int h) {
#else
-static void copy8Col(byte *dst, int dstPitch, const byte *src, int height) {
+static void copy8Col(byte *dst, int dstPitch, const byte *src, int height, uint8 bitDepth) {
do {
#if defined(SCUMM_NEED_ALIGNMENT)
- memcpy(dst, src, 8);
+ memcpy(dst, src, 8 * bitDepth);
#else
((uint32 *)dst)[0] = ((const uint32 *)src)[0];
((uint32 *)dst)[1] = ((const uint32 *)src)[1];
+ if (bitDepth == 2) {
+ ((uint32 *)dst)[2] = ((const uint32 *)src)[2];
+ ((uint32 *)dst)[3] = ((const uint32 *)src)[3];
+ }
#endif
dst += dstPitch;
src += dstPitch;
@@ -1100,13 +1125,17 @@ static void copy8Col(byte *dst, int dstPitch, const byte *src, int height) {
#endif /* USE_ARM_GFX_ASM */
-static void clear8Col(byte *dst, int dstPitch, int height) {
+static void clear8Col(byte *dst, int dstPitch, int height, uint8 bitDepth) {
do {
#if defined(SCUMM_NEED_ALIGNMENT)
- memset(dst, 0, 8);
+ memset(dst, 0, 8 * bitDepth);
#else
((uint32 *)dst)[0] = 0;
((uint32 *)dst)[1] = 0;
+ if (bitDepth == 2) {
+ ((uint32 *)dst)[2] = 0;
+ ((uint32 *)dst)[3] = 0;
+ }
#endif
dst += dstPitch;
} while (--height);
@@ -1171,41 +1200,41 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) {
if (color == -1) {
if (vs->number != kMainVirtScreen)
error("can only copy bg to main window");
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
if (_charset->_hasMask) {
byte *mask = (byte *)_textSurface.getBasePtr(x * _textSurfaceMultiplier, (y - _screenTop) * _textSurfaceMultiplier);
- fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier);
+ fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
}
} else if (_game.heversion >= 72) {
// Flags are used for different methods in HE games
uint32 flags = color;
if ((flags & 0x2000) || (flags & 0x4000000)) {
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
} else if ((flags & 0x4000) || (flags & 0x2000000)) {
- blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height);
+ blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel);
} else if ((flags & 0x8000) || (flags & 0x1000000)) {
flags &= (flags & 0x1000000) ? 0xFFFFFF : 0x7FFF;
- fill(backbuff, vs->pitch, flags, width, height);
- fill(bgbuff, vs->pitch, flags, width, height);
+ fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
} else {
- fill(backbuff, vs->pitch, flags, width, height);
+ fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
}
} else if (_game.heversion >= 60) {
// Flags are used for different methods in HE games
uint16 flags = color;
if (flags & 0x2000) {
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
} else if (flags & 0x4000) {
- blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height);
+ blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel);
} else if (flags & 0x8000) {
flags &= 0x7FFF;
- fill(backbuff, vs->pitch, flags, width, height);
- fill(bgbuff, vs->pitch, flags, width, height);
+ fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
} else {
- fill(backbuff, vs->pitch, flags, width, height);
+ fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
}
} else {
- fill(backbuff, vs->pitch, color, width, height);
+ fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel);
}
}
@@ -1243,7 +1272,7 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
if (_flashlight.buffer) {
- fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h);
+ fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h, vs->bytesPerPixel);
}
_flashlight.isDrawn = false;
}
@@ -1290,7 +1319,7 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.buffer = vs->getPixels(_flashlight.x, _flashlight.y);
bgbak = vs->getBackPixels(_flashlight.x, _flashlight.y);
- blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h);
+ blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->bytesPerPixel);
// Round the corners. To do so, we simply hard-code a set of nicely
// rounded corners.
@@ -1599,7 +1628,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", y + height, vs->h);
}
- _vertStripNextInc = height * vs->pitch - 1;
+ _vertStripNextInc = height * vs->pitch - 1 * vs->bytesPerPixel;
_objectMode = (flag & dbObjectMode) == dbObjectMode;
prepareDrawBitmap(ptr, vs, x, y, width, height, stripnr, numstrip);
@@ -1632,9 +1661,9 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
// In the case of a double buffered virtual screen, we draw to
// the backbuffer, otherwise to the primary surface memory.
if (vs->hasTwoBuffers)
- dstPtr = vs->backBuf + y * vs->pitch + x * 8;
+ dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
else
- dstPtr = (byte *)vs->pixels + y * vs->pitch + x * 8;
+ dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr);
@@ -1643,11 +1672,11 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
transpStrip = true;
if (vs->hasTwoBuffers) {
- byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + x * 8;
+ byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
if (lightsOn)
- copy8Col(frontBuf, vs->pitch, dstPtr, height);
+ copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->bytesPerPixel);
else
- clear8Col(frontBuf, vs->pitch, height);
+ clear8Col(frontBuf, vs->pitch, height, vs->bytesPerPixel);
}
decodeMask(x, y, width, height, stripnr, numzbuf, zplane_list, transpStrip, flag, tmsk_ptr);
@@ -1875,7 +1904,7 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) {
drawStripHE(dst, vs->pitch, bmap_ptr, vs->w, vs->h, true);
break;
case 150:
- fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h);
+ fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h, vs->bytesPerPixel);
break;
default:
// Alternative russian freddi3 uses badly formatted bitmaps
@@ -1927,6 +1956,8 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) {
}
void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h) {
+ assert(_vm->_bitDepth == 1);
+
const byte *bmap_ptr = _vm->findResourceData(MKID_BE('BMAP'), ptr);
assert(bmap_ptr);
@@ -1936,7 +1967,7 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y,
if (code == 8 || code == 9) {
Common::Rect rScreen(0, 0, vs->w, vs->h);
byte *dst = (byte *)_vm->_virtscr[kMainVirtScreen].backBuf + scrX;
- Wiz::copyWizImage(dst, bmap_ptr, vs->w, vs->h, x - scrX, y, w, h, &rScreen);
+ Wiz::copyWizImage(dst, bmap_ptr, vs->pitch, kDstScreen, vs->w, vs->h, x - scrX, y, w, h, &rScreen, 0, 0, 0, _vm->_bitDepth);
}
Common::Rect rect1(x, y, x + w, y + h);
@@ -1986,7 +2017,7 @@ void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) {
assert(rw <= _screenWidth && rw > 0);
assert(rh <= _screenHeight && rh > 0);
- blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh);
+ blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh, vs->bytesPerPixel);
markRectAsDirty(kMainVirtScreen, rect, dirtybit);
}
#endif
@@ -2016,15 +2047,15 @@ void Gdi::resetBackground(int top, int bottom, int strip) {
if (bottom > vs->bdirty[strip])
vs->bdirty[strip] = bottom;
- bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8;
- backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8;
+ bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel;
+ backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel;
numLinesToProcess = bottom - top;
if (numLinesToProcess) {
if (_vm->isLightOn()) {
- copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess);
+ copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess, vs->bytesPerPixel);
} else {
- clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess);
+ clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess, vs->bytesPerPixel);
}
}
}
@@ -2774,13 +2805,17 @@ void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int h
int x = width;
while (1) {
- if (!transpCheck || color != _transparentColor)
- *dst = _roomPalette[color];
- dst++;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ *dst = _roomPalette[color];
+ }
+ dst += _vm->_bitDepth;
--x;
if (x == 0) {
x = width;
- dst += dstPitch - width;
+ dst += dstPitch - width * _vm->_bitDepth;
--height;
if (height == 0)
return;
@@ -2863,9 +2898,13 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
int x = 8;
do {
FILL_BITS;
- if (!transpCheck || color != _transparentColor)
- *dst = _roomPalette[color] + _paletteMod;
- dst++;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ *dst = _roomPalette[color] + _paletteMod;
+ }
+ dst += _vm->_bitDepth;
againPos:
if (!READ_BIT) {
@@ -2886,13 +2925,17 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
do {
if (!--x) {
x = 8;
- dst += dstPitch - 8;
+ dst += dstPitch - 8 * _vm->_bitDepth;
if (!--height)
return;
}
- if (!transpCheck || color != _transparentColor)
- *dst = _roomPalette[color] + _paletteMod;
- dst++;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ *dst = _roomPalette[color] + _paletteMod;
+ }
+ dst += _vm->_bitDepth;
} while (--reps);
bits >>= 8;
bits |= (*src++) << (cl - 8);
@@ -2900,7 +2943,7 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
}
}
} while (--x);
- dst += dstPitch - 8;
+ dst += dstPitch - 8 * _vm->_bitDepth;
} while (--height);
}
@@ -2915,9 +2958,13 @@ void Gdi::drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height,
int x = 8;
do {
FILL_BITS;
- if (!transpCheck || color != _transparentColor)
- *dst = _roomPalette[color] + _paletteMod;
- dst++;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ *dst = _roomPalette[color] + _paletteMod;
+ }
+ dst += _vm->_bitDepth;
if (!READ_BIT) {
} else if (!READ_BIT) {
FILL_BITS;
@@ -2932,7 +2979,7 @@ void Gdi::drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height,
color += inc;
}
} while (--x);
- dst += dstPitch - 8;
+ dst += dstPitch - 8 * _vm->_bitDepth;
} while (--height);
}
@@ -2948,8 +2995,12 @@ void Gdi::drawStripBasicV(byte *dst, int dstPitch, const byte *src, int height,
int h = height;
do {
FILL_BITS;
- if (!transpCheck || color != _transparentColor)
- *dst = _roomPalette[color] + _paletteMod;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ *dst = _roomPalette[color] + _paletteMod;
+ }
dst += dstPitch;
if (!READ_BIT) {
} else if (!READ_BIT) {
@@ -3016,8 +3067,12 @@ void Gdi::drawStripRaw(byte *dst, int dstPitch, const byte *src, int height, con
do {
for (x = 0; x < 8; x ++) {
byte color = *src++;
- if (!transpCheck || color != _transparentColor)
- dst[x] = _roomPalette[color] + _paletteMod;
+ if (!transpCheck || color != _transparentColor) {
+ if (_vm->_game.features & GF_16BIT_COLOR)
+ WRITE_UINT16(dst + x * 2, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+ else
+ dst[x] = _roomPalette[color] + _paletteMod;
+ }
}
dst += dstPitch;
} while (--height);