diff options
author | Travis Howell | 2005-04-10 01:25:33 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-10 01:25:33 +0000 |
commit | b40fa83d4134f13eefb360c173044159674d687c (patch) | |
tree | db5d29c6e1ddfce8a068e259ebd763a72d525863 /scumm/palette_he.cpp | |
parent | 475ee9211744f09d7bce812a5a911a1334526a44 (diff) | |
download | scummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.tar.gz scummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.tar.bz2 scummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.zip |
Add initial rmap support for wizImages.
svn-id: r17497
Diffstat (limited to 'scumm/palette_he.cpp')
-rw-r--r-- | scumm/palette_he.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
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); |