diff options
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/palette_he.cpp | 43 | ||||
-rw-r--r-- | scumm/wiz_he.cpp | 4 |
3 files changed, 47 insertions, 2 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index dd85c58c20..46d612b9c2 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -783,6 +783,8 @@ protected: int readFileToArray(int slot, int32 size); void writeFileFromArray(int slot, int resID); + void remapPalette(uint8 *src, uint8 *dst); + void displayWizImage(WizImage *pwi); void displayWizComplexImage(const WizParameters *params); void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum); diff --git a/scumm/palette_he.cpp b/scumm/palette_he.cpp index b2259918a3..d268d80861 100644 --- a/scumm/palette_he.cpp +++ b/scumm/palette_he.cpp @@ -29,6 +29,49 @@ namespace Scumm { +void ScummEngine_v72he::remapPalette(uint8 *src, uint8 *dst) { + int a, b, c, eax, ebx, tmp; + uint8 *palPtr; + + int startColor = 10; + int endColor = 246; + src += 30; + + if (_heversion >= 99) { + palPtr = _hePalettes + 1024 + 30; + } else { + palPtr = _currentPalette + 30; + } + + for (int j = startColor; j < endColor; j++) { + ebx = 0xFFFF; + tmp = 0xFFFF; + + a = *src++; + b = *src++; + c = *src++; + + uint8 *curPal = palPtr; + + for (int k = startColor; k < endColor; k++) { + a -= *curPal++; + b -= *curPal++; + c -= *curPal++; + + eax = (a * 2) + (b * 2) + (c * 2); + + if (ebx == 0xFFFF || eax <= tmp) { + ebx = k; + tmp = eax; + } + } + + if (ebx != 0xFFFF) { + dst[j] = ebx; + } + } +} + uint8 *ScummEngine_v90he::getHEPaletteIndex(int palSlot) { if (palSlot) { assert(palSlot >= 1 && palSlot <= _numPalettes); diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index ff23a4ca3d..fe37156c6a 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -912,8 +912,8 @@ uint8 *ScummEngine_v72he::drawWizImage(int resNum, int state, int x1, int y1, in assert(rmap); uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0); assert(rgbs); - warning("drawWizImage() unhandled flag 0x2"); - // XXX modify 'RMAP' buffer + remapPalette(rgbs, rmap + 4); + warning("drawWizImage() flag 0x2"); } if (flags & kWIFPrint) { warning("WizImage printing is unimplemented"); |