diff options
author | Max Horn | 2003-05-08 22:44:46 +0000 |
---|---|---|
committer | Max Horn | 2003-05-08 22:44:46 +0000 |
commit | c63ec9d0084f341c39118cfe8d5a01434bc9bbf5 (patch) | |
tree | 5804dc9e67adc749a3fc770d886c66db2248540d /scumm/charset.cpp | |
parent | 4d7f7a8c80fdf78cf29f8517546a5a2a89694bab (diff) | |
download | scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.tar.gz scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.tar.bz2 scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.zip |
added a v2 charset rendered (with a hardcoded font take from german zak); enabled verbs in zak (well, they are drawn at least :-)
svn-id: r7398
Diffstat (limited to 'scumm/charset.cpp')
-rw-r--r-- | scumm/charset.cpp | 199 |
1 files changed, 185 insertions, 14 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index ebadc9b371..0099031dd3 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -32,15 +32,27 @@ void CharsetRendererCommon::setCurID(byte id) { if (_fontPtr == 0) error("CharsetRendererCommon::setCurID: charset %d not found!\n", id); - if (_vm->_features & GF_AFTER_V3) { - _nbChars = _fontPtr[4]; - _fontPtr += 6 + _nbChars; - } else if (_vm->_features & GF_AFTER_V4) + if (_vm->_features & GF_AFTER_V4) _fontPtr += 17; else _fontPtr += 29; } +void CharsetRendererV3::setCurID(byte id) { + _vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d"); + + _curId = id; + + _fontPtr = _vm->getResourceAddress(rtCharset, id); + if (_fontPtr == 0) + error("CharsetRendererCommon::setCurID: charset %d not found!\n", id); + + _nbChars = _fontPtr[4]; + _fontPtr += 6; + _widthTable = _fontPtr; + _fontPtr += _nbChars; +} + // do spacing for variable width old-style font int CharsetRendererClassic::getCharWidth(byte chr) { int spacing = 0; @@ -58,14 +70,6 @@ int CharsetRendererClassic::getCharWidth(byte chr) { return spacing; } -int CharsetRendererOld256::getCharWidth(byte chr) { - int spacing = 0; - - spacing = *(_fontPtr - _nbChars + chr); - - return spacing; -} - int CharsetRenderer::getStringWidth(int arg, byte *text) { int pos = 0; int width = 1; @@ -168,7 +172,174 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) { setCurID(oldID); } -void CharsetRendererOld256::setColor(byte color) +// German Zak font (should work for US version too). +// See patch #732072 +static byte charsetDataV2[] = { + 0x89, 0x04, 0x00, 0x00, 0x63, 0x01, 0x80, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x04, 0x04, 0x07, 0x08, 0x07, 0x07, 0x08, 0x04, + 0x05, 0x05, 0x03, 0x08, 0x04, 0x06, 0x04, 0x08, + 0x07, 0x04, 0x07, 0x07, 0x08, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x04, 0x04, 0x08, 0x08, 0x08, 0x07, + 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x03, 0x06, 0x07, 0x07, 0x08, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x02, 0x08, + 0x08, 0x07, 0x07, 0x06, 0x07, 0x07, 0x06, 0x07, + 0x07, 0x03, 0x05, 0x07, 0x04, 0x08, 0x07, 0x07, // h i j k l m n o / 104 - 111 + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xc0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7e, 0x7c, + 0x7c, 0x7e, 0x7f, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0xfe, 0xfe, 0xfe, 0xfc, 0xfe, 0x7e, 0x3e, + 0x3e, 0x7e, 0xfe, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x20, 0x20, 0x20, 0x1c, 0x00, + 0x04, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x3c, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x78, 0x40, 0x3c, 0x00, + 0x0c, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x3c, 0x04, 0x38, + 0x00, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, + 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, + 0x02, 0x02, 0x38, 0x40, 0x40, 0x40, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, + 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x66, 0x66, 0xff, 0x66, 0xff, 0x66, 0x66, 0x00, + 0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00, + 0xc4, 0xcc, 0x18, 0x30, 0x60, 0xcc, 0x8c, 0x00, + 0x78, 0xcc, 0x78, 0x70, 0xce, 0xcc, 0x7e, 0x00, + 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x60, 0xc0, 0xc0, 0xc0, 0x60, 0x30, 0x00, + 0xc0, 0x60, 0x30, 0x30, 0x30, 0x60, 0xc0, 0x00, + 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, 0x00, + 0x66, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xc0, + 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, + 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x60, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x78, 0xcc, 0x0c, 0x18, 0x60, 0xc0, 0xfc, 0x00, + 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00, + 0x0c, 0x1c, 0x2c, 0x4c, 0xfe, 0x0c, 0x0c, 0x00, + 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00, + 0x78, 0xcc, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00, + 0xfc, 0xcc, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, + 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0xc0, + 0x7c, 0xfe, 0xfc, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3f, 0x61, 0xcc, 0xd0, 0xd0, 0xcc, 0x61, 0x3f, + 0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, + 0x30, 0x78, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, + 0xf8, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xf8, 0x00, + 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, + 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, 0x00, + 0xfc, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xfc, 0x00, + 0xfc, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0x00, + 0x78, 0xcc, 0xc0, 0xdc, 0xcc, 0xcc, 0x78, 0x00, + 0xcc, 0xcc, 0x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, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfe, + 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7c, 0x00, + 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0x00, + 0x00, 0x00, 0x78, 0xc0, 0xc0, 0xc0, 0x78, 0x00, + 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0x38, 0x60, 0xf8, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x78, + 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0xc0, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, + 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, + 0xc0, 0xc0, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0x00, + 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00, + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, + 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, + 0x00, 0x00, 0xf8, 0xcc, 0xc0, 0xc0, 0xc0, 0x00, + 0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00, + 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x1c, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, + 0x00, 0x00, 0xc6, 0xd6, 0xfe, 0x7c, 0x6c, 0x00, + 0x00, 0x00, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x18, 0x70, + 0x00, 0x00, 0xfc, 0x18, 0x30, 0x60, 0xfc, 0x00, + 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0xcc, 0x30, 0x78, 0xcc, 0xfc, 0xcc, 0xcc, 0x00, + 0x84, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x38, 0x6c, 0x6c, 0xf8, 0xcc, 0xcc, 0xf8, 0x80, + 0x08, 0x0c, 0x0e, 0xff, 0xff, 0x0e, 0x0c, 0x08, + 0x0e +}; + +void CharsetRendererV2::setCurID(byte id) { + printf("CharsetRendererV2::setCurID(%d)\n", id); + + _nbChars = charsetDataV2[6]; + _widthTable = charsetDataV2 + 8; + _fontPtr = charsetDataV2 + 8 + _nbChars; +} + +int CharsetRendererV3::getCharWidth(byte chr) { + int spacing = 0; + + spacing = *(_widthTable + chr); + + return spacing; +} + +void CharsetRendererV3::setColor(byte color) { _color = color; if (_vm->_features & GF_16COLOR) { @@ -178,7 +349,7 @@ void CharsetRendererOld256::setColor(byte color) _dropShadow = false; } -void CharsetRendererOld256::printChar(int chr) { +void CharsetRendererV3::printChar(int chr) { // Indy3 / Zak256 / Loom VirtScreen *vs; byte *char_ptr, *dest_ptr, *mask_ptr; |