diff options
author | Travis Howell | 2009-10-26 13:22:05 +0000 |
---|---|---|
committer | Travis Howell | 2009-10-26 13:22:05 +0000 |
commit | dec5406e416418952a898b57439e707523341a26 (patch) | |
tree | b519cd8868b6e783b4a910fae52eb0c33057d449 /engines/scumm | |
parent | bd781fad910636044d5b959d4b8afd941abedb39 (diff) | |
download | scummvm-rg350-dec5406e416418952a898b57439e707523341a26.tar.gz scummvm-rg350-dec5406e416418952a898b57439e707523341a26.tar.bz2 scummvm-rg350-dec5406e416418952a898b57439e707523341a26.zip |
Fix charset display in PCE version of Loom.
svn-id: r45406
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/charset.cpp | 46 | ||||
-rw-r--r-- | engines/scumm/charset.h | 4 |
2 files changed, 30 insertions, 20 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 633250408e..a12636d9a4 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -622,10 +622,10 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { } if ((ignoreCharsetMask || !vs->hasTwoBuffers) && !(_vm->_useCJKMode && _vm->_textSurfaceMultiplier == 2)) { dst = vs->getPixels(_left, drawTop); - drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight); + drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel); } else { dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier); - drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight); + drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel); } if (_str.left > _left) @@ -659,7 +659,7 @@ void CharsetRendererV3::drawChar(int chr, const Graphics::Surface &s, int x, int height = 8; } dst = (byte *)s.pixels + y * s.pitch + x; - drawBits1(s, dst, charPtr, y, width, height); + drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); } void CharsetRenderer::translateColor() { @@ -857,7 +857,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, } if (is2byte) { - drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight); + drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight, dstSurface.bytesPerPixel); } else { drawBitsN(dstSurface, dstPtr, charPtr, *_fontPtr, drawTop, origWidth, origHeight); } @@ -926,7 +926,7 @@ void CharsetRendererClassic::drawChar(int chr, const Graphics::Surface &s, int x dst = (byte *)s.pixels + y * s.pitch + x; if (is2byte) { - drawBits1(s, dst, charPtr, y, width, height); + drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); } else { drawBitsN(s, dst, charPtr, *_fontPtr, y, width, height); } @@ -960,7 +960,7 @@ void CharsetRendererClassic::drawBitsN(const Graphics::Surface &s, byte *dst, co } } -void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height) { +void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) { int y, x; byte bits = 0; @@ -969,18 +969,28 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con if ((x % 8) == 0) bits = *src++; if ((bits & revBitMask(x % 8)) && y + drawTop >= 0) { - if (_shadowMode != kNoShadowMode) { - *(dst + 1) = _shadowColor; - *(dst + s.pitch) = _shadowColor; - if (_shadowMode != kFMTOWNSShadowMode) - *(dst + s.pitch + 1) = _shadowColor; + if (bitDepth == 2) { + if (_shadowMode != kNoShadowMode) { + WRITE_UINT16(dst + 2, _shadowColor); + WRITE_UINT16(dst + s.pitch, _shadowColor); + if (_shadowMode != kFMTOWNSShadowMode) + WRITE_UINT16(dst + s.pitch + 2, _shadowColor); + } + WRITE_UINT16(dst, _color); + } else { + if (_shadowMode != kNoShadowMode) { + *(dst + 1) = _shadowColor; + *(dst + s.pitch) = _shadowColor; + if (_shadowMode != kFMTOWNSShadowMode) + *(dst + s.pitch + 1) = _shadowColor; + } + *dst = _color; } - *dst = _color; } - dst++; + dst += bitDepth; } - dst += s.pitch - width; + dst += s.pitch - width * bitDepth; } } @@ -1143,10 +1153,10 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) { if (ignoreCharsetMask || !vs->hasTwoBuffers) { dst = vs->getPixels(_left, drawTop); - drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight); + drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel); } else { dst = (byte *)_vm->_textSurface.pixels + _top * _vm->_textSurface.pitch + _left; - drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight); + drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel); } if (_str.left > _left) @@ -1176,10 +1186,10 @@ void CharsetRendererNES::drawChar(int chr, const Graphics::Surface &s, int x, in height = 8; dst = (byte *)s.pixels + y * s.pitch + x; - drawBits1(s, dst, charPtr, y, width, height); + drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel); } -void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height) { +void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) { for (int i = 0; i < 8; i++) { byte c0 = src[i]; byte c1 = src[i + 8]; diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index 3859903281..8c48ef29f5 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -108,7 +108,7 @@ protected: ShadowMode _shadowMode; void enableShadow(bool enable); - void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height); + void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth); public: CharsetRendererCommon(ScummEngine *vm); @@ -137,7 +137,7 @@ class CharsetRendererNES : public CharsetRendererCommon { protected: byte *_trTable; - void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height); + void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth); public: CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {} |