void CharsetRendererV3::drawChar(int chr, Graphics::Surface &s, int x, int y) { const byte *charPtr; byte *dst; int width, height; int is2byte = (chr >= 0x80 && _vm->_useCJKMode) ? 1 : 0; if (is2byte) { #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE if (_vm->_game.platform == Common::kPlatformFMTowns) { _vm->_cjkFont->drawChar(s, chr, x * _vm->_textSurfaceMultiplier, y * _vm->_textSurfaceMultiplier, _color, _shadowColor); return; } else #endif { charPtr = _vm->get2byteCharPtr(chr); width = _vm->_2byteWidth; height = _vm->_2byteHeight; } } else { charPtr = _fontPtr + chr * 8; // width = height = 8; width = getCharWidth(chr); height = 8; } dst = (byte *)s.pixels + y * s.pitch + x; drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel); }
void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { // WORKAROUND for bug #1509509: Indy3 Mac does not show black // characters (such as in the grail diary) if ignoreCharsetMask // is true. See also patch #1851568. if (_vm->_game.id == GID_INDY3 && _vm->_game.platform == Common::kPlatformMacintosh && _color == 0) ignoreCharsetMask = false; // Indy3 / Zak256 / Loom int width, height, origWidth = 0, origHeight; VirtScreen *vs; const byte *charPtr; byte *dst; int is2byte = (chr >= 256 && _vm->_useCJKMode) ? 1 : 0; assertRange(0, _curId, _vm->_numCharsets - 1, "charset"); if ((vs = _vm->findVirtScreen(_top)) == NULL) return; if (chr == '@') return; if (_vm->_useCJKMode && chr > 127) { if (_vm->_game.platform == Common::kPlatformFMTowns) { charPtr = 0; width = _vm->_cjkFont->getCharWidth(chr); height = _vm->_cjkFont->getFontHeight(); } else { width = _vm->_2byteWidth; height = _vm->_2byteHeight; charPtr = _vm->get2byteCharPtr(chr); } } else { charPtr = _fontPtr + chr * 8; width = getCharWidth(chr); height = 8; } // Clip at the right side (to avoid drawing "outside" the screen bounds). if (_left + origWidth > _right + 1) return; origWidth = width; origHeight = height; if (_shadowMode != kNoShadowMode) { width++; height++; } if (_firstChar) { _str.left = _left; _str.top = _top; _str.right = _left; _str.bottom = _top; _firstChar = false; } int drawTop = _top - vs->topline; _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height); if (!ignoreCharsetMask) { _hasMask = true; _textScreenID = vs->number; } if ( #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE (_vm->_game.platform != Common::kPlatformFMTowns) && #endif (ignoreCharsetMask || !vs->hasTwoBuffers)) { dst = vs->getPixels(_left, drawTop); if (charPtr) drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel); else if (_vm->_cjkFont) _vm->_cjkFont->drawChar(vs, chr, _left, drawTop, _color, _shadowColor); } else { dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier); if (charPtr) drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel, (_vm->_textSurfaceMultiplier == 2 && !is2byte)); else if (_vm->_cjkFont) _vm->_cjkFont->drawChar(_vm->_textSurface, chr, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, _color, _shadowColor); if (is2byte) origWidth /= _vm->_textSurfaceMultiplier; } if (_str.left > _left) _str.left = _left; _left += origWidth; if (_str.right < _left) { _str.right = _left; if (_shadowMode != kNoShadowMode) _str.right++; } if (_str.bottom < _top + height / _vm->_textSurfaceMultiplier) _str.bottom = _top + height / _vm->_textSurfaceMultiplier; }