diff options
author | Max Horn | 2005-06-04 16:10:39 +0000 |
---|---|---|
committer | Max Horn | 2005-06-04 16:10:39 +0000 |
commit | feac08c9f713c78330006ea60eb4f9e364ccc092 (patch) | |
tree | fe2aabea063e87bef5114fed1fc272f21af2e1fa | |
parent | 83f9ebc373ca63d34efe2366fb7714b6ca67aef5 (diff) | |
download | scummvm-rg350-feac08c9f713c78330006ea60eb4f9e364ccc092.tar.gz scummvm-rg350-feac08c9f713c78330006ea60eb4f9e364ccc092.tar.bz2 scummvm-rg350-feac08c9f713c78330006ea60eb4f9e364ccc092.zip |
Fix for bug #1064658 (FM-TOWNS (Loom, Zak, Indy3): Dialog text shading incorrect)
svn-id: r18343
-rw-r--r-- | scumm/charset.cpp | 54 | ||||
-rw-r--r-- | scumm/charset.h | 13 |
2 files changed, 48 insertions, 19 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index fffad02a52..da909900a4 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -195,7 +195,6 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) { _color = 0; - _dropShadow = false; _center = false; _hasMask = false; _textScreenID = kMainVirtScreen; @@ -220,6 +219,12 @@ CharsetRenderer::~CharsetRenderer() { free(_textSurface.pixels); } +CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm) + : CharsetRenderer(vm), _numChars(0), _fontHeight(0) { + _shadowMode = kNoShadowMode; + _shadowColor = 0; +} + void CharsetRendererCommon::setCurID(byte id) { checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d"); @@ -1171,21 +1176,39 @@ int CharsetRendererV3::getCharWidth(byte chr) { void CharsetRendererV3::setColor(byte color) { + bool useShadow = false; _color = color; - _shadowColor = (_vm->_platform == Common::kPlatformFMTowns) ? 8 : 0; + // FM-TOWNS version of Loom uses old colour method as well if ((_vm->_version >= 2) && (_vm->_features & GF_16COLOR || _vm->_gameId == GID_LOOM)) { - _dropShadow = ((_color & 0xF0) != 0); + useShadow = ((_color & 0xF0) != 0); _color &= 0x0f; } else if (_vm->_features & GF_OLD256) { - _dropShadow = ((_color & 0x80) != 0); + useShadow = ((_color & 0x80) != 0); _color &= 0x7f; } else - _dropShadow = false; + useShadow = false; + + enableShadow(useShadow); translateColor(); } +void CharsetRendererCommon::enableShadow(bool enable) { + if (enable) { + if (_vm->_platform == Common::kPlatformFMTowns) { + _shadowColor = 8; + _shadowMode = kFMTOWNSShadowMode; + } else { + _shadowColor = 0; + _shadowMode = kNormalShadowMode; + } + } else { + _shadowMode = kNoShadowMode; + } +} + + void CharsetRendererV3::printChar(int chr) { // Indy3 / Zak256 / Loom int width, height, origWidth, origHeight; @@ -1215,7 +1238,7 @@ void CharsetRendererV3::printChar(int chr) { origWidth = width; origHeight = height; - if (_dropShadow) { + if (_shadowMode != kNoShadowMode) { width++; height++; } @@ -1251,7 +1274,7 @@ void CharsetRendererV3::printChar(int chr) { if (_str.right < _left) { _str.right = _left; - if (_dropShadow) + if (_shadowMode != kNoShadowMode) _str.right++; } @@ -1314,8 +1337,7 @@ void CharsetRendererClassic::printChar(int chr) { int type = *_fontPtr; if (is2byte) { - _dropShadow = true; - _shadowColor = (_vm->_platform == Common::kPlatformFMTowns) ? 8 : 0; + enableShadow(true); charPtr = _vm->get2byteCharPtr(chr); width = _vm->_2byteWidth; height = _vm->_2byteHeight; @@ -1343,7 +1365,7 @@ void CharsetRendererClassic::printChar(int chr) { origWidth = width; origHeight = height; - if (_dropShadow) { + if (_shadowMode != kNoShadowMode) { width++; height++; } @@ -1486,7 +1508,7 @@ void CharsetRendererClassic::printChar(int chr) { if (_str.right < _left) { _str.right = _left; - if (_dropShadow) + if (_shadowMode != kNoShadowMode) _str.right++; } @@ -1503,8 +1525,7 @@ void CharsetRendererClassic::drawChar(int chr, const Graphics::Surface &s, int x int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; if (is2byte) { - _dropShadow = true; - _shadowColor = (_vm->_platform == Common::kPlatformFMTowns) ? 8 : 0; + enableShadow(true); charPtr = _vm->get2byteCharPtr(chr); width = _vm->_2byteWidth; height = _vm->_2byteHeight; @@ -1567,10 +1588,11 @@ 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 (_dropShadow) { + if (_shadowMode != kNoShadowMode) { *(dst + 1) = _shadowColor; *(dst + s.pitch) = _shadowColor; - *(dst + s.pitch + 1) = _shadowColor; + if (_shadowMode != kFMTOWNSShadowMode) + *(dst + s.pitch + 1) = _shadowColor; } *dst = _color; } @@ -1749,7 +1771,7 @@ void CharsetRendererNES::printChar(int chr) { if (_str.right < _left) { _str.right = _left; - if (_dropShadow) + if (_shadowMode != kNoShadowMode) _str.right++; } diff --git a/scumm/charset.h b/scumm/charset.h index 58228feb1b..98e8752c53 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -62,8 +62,6 @@ public: protected: byte _color; - byte _shadowColor; - bool _dropShadow; public: bool _center; @@ -117,10 +115,19 @@ protected: int _numChars; int _fontHeight; + enum ShadowMode { + kNoShadowMode, + kFMTOWNSShadowMode, + kNormalShadowMode + }; + byte _shadowColor; + ShadowMode _shadowMode; + + void enableShadow(bool enable); void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height); public: - CharsetRendererCommon(ScummEngine *vm) : CharsetRenderer(vm), _numChars(0), _fontHeight(0) {} + CharsetRendererCommon(ScummEngine *vm); void setCurID(byte id); |