diff options
author | Eugene Sandulenko | 2019-12-25 02:00:17 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-25 02:00:17 +0100 |
commit | 85b67d87714f8dbb4669c4033c019839df8f55d9 (patch) | |
tree | ba8f9ef0440a3bb494cf3618b30820c90d80fcb2 /engines | |
parent | 1cf7fd9196c61f620ce7135da7504e5e575736f2 (diff) | |
download | scummvm-rg350-85b67d87714f8dbb4669c4033c019839df8f55d9.tar.gz scummvm-rg350-85b67d87714f8dbb4669c4033c019839df8f55d9.tar.bz2 scummvm-rg350-85b67d87714f8dbb4669c4033c019839df8f55d9.zip |
DIRECTOR: Added palette transformation routine
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/cast.cpp | 4 | ||||
-rw-r--r-- | engines/director/director.h | 2 | ||||
-rw-r--r-- | engines/director/frame.cpp | 4 | ||||
-rw-r--r-- | engines/director/graphics.cpp | 6 |
4 files changed, 11 insertions, 5 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp index cf8c651c69..b5fab8c1fa 100644 --- a/engines/director/cast.cpp +++ b/engines/director/cast.cpp @@ -257,8 +257,8 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) { _shapeType = static_cast<ShapeType>(stream.readByte()); _initialRect = Score::readRect(stream); _pattern = stream.readUint16BE(); - _fgCol = (stream.readByte() + 128) & 0xff; // -128 -> 0, 127 -> 256 - _bgCol = (stream.readByte() + 128) & 0xff; + _fgCol = paletteTrans((128 + stream.readByte()) & 0xff); // -128 -> 0, 127 -> 256 + _bgCol = paletteTrans((128 + stream.readByte()) & 0xff); _fillType = stream.readByte(); _lineThickness = stream.readByte(); _lineDirection = stream.readByte(); diff --git a/engines/director/director.h b/engines/director/director.h index aa2d797644..b880f56439 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -180,6 +180,8 @@ private: void testFonts(); }; +byte paletteTrans(byte c); + extern DirectorEngine *g_director; } // End of namespace Director diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index 969a8464f0..cccc2c06b3 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -197,8 +197,8 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) { sprite._scriptId = stream->readByte(); sprite._spriteType = stream->readByte(); sprite._enabled = sprite._spriteType != 0; - sprite._foreColor = (stream->readByte() + 128) & 0xff; - sprite._backColor = (stream->readByte() + 128) & 0xff; + sprite._foreColor = paletteTrans((128 + stream->readByte()) & 0xff); // -128 -> 0, 127 -> 256 + sprite._backColor = paletteTrans((128 + stream->readByte()) & 0xff); sprite._flags = stream->readUint16(); sprite._ink = static_cast<InkType>(sprite._flags & 0x3f); diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp index 41b9cdeca6..25c6bea87c 100644 --- a/engines/director/graphics.cpp +++ b/engines/director/graphics.cpp @@ -288,7 +288,7 @@ void DirectorEngine::testFontScaling() { for (x = x1; x < x1 + 6; x++) for (y = y1; y < y1 + 6; y++) - *((byte *)surface.getBasePtr(x, y)) = (15 - i) * 16 + (15 - j); + *((byte *)surface.getBasePtr(x, y)) = paletteTrans(i * 16 + j); } } @@ -329,4 +329,8 @@ void DirectorEngine::testFonts() { delete fontFile; } +byte paletteTrans(byte c) { + return (0xf - (c & 0xf)) | (0xf0 - (c & 0xf0)); +} + } |