diff options
author | Max Horn | 2006-01-10 00:28:10 +0000 |
---|---|---|
committer | Max Horn | 2006-01-10 00:28:10 +0000 |
commit | a3f6c5d112cab5ef07deaab545ebfc647bd24ff7 (patch) | |
tree | 15acd9ac90173f4f458e6d04e212d4e181e775a9 | |
parent | ba5c93c551c8e56e9802b97153c066e4d99a50f2 (diff) | |
download | scummvm-rg350-a3f6c5d112cab5ef07deaab545ebfc647bd24ff7.tar.gz scummvm-rg350-a3f6c5d112cab5ef07deaab545ebfc647bd24ff7.tar.bz2 scummvm-rg350-a3f6c5d112cab5ef07deaab545ebfc647bd24ff7.zip |
Refactoring to remove CharsetRenderer::_ignoreCharsetMask
svn-id: r19960
-rw-r--r-- | scumm/charset.cpp | 31 | ||||
-rw-r--r-- | scumm/charset.h | 11 | ||||
-rw-r--r-- | scumm/string.cpp | 16 |
3 files changed, 25 insertions, 33 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index 032c5b769c..03e4b1da44 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -198,7 +198,6 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) { _center = false; _hasMask = false; _textScreenID = kMainVirtScreen; - _ignoreCharsetMask = false; _blitAlso = false; _firstChar = false; _disableOffsX = false; @@ -1206,7 +1205,7 @@ void CharsetRendererCommon::enableShadow(bool enable) { } -void CharsetRendererV3::printChar(int chr) { +void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { // Indy3 / Zak256 / Loom int width, height, origWidth, origHeight; VirtScreen *vs; @@ -1252,11 +1251,11 @@ void CharsetRendererV3::printChar(int chr) { _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height); - if (!_ignoreCharsetMask) { + if (!ignoreCharsetMask) { _hasMask = true; _textScreenID = vs->number; } - if (_ignoreCharsetMask || !vs->hasTwoBuffers) { + if (ignoreCharsetMask || !vs->hasTwoBuffers) { dst = vs->getPixels(_left, drawTop); drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight); } else { @@ -1313,7 +1312,7 @@ void CharsetRenderer::translateColor() { } -void CharsetRendererClassic::printChar(int chr) { +void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { int width, height, origWidth, origHeight; int offsX, offsY; VirtScreen *vs; @@ -1404,14 +1403,14 @@ void CharsetRendererClassic::printChar(int chr) { byte *dstPtr; byte *back = NULL; - if (!_ignoreCharsetMask) { + if (!ignoreCharsetMask) { _hasMask = true; _textScreenID = vs->number; } if ((_vm->_heversion >= 71 && _bitDepth >= 8) || (_vm->_heversion >= 90 && _bitDepth == 0)) { #ifndef DISABLE_HE - if (_ignoreCharsetMask || !vs->hasTwoBuffers) { + if (ignoreCharsetMask || !vs->hasTwoBuffers) { dstPtr = vs->getPixels(0, 0); } else { dstPtr = (byte *)_textSurface.pixels; @@ -1439,7 +1438,7 @@ void CharsetRendererClassic::printChar(int chr) { } else { Graphics::Surface dstSurface; Graphics::Surface backSurface; - if (_ignoreCharsetMask || !vs->hasTwoBuffers) { + if (ignoreCharsetMask || !vs->hasTwoBuffers) { dstSurface = *vs; dstPtr = vs->getPixels(_left, drawTop); } else { @@ -1454,7 +1453,7 @@ void CharsetRendererClassic::printChar(int chr) { dstPtr = vs->getBackPixels(_left, drawTop); } - if (!_ignoreCharsetMask && vs->hasTwoBuffers) { + if (!ignoreCharsetMask && vs->hasTwoBuffers) { drawTop = _top - _vm->_screenTop; } @@ -1472,7 +1471,7 @@ void CharsetRendererClassic::printChar(int chr) { // once to each of the two buffers. That should hypothetically yield // identical results, though I didn't try it and right now I don't know // any spots where I can test this... - if (!_ignoreCharsetMask) + if (!ignoreCharsetMask) warning("This might be broken -- please report where you encountered this to Fingolfin"); // Perform some clipping @@ -1648,7 +1647,7 @@ int CharsetRendererNut::getFontHeight() { return _current->getCharHeight('|'); } -void CharsetRendererNut::printChar(int chr) { +void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) { Common::Rect shadow; assert(_current); @@ -1680,13 +1679,13 @@ void CharsetRendererNut::printChar(int chr) { shadow.bottom = _top + height + 2; Graphics::Surface s; - if (!_ignoreCharsetMask) { + if (!ignoreCharsetMask) { _hasMask = true; _textScreenID = kMainVirtScreen; } int drawTop = _top; - if (_ignoreCharsetMask) { + if (ignoreCharsetMask) { VirtScreen *vs = &_vm->virtscr[kMainVirtScreen]; s = *vs; s.pixels = vs->getPixels(0, 0); @@ -1711,7 +1710,7 @@ void CharsetRendererNut::printChar(int chr) { } #endif -void CharsetRendererNES::printChar(int chr) { +void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) { int width, height, origWidth, origHeight; VirtScreen *vs; byte *charPtr, *dst; @@ -1749,12 +1748,12 @@ void CharsetRendererNES::printChar(int chr) { _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height); - if (!_ignoreCharsetMask) { + if (!ignoreCharsetMask) { _hasMask = true; _textScreenID = vs->number; } - if (_ignoreCharsetMask || !vs->hasTwoBuffers) { + if (ignoreCharsetMask || !vs->hasTwoBuffers) { dst = vs->getPixels(_left, drawTop); drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight); } else { diff --git a/scumm/charset.h b/scumm/charset.h index 32a326cc44..4867a362e4 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -57,7 +57,6 @@ public: bool _hasMask; // True if "removable" text is visible somewhere (should be called _hasText or so) VirtScreenNumber _textScreenID; // ID of the virtual screen on which the text is visible. - bool _ignoreCharsetMask; bool _blitAlso; bool _firstChar; bool _disableOffsX; @@ -80,7 +79,7 @@ public: void clearCharsetMask(); void clearTextSurface(); - virtual void printChar(int chr) = 0; + virtual void printChar(int chr, bool ignoreCharsetMask) = 0; virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {} int getStringWidth(int a, const byte *str); @@ -130,7 +129,7 @@ protected: public: CharsetRendererClassic(ScummEngine *vm) : CharsetRendererCommon(vm) {} - void printChar(int chr); + void printChar(int chr, bool ignoreCharsetMask); void drawChar(int chr, const Graphics::Surface &s, int x, int y); int getCharWidth(byte chr); @@ -146,7 +145,7 @@ public: CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {} void setCurID(byte id) {} - void printChar(int chr); + void printChar(int chr, bool ignoreCharsetMask); void drawChar(int chr, const Graphics::Surface &s, int x, int y); int getFontHeight() { return 8; } @@ -160,7 +159,7 @@ protected: public: CharsetRendererV3(ScummEngine *vm) : CharsetRendererCommon(vm) {} - void printChar(int chr); + void printChar(int chr, bool ignoreCharsetMask); void drawChar(int chr, const Graphics::Surface &s, int x, int y); void setCurID(byte id); void setColor(byte color); @@ -186,7 +185,7 @@ public: CharsetRendererNut(ScummEngine *vm); ~CharsetRendererNut(); - void printChar(int chr); + void printChar(int chr, bool ignoreCharsetMask); void setCurID(byte id); diff --git a/scumm/string.cpp b/scumm/string.cpp index 6129b6ec26..04de8819c0 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -469,7 +469,7 @@ void ScummEngine::CHARSET_1() { } } if (_version <= 3) { - _charset->printChar(c); + _charset->printChar(c, false); } else { if (_features & GF_HE_NOSUBTITLES) { // HE games which use sprites for subtitles @@ -481,7 +481,7 @@ void ScummEngine::CHARSET_1() { // Subtitles are turned off, and there is a voice version // of this message -> don't print it. } else { - _charset->printChar(c); + _charset->printChar(c, false); } } _charset->_nextLeft = _charset->_left; @@ -554,9 +554,7 @@ void ScummEngine::drawString(int a, const byte *msg) { _charset->_left -= _charset->getStringWidth(a, buf) / 2; } - if (_version < 7) - _charset->_ignoreCharsetMask = true; - + const bool ignoreCharsetMask = (_version < 7); if (!buf[0]) { buf[0] = ' '; @@ -635,7 +633,7 @@ void ScummEngine::drawString(int a, const byte *msg) { } } } - _charset->printChar(c); + _charset->printChar(c, ignoreCharsetMask); _charset->_blitAlso = false; if (cmi_pos_hack) { @@ -645,8 +643,6 @@ void ScummEngine::drawString(int a, const byte *msg) { } } - _charset->_ignoreCharsetMask = false; - if (a == 0) { _charset->_nextLeft = _charset->_left; _charset->_nextTop = _charset->_top; @@ -864,7 +860,6 @@ void ScummEngine_v6::drawBlastTexts() { int c; int i; - _charset->_ignoreCharsetMask = true; for (i = 0; i < _blastTextQueuePos; i++) { buf = _blastTextQueue[i].text; @@ -905,7 +900,7 @@ void ScummEngine_v6::drawBlastTexts() { c += *buf++ * 256; } } - _charset->printChar(c); + _charset->printChar(c, true); } } while (c && c != '\n'); @@ -914,7 +909,6 @@ void ScummEngine_v6::drawBlastTexts() { _blastTextQueue[i].rect = _charset->_str; } - _charset->_ignoreCharsetMask = false; } void ScummEngine_v6::removeBlastTexts() { |