diff options
author | Travis Howell | 2005-04-21 15:40:40 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-21 15:40:40 +0000 |
commit | 098e0cce58a0c4039ac05fd7134c378ce33e1b71 (patch) | |
tree | c7c75c146fe81ae3e31aea04c8f5f246953879bb /scumm/palette_he.cpp | |
parent | f281ea4427c992c6232aa75ac012e1039facf425 (diff) | |
download | scummvm-rg350-098e0cce58a0c4039ac05fd7134c378ce33e1b71.tar.gz scummvm-rg350-098e0cce58a0c4039ac05fd7134c378ce33e1b71.tar.bz2 scummvm-rg350-098e0cce58a0c4039ac05fd7134c378ce33e1b71.zip |
Add palette function foe He99+ games.
svn-id: r17736
Diffstat (limited to 'scumm/palette_he.cpp')
-rw-r--r-- | scumm/palette_he.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/scumm/palette_he.cpp b/scumm/palette_he.cpp index 4a8199a335..ed2c27ab26 100644 --- a/scumm/palette_he.cpp +++ b/scumm/palette_he.cpp @@ -78,6 +78,59 @@ uint8 *ScummEngine_v90he::getHEPaletteIndex(int palSlot) { } } +int ScummEngine_v90he::getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end) { + assert(palSlot >= 1 && palSlot <= _numPalettes); + assert(start >= 1 && start <= 255); + assert(end >= 1 && end <= 255); + + int eax, edi, edp, edx, esi; + int sum, bestitem, bestsum; + uint8 *palPtr; + + palPtr = _hePalettes + palSlot * 1024 + start * 3; + + bestsum = 0xFFFFFFFF; + bestitem = start; + edp = arg_8; + + for (int i = start; i <= end; i++) { + esi = arg_4; + + edi = *palPtr++; + edx = *palPtr; + esi -= edi; + eax = edx; + + edi = edp; + eax = -eax; + eax <<= 31; + eax -= edx; + edi -= edx; + + eax += edp; + + edx = esi; + + eax *= edi; + edx *= esi; + + sum = edx + eax * 2; + + palPtr += 2; + + if (sum < bestsum) { + if (sum == 0) { + return i; + } + + bestsum = sum; + bestitem = i; + } + } + + return bestitem; +} + int ScummEngine_v90he::getHEPaletteColor(int palSlot, int color) { assert(palSlot >= 1 && palSlot <= _numPalettes); assert(color >= 1 && color <= 255); |