diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/costume.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/cursor.cpp | 21 | ||||
-rw-r--r-- | engines/scumm/detection_tables.h | 4 | ||||
-rw-r--r-- | engines/scumm/gfx.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/palette.cpp | 23 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 9 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 1 |
7 files changed, 60 insertions, 16 deletions
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 3d649d3159..584e7b3269 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -297,7 +297,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { return 2; } - v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x; + v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel; v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf); @@ -647,7 +647,7 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) { for (int row = 0; row < 16; ++row) { xPos = xStep * x * 16; for (int col = 0; col < 16; ++col) { - dst = v1.destptr + yPos * _out.pitch + xPos; + dst = v1.destptr + yPos * _out.pitch + xPos * _vm->_bytesPerPixel; mask = v1.mask_ptr + yPos * _numStrips + (v1.x + xPos) / 8; maskbit = revBitMask((v1.x + xPos) % 8); @@ -657,7 +657,7 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) { (v1.mask_ptr && (mask[0] & maskbit)); if (color && !masked) { - *dst = color; + WRITE_UINT16(dst, _vm->_16BitPalette[color]); } xPos += xStep; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index f3104c2b9f..cd1f194889 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -364,10 +364,10 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { s.pixels = buf; s.w = _charset->getCharWidth(chr); s.h = _charset->getFontHeight(); - s.pitch = s.w; + s.pitch = s.w * _bytesPerPixel; // s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917 assert(s.w <= 16 && s.h <= 17); - s.bytesPerPixel = 1; + s.bytesPerPixel = _bytesPerPixel; _charset->drawChar(chr, s, 0, 0); @@ -378,7 +378,7 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { if (buf[s.pitch * h + w] != 123) *ptr |= 1 << (15 - w); } - ptr++; + ptr += _bytesPerPixel; } // _charset->setCurID(oldID); @@ -536,7 +536,12 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { byte color = default_cursor_colors[idx]; const uint16 *src = _cursorImages[_currentCursor]; - memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); + if (_bytesPerPixel == 2) { + for (i = 0; i < 1024; i++) + WRITE_UINT16(_grabbedCursor + i * 2, 0xFF); + } else { + memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); + } _cursor.hotspotX = _cursorHotspots[2 * _currentCursor]; _cursor.hotspotY = _cursorHotspots[2 * _currentCursor + 1]; @@ -545,8 +550,12 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { - if (src[i] & (1 << j)) - _grabbedCursor[16 * i + 15 - j] = color; + if (src[i] & (1 << j)) { + if (_bytesPerPixel == 2) + WRITE_UINT16(_grabbedCursor + 16 * i + (15 - j) * 2, _16BitPalette[color]); + else + _grabbedCursor[16 * i + 15 - j] = color; + } } } diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 914bf2e5a8..4dbd65ccba 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -216,7 +216,9 @@ static const GameSettings gameVariantsTable[] = { {"loom", "EGA", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_CMS | MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NOSPEECH}, {"loom", "No Adlib", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_CMS, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI}, - {"loom", "PC-Engine", 0, GID_LOOM, 3, 0, MDT_NONE, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformPCEngine, GUIO_NOSPEECH | GUIO_NOMIDI}, +#ifdef USE_RGB_COLOR + {"loom", "PC-Engine", 0, GID_LOOM, 3, 0, MDT_NONE, GF_AUDIOTRACKS | GF_OLD256 | GF_16BIT_COLOR, Common::kPlatformPCEngine, GUIO_NOSPEECH | GUIO_NOMIDI}, +#endif {"loom", "FM-TOWNS", 0, GID_LOOM, 3, 0, MDT_TOWNS, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI}, {"loom", "VGA", "vga", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI}, diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 1f73d7581f..42443f8be6 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1023,7 +1023,10 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) { fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width, height, _textSurface.bytesPerPixel); } } else { - fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel); + if (_game.features & GF_16BIT_COLOR) + fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->bytesPerPixel); + else + fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel); } } @@ -1262,7 +1265,10 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) { fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel); } } else { - fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel); + if (_game.features & GF_16BIT_COLOR) + fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->bytesPerPixel); + else + fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel); } } @@ -2882,7 +2888,7 @@ void GdiPCEngine::drawStripPCEngine(byte *dst, byte *mask, int dstPitch, int str for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { paletteEntry = tile[row * 8 + col]; - dst[col] = paletteOffset + paletteEntry; + WRITE_UINT16(dst + col * 2, _vm->_16BitPalette[paletteOffset + paletteEntry]); } dst += dstPitch; } diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index c6ec6021f3..7ab5584f9e 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -260,6 +260,11 @@ void ScummEngine::setPCEPaletteFromPtr(const byte *ptr) { *dest++ = 6 << 5; } + if (_game.features & GF_16BIT_COLOR) { + for (int i = firstIndex; i < firstIndex + numcolor - 1; ++i) { + _16BitPalette[i] = get16BitColor(_currentPalette[i * 3 + 0], _currentPalette[i * 3 + 1], _currentPalette[i * 3 + 2]); + } + } setDirtyColors(firstIndex, firstIndex + numcolor - 1); } @@ -708,6 +713,9 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int if (color > max) color = max; _currentPalette[idx * 3 + 2] = color; + + if (_game.features & GF_16BIT_COLOR) + _16BitPalette[idx] = get16BitColor(_currentPalette[idx * 3 + 0], _currentPalette[idx * 3 + 1], _currentPalette[idx * 3 + 2]); } if (_game.heversion != 70) setDirtyColors(startColor, endColor); @@ -888,6 +896,11 @@ void ScummEngine::swapPalColors(int a, int b) { ap[2] = bp[2]; bp[2] = t; + if (_game.features & GF_16BIT_COLOR) { + _16BitPalette[a] = get16BitColor(ap[0], ap[1], ap[2]); + _16BitPalette[b] = get16BitColor(bp[0], bp[1], bp[2]); + } + setDirtyColors(a, a); setDirtyColors(b, b); } @@ -905,6 +918,9 @@ void ScummEngine::copyPalColor(int dst, int src) { dp[1] = sp[1]; dp[2] = sp[2]; + if (_game.features & GF_16BIT_COLOR) + _16BitPalette[dst] = get16BitColor(sp[0], sp[1], sp[2]); + setDirtyColors(dst, dst); } @@ -920,6 +936,10 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) { _darkenPalette[idx * 3 + 1] = g; _darkenPalette[idx * 3 + 2] = b; } + + if (_game.features & GF_16BIT_COLOR) + _16BitPalette[idx] = get16BitColor(r, g, b); + setDirtyColors(idx, idx); } @@ -982,6 +1002,9 @@ const byte *ScummEngine::getPalettePtr(int palindex, int room) { } void ScummEngine::updatePalette() { + if (_game.features & GF_16BIT_COLOR) + return; + if (_palDirtyMax == -1) return; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index b8afb5460e..7cfa813f70 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -111,12 +111,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _currentScript(0xFF), // Let debug() work on init stage _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) { - if (_game.features & GF_16BIT_COLOR) { - _gdi = new Gdi16Bit(this); - } else if (_game.platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); } else if (_game.platform == Common::kPlatformPCEngine) { _gdi = new GdiPCEngine(this); + } else if (_game.features & GF_16BIT_COLOR) { + _gdi = new Gdi16Bit(this); } else if (_game.version <= 1) { _gdi = new GdiV1(this); } else if (_game.version == 2) { @@ -1486,6 +1486,9 @@ void ScummEngine_v2::resetScumm() { void ScummEngine_v3::resetScumm() { ScummEngine_v4::resetScumm(); + _16BitPalette = (uint16 *)malloc(512); + memset(_16BitPalette, 0, 512); + delete _savePreparedSavegame; _savePreparedSavegame = NULL; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index e3475d6bf7..b136bab52d 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -1124,6 +1124,7 @@ public: byte _HEV7ActorPalette[256]; uint8 *_hePalettes; uint16 _hePaletteSlot; + uint16 *_16BitPalette; protected: int _shadowPaletteSize; |