aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-25 02:12:55 +0100
committerEugene Sandulenko2019-12-25 02:12:55 +0100
commitd5687eb22274bf0eb2b737239738862500249390 (patch)
tree85eb9f111edcadc43938a36943c7295365bdbc4d
parent85b67d87714f8dbb4669c4033c019839df8f55d9 (diff)
downloadscummvm-rg350-d5687eb22274bf0eb2b737239738862500249390.tar.gz
scummvm-rg350-d5687eb22274bf0eb2b737239738862500249390.tar.bz2
scummvm-rg350-d5687eb22274bf0eb2b737239738862500249390.zip
DIRECTOR: Simplify palette transformations
-rw-r--r--engines/director/cast.cpp4
-rw-r--r--engines/director/director.h2
-rw-r--r--engines/director/frame.cpp4
-rw-r--r--engines/director/graphics.cpp6
4 files changed, 5 insertions, 11 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index b5fab8c1fa..804bd58a8a 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 = paletteTrans((128 + stream.readByte()) & 0xff); // -128 -> 0, 127 -> 256
- _bgCol = paletteTrans((128 + stream.readByte()) & 0xff);
+ _fgCol = (127 - stream.readByte()) & 0xff; // -128 -> 0, 127 -> 256
+ _bgCol = (127 - 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 b880f56439..aa2d797644 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -180,8 +180,6 @@ 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 cccc2c06b3..8bd1f45535 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 = paletteTrans((128 + stream->readByte()) & 0xff); // -128 -> 0, 127 -> 256
- sprite._backColor = paletteTrans((128 + stream->readByte()) & 0xff);
+ sprite._foreColor = (127 - stream->readByte()) & 0xff; // -128 -> 0, 127 -> 256
+ sprite._backColor = (127 - 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 25c6bea87c..b1030d09ce 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)) = paletteTrans(i * 16 + j);
+ *((byte *)surface.getBasePtr(x, y)) = 255 - (i * 16 + j);
}
}
@@ -329,8 +329,4 @@ void DirectorEngine::testFonts() {
delete fontFile;
}
-byte paletteTrans(byte c) {
- return (0xf - (c & 0xf)) | (0xf0 - (c & 0xf0));
-}
-
}