aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/scumm/akos.cpp14
-rw-r--r--engines/scumm/akos.h4
-rw-r--r--engines/scumm/he/wiz_he.cpp21
-rw-r--r--engines/scumm/he/wiz_he.h6
-rw-r--r--engines/scumm/palette.cpp10
5 files changed, 45 insertions, 10 deletions
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp
index 19c7c3320b..fc4aabcf88 100644
--- a/engines/scumm/akos.cpp
+++ b/engines/scumm/akos.cpp
@@ -303,6 +303,19 @@ void AkosRenderer::setPalette(byte *new_palette) {
if (_vm->_game.heversion >= 99 && _paletteNum) {
for (i = 0; i < size; i++)
_palette[i] = (byte)_vm->_hePalettes[_paletteNum * 1024 + 768 + akpl[i]];
+ } else if (_vm->_game.heversion >= 99 && rgbs) {
+ for (i = 0; i < size; i++) {
+ if (new_palette[i] == 0xFF) {
+ uint8 col = akpl[i];
+ uint8 r = rgbs[col * 3 + 0];
+ uint8 g = rgbs[col * 3 + 1];
+ uint8 b = rgbs[col * 3 + 2];
+
+ _palette[i] = _vm->remapPaletteColor(r, g, b, -1);
+ } else {
+ _palette[i] = new_palette[i];
+ }
+ }
} else {
for (i = 0; i < size; i++) {
_palette[i] = new_palette[i] != 0xFF ? new_palette[i] : akpl[i];
@@ -336,6 +349,7 @@ void AkosRenderer::setCostume(int costume, int shadow) {
akpl = _vm->findResourceData(MKID_BE('AKPL'), akos);
_codec = READ_LE_UINT16(&akhd->codec);
akct = _vm->findResourceData(MKID_BE('AKCT'), akos);
+ rgbs = _vm->findResourceData(MKID_BE('RGBS'), akos);
xmap = 0;
if (shadow) {
diff --git a/engines/scumm/akos.h b/engines/scumm/akos.h
index d38ae4b1ad..be532b804d 100644
--- a/engines/scumm/akos.h
+++ b/engines/scumm/akos.h
@@ -73,7 +73,8 @@ protected:
const byte *akcd; // costume data (contains the data for the codecs)
const byte *akct; // HE specific: condition table
- const uint8 *xmap; // HE specific: shadow color table ?!?
+ const byte *rgbs; // HE specific: RGB table
+ const uint8 *xmap; // HE specific: shadow color table
struct {
bool repeatMode;
@@ -97,6 +98,7 @@ public:
akof = 0;
akcd = 0;
akct = 0;
+ rgbs = 0;
xmap = 0;
_actorHitMode = false;
}
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index c2637e9526..fb1eb28765 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -570,7 +570,12 @@ void Wiz::copyRaw16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth,
dst += r2.left + r2.top * dstw;
while (h--) {
for (int i = 0; i < w; ++i) {
- uint16 col = READ_LE_UINT16(src + 2 * i) / 256;
+ uint16 col = READ_LE_UINT16(src + 2 * i);
+ uint8 r = ((col >> 10) & 0x1F) << 3;
+ uint8 g = ((col >> 5) & 0x1F) << 3;
+ uint8 b = ((col >> 0) & 0x1F) << 3;
+ col = _vm->remapPaletteColor(r, g, b, -1);
+
if (transColor == -1 || transColor != col) {
dst[i] = palPtr[col];
}
@@ -653,7 +658,12 @@ void Wiz::decompress16BitWizImage(uint8 *dst, int dstPitch, const uint8 *src, co
code += w;
}
while (code--) {
- uint16 col = READ_LE_UINT16(dataPtr) / 256;
+ uint16 col = READ_LE_UINT16(dataPtr);
+ uint8 r = ((col >> 10) & 0x1F) << 3;
+ uint8 g = ((col >> 5) & 0x1F) << 3;
+ uint8 b = ((col >> 0) & 0x1F) << 3;
+ col = _vm->remapPaletteColor(r, g, b, -1);
+
if (type == kWizXMap) {
*dstPtr = xmapPtr[col * 256 + *dstPtr];
}
@@ -682,7 +692,12 @@ void Wiz::decompress16BitWizImage(uint8 *dst, int dstPitch, const uint8 *src, co
code += w;
}
while (code--) {
- uint16 col = READ_LE_UINT16(dataPtr) / 256;
+ uint16 col = READ_LE_UINT16(dataPtr);
+ uint8 r = ((col >> 10) & 0x1F) << 3;
+ uint8 g = ((col >> 5) & 0x1F) << 3;
+ uint8 b = ((col >> 0) & 0x1F) << 3;
+ col = _vm->remapPaletteColor(r, g, b, -1);
+
if (type == kWizXMap) {
*dstPtr = xmapPtr[col * 256 + *dstPtr];
}
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index b2baf8f2b0..86df15c3e6 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -203,11 +203,11 @@ public:
static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch);
static void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags = 0, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
static void copyWizImageWithMask(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int maskT, int maskP);
- static void copy16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags = 0, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
+ void copy16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags = 0, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
static void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
- static void copyRaw16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
+ void copyRaw16BitWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
template<int type> static void decompressWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
- template<int type> static void decompress16BitWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
+ template<int type> void decompress16BitWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr = NULL, const uint8 *xmapPtr = NULL);
template<int type> static void decompressRawWizImage(uint8 *dst, int dstPitch, const uint8 *src, int srcPitch, int w, int h, int transColor, const uint8 *palPtr = NULL);
int isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h, uint bitdepth);
uint8 getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint bitDepth, uint8 color);
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 6d6c499462..4214ab2330 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -811,12 +811,16 @@ void ScummEngine_v8::desaturatePalette(int hueScale, int satScale, int lightScal
int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) {
- int i;
- int ar, ag, ab;
+ byte *pal;
+ int ar, ag, ab, i;
uint sum, bestsum, bestitem = 0;
int startColor = (_game.version == 8) ? 24 : 1;
- byte *pal = _currentPalette + startColor * 3;
+
+ if (_game.heversion >= 99)
+ pal = _hePalettes + 1024 + startColor * 3;
+ else
+ pal = _currentPalette + startColor * 3;
if (r > 255)
r = 255;