svn-id: r15224
This commit is contained in:
Max Horn 2004-09-21 13:54:30 +00:00
parent 5f0ec872e0
commit 2f9ea12ddd
6 changed files with 10 additions and 15 deletions

View file

@ -1805,12 +1805,9 @@ void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
// allow remap of generic palette entry?
if (!shadow_mode || akpl_color >= 16) {
if (r_fact != 256)
r = (r * r_fact) >> 8;
if (g_fact != 256)
g = (g * g_fact) >> 8;
if (b_fact != 256)
b = (b * b_fact) >> 8;
r = (r * r_fact) >> 8;
g = (g * g_fact) >> 8;
b = (b * b_fact) >> 8;
palette[i] = _vm->remapPaletteColor(r, g, b, threshold);
}
}

View file

@ -289,17 +289,15 @@ void ScummEngine::akos_decodeData(Actor *a, int frame, uint usemask) {
}
void AkosRenderer::setPalette(byte *new_palette) {
const byte *the_akpl;
uint size, i;
the_akpl = _vm->findResourceData(MKID('AKPL'), akos);
size = _vm->getResourceDataSize(akpl);
if (size > 256)
error("akos_setPalette: %d is too many colors", size);
for (i = 0; i < size; i++) {
palette[i] = new_palette[i] != 0xFF ? new_palette[i] : the_akpl[i];
palette[i] = new_palette[i] != 0xFF ? new_palette[i] : akpl[i];
}
if (_vm->_heversion == 70 && size) {

View file

@ -436,7 +436,7 @@ void ScummEngine::setupShadowPalette(int slot, int redScale, int greenScale, int
*table++ = remapPaletteColor((curpal[0] * redScale) >> 8,
(curpal[1] * greenScale) >> 8,
(curpal[2] * blueScale) >> 8,
(uint) - 1);
-1);
curpal += 3;
}
}
@ -658,7 +658,7 @@ void ScummEngine::desaturatePalette(int hueScale, int satScale, int lightScale,
}
int ScummEngine::remapPaletteColor(int r, int g, int b, uint threshold) {
int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) {
int i;
int ar, ag, ab;
uint sum, bestsum, bestitem = 0;
@ -692,7 +692,7 @@ int ScummEngine::remapPaletteColor(int r, int g, int b, uint threshold) {
}
}
if (threshold != (uint) - 1 && bestsum > colorWeight(threshold, threshold, threshold)) {
if (threshold != -1 && bestsum > colorWeight(threshold, threshold, threshold)) {
// Best match exceeded threshold. Try to find an unused palette entry and
// use it for our purpose.
pal = _currentPalette + (256 - 2) * 3;

View file

@ -2705,7 +2705,7 @@ void ScummEngine_v6::o6_kernelGetFunctions() {
push(checkXYInBoxBounds(args[3], args[1], args[2]));
break;
case 206:
push(remapPaletteColor(args[1], args[2], args[3], (uint) - 1));
push(remapPaletteColor(args[1], args[2], args[3], -1));
break;
case 207:
i = getObjectIndex(args[1]);

View file

@ -1362,7 +1362,7 @@ void ScummEngine_v8::o8_kernelGetFunctions() {
push(getKeyState(args[1]));
break;
case 0xCE: // getRGBSlot
push(remapPaletteColor(args[1], args[2], args[3], (uint) - 1));
push(remapPaletteColor(args[1], args[2], args[3], -1));
break;
case 0xD7: // getBox
push(checkXYInBoxBounds(args[3], args[1], args[2]));

View file

@ -978,7 +978,7 @@ protected:
virtual void palManipulateInit(int resID, int start, int end, int time);
void palManipulate();
public:
int remapPaletteColor(int r, int g, int b, uint threshold); // Used by Actor::remapActorPalette
int remapPaletteColor(int r, int g, int b, int threshold); // Used by Actor::remapActorPalette
protected:
void moveMemInPalRes(int start, int end, byte direction);
void setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);