aboutsummaryrefslogtreecommitdiff
path: root/scumm/charset.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2005-03-16 03:20:32 +0000
committerEugene Sandulenko2005-03-16 03:20:32 +0000
commitf86768fee8aabb448152092b95a0a0b08e59eb63 (patch)
tree0fc24b4274f3b1bca8033e174034d848a9d9452f /scumm/charset.cpp
parentdd71f57aeb2d921e89d4409a2548bddc4280a2d3 (diff)
downloadscummvm-rg350-f86768fee8aabb448152092b95a0a0b08e59eb63.tar.gz
scummvm-rg350-f86768fee8aabb448152092b95a0a0b08e59eb63.tar.bz2
scummvm-rg350-f86768fee8aabb448152092b95a0a0b08e59eb63.zip
Preliminary support for NES charsets. Colors are wrong and we get glitches
caused by too narrow screen. Also text clearing doesn't work. svn-id: r17164
Diffstat (limited to 'scumm/charset.cpp')
-rw-r--r--scumm/charset.cpp153
1 files changed, 153 insertions, 0 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 52497aef14..8a3ae390f8 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1669,6 +1669,159 @@ void CharsetRendererNut::printChar(int chr) {
_str.bottom = shadow.bottom;
}
+static byte trNESEnglishTable[] = {
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x0A, 0x07, 0x00,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
+ 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
+ 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x00, 0x00, 0x00, 0x2F, 0x00,
+ 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x00, 0x00, 0x00, 0x05, 0x08,
+ 0x20, 0x20, 0x21, 0x60, 0x27, 0x7E, 0x2C, 0x2E,
+ 0x7F, 0x3F, 0x2D, 0x30, 0x31, 0x32, 0x33, 0x34,
+ 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
+ 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
+ 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
+ 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5E
+};
+
+static byte trNESFrenchTable[] = {
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x64, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x0A, 0x07, 0x00,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
+ 0x13, 0x14, 0x00, 0x00, 0x15, 0x15, 0x64, 0x09,
+ 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x19, 0x19, 0x19, 0x2F, 0x29,
+ 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x1D, 0x23, 0x29, 0x05, 0x08,
+ 0x20, 0x20, 0x21, 0x60, 0x27, 0x7E, 0x2C, 0x2E,
+ 0x7F, 0x3F, 0x2D, 0x30, 0x31, 0x32, 0x33, 0x34,
+ 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
+ 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
+ 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
+ 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5E
+};
+
+static byte trNESSwedishTable[] = {
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x0A, 0x07, 0x00,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
+ 0x13, 0x14, 0x00, 0x00, 0x61, 0x00, 0x64, 0x09,
+ 0x00, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x62, 0x63, 0x00, 0x2F, 0x00,
+ 0x03, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
+ 0x2C, 0x2D, 0x2E, 0x63, 0x64, 0x61, 0x05, 0x08,
+ 0x20, 0x20, 0x21, 0x60, 0x27, 0x7E, 0x2C, 0x2E,
+ 0x7F, 0x3F, 0x2D, 0x30, 0x31, 0x32, 0x33, 0x34,
+ 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43,
+ 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
+ 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
+ 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5E
+};
+
+
+CharsetRendererNES::CharsetRendererNES(ScummEngine *vm, Common::Language language)
+ : CharsetRendererCommon(vm) {
+ switch (language) {
+ case Common::FR_FRA:
+ _trTable = trNESFrenchTable;
+ break;
+ case Common::SE_SWE:
+ _trTable = trNESSwedishTable;
+ break;
+ default:
+ _trTable = trNESEnglishTable;
+ break;
+ }
+}
+
+void CharsetRendererNES::printChar(int chr) {
+ int width, height, origWidth, origHeight;
+ VirtScreen *vs;
+ byte *charPtr, *dst;
+
+ if ((vs = _vm->findVirtScreen(_top)) == NULL)
+ return;
+
+ if (chr == '@')
+ return;
+
+ charPtr = _vm->_NESPatTable + _trTable[chr - 32] * 16;
+ width = getCharWidth(chr);
+ height = 8;
+
+ origWidth = width;
+ origHeight = 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;
+ }
+ dst = (byte *)_vm->gdi._textSurface.pixels + _top * _vm->gdi._textSurface.pitch + _left;
+ drawBits1(_vm->gdi._textSurface, dst, charPtr, drawTop, origWidth, origHeight);
+
+ if (_str.left > _left)
+ _str.left = _left;
+
+ _left += origWidth;
+
+ if (_str.right < _left) {
+ _str.right = _left;
+ if (_dropShadow)
+ _str.right++;
+ }
+
+ if (_str.bottom < _top + height)
+ _str.bottom = _top + height;
+}
+
+void CharsetRendererNES::drawChar(int chr, const Graphics::Surface &s, int x, int y) {
+ byte *charPtr, *dst;
+ int width, height;
+
+ charPtr = _vm->_NESPatTable + _trTable[chr - 32] * 16;
+ width = getCharWidth(chr);
+ height = 8;
+
+ dst = (byte *)s.pixels + y * s.pitch + x;
+ drawBits1(s, dst, charPtr, y, width, height);
+}
+
+void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height) {
+ for (int i = 0; i < 8; i++) {
+ byte c0 = src[i];
+ byte c1 = src[i + 8];
+ for (int j = 0; j < 8; j++)
+ dst[j] = _vm->_NESPalette[((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1)] | _color;
+ dst += s.pitch;
+ }
+}
+
} // End of namespace Scumm
#ifdef __PALM_OS__