mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 07:11:49 +00:00
cleanup
svn-id: r17740
This commit is contained in:
parent
97749a934e
commit
8d76879849
@ -1002,9 +1002,8 @@ protected:
|
||||
|
||||
uint8 *getHEPaletteIndex(int palSlot);
|
||||
int getHEPaletteColor(int palSlot, int color);
|
||||
int getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end);
|
||||
int getPaletteUnk2(int palSlot, int unk1, int unk2);
|
||||
|
||||
int getHEPaletteSimilarColor(int palSlot, int red, int green, int start, int end);
|
||||
int getHEPaletteColorComponent(int palSlot, int color, int component);
|
||||
void setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b);
|
||||
void setHEPaletteFromPtr(int palSlot, const uint8 *palData);
|
||||
void setHEPaletteFromCostume(int palSlot, int resId);
|
||||
|
@ -78,64 +78,37 @@ uint8 *ScummEngine_v90he::getHEPaletteIndex(int palSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
int ScummEngine_v90he::getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end) {
|
||||
int ScummEngine_v90he::getHEPaletteSimilarColor(int palSlot, int red, int green, 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;
|
||||
uint8 *pal = _hePalettes + palSlot * 1024 + start * 3;
|
||||
|
||||
palPtr = _hePalettes + palSlot * 1024 + start * 3;
|
||||
|
||||
bestsum = 0xFFFFFFFF;
|
||||
bestitem = start;
|
||||
edp = arg_8;
|
||||
int bestsum = 0xFFFFFFFF;
|
||||
int bestitem = start;
|
||||
|
||||
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;
|
||||
|
||||
int dr = red - pal[0];
|
||||
int dg = green - pal[1];
|
||||
int sum = dr * dr + dg * dg * 2;
|
||||
if (sum == 0) {
|
||||
return i;
|
||||
}
|
||||
if (sum < bestsum) {
|
||||
if (sum == 0) {
|
||||
return i;
|
||||
}
|
||||
|
||||
bestsum = sum;
|
||||
bestitem = i;
|
||||
}
|
||||
pal += 3;
|
||||
}
|
||||
|
||||
return bestitem;
|
||||
}
|
||||
|
||||
int ScummEngine_v90he::getPaletteUnk2(int palSlot, int unk1, int unk2) {
|
||||
int ScummEngine_v90he::getHEPaletteColorComponent(int palSlot, int color, int component) {
|
||||
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
||||
assert(unk1 >= 1 && unk1 <= 255);
|
||||
assert(color >= 1 && color <= 255);
|
||||
|
||||
return _hePalettes[palSlot * 1024 + unk1 * 3 + unk2 / 3];
|
||||
return _hePalettes[palSlot * 1024 + color * 3 + component % 3];
|
||||
}
|
||||
|
||||
int ScummEngine_v90he::getHEPaletteColor(int palSlot, int color) {
|
||||
|
@ -2397,7 +2397,7 @@ void ScummEngine_v100he::o100_getPaletteData() {
|
||||
case 13:
|
||||
c = pop();
|
||||
b = pop();
|
||||
push(getPaletteUnk2(1, b, c));
|
||||
push(getHEPaletteColorComponent(1, b, c));
|
||||
break;
|
||||
case 20:
|
||||
color = pop();
|
||||
@ -2411,7 +2411,7 @@ void ScummEngine_v100he::o100_getPaletteData() {
|
||||
pop();
|
||||
c = pop();
|
||||
b = pop();
|
||||
push(getPaletteUnk1(palSlot, b, c, d, e));
|
||||
push(getHEPaletteSimilarColor(palSlot, b, c, d, e));
|
||||
break;
|
||||
case 53:
|
||||
pop();
|
||||
@ -2421,13 +2421,13 @@ void ScummEngine_v100he::o100_getPaletteData() {
|
||||
b = pop();
|
||||
b = MAX(0, b);
|
||||
b = MIN(b, 255);
|
||||
push(getPaletteUnk1(1, b, c, 10, 245));
|
||||
push(getHEPaletteSimilarColor(1, b, c, 10, 245));
|
||||
break;
|
||||
case 73:
|
||||
c = pop();
|
||||
b = pop();
|
||||
palSlot = pop();
|
||||
push(getPaletteUnk2(palSlot, b, c));
|
||||
push(getHEPaletteColorComponent(palSlot, b, c));
|
||||
break;
|
||||
default:
|
||||
error("o100_getPaletteData: Unknown case %d", subOp);
|
||||
|
@ -2270,13 +2270,13 @@ void ScummEngine_v90he::o90_getPaletteData() {
|
||||
pop();
|
||||
c = pop();
|
||||
b = pop();
|
||||
push(getPaletteUnk1(palSlot, b, c, d, e));
|
||||
push(getHEPaletteSimilarColor(palSlot, b, c, d, e));
|
||||
break;
|
||||
case 7:
|
||||
c = pop();
|
||||
b = pop();
|
||||
palSlot = pop();
|
||||
push(getPaletteUnk2(palSlot, b, c));
|
||||
push(getHEPaletteColorComponent(palSlot, b, c));
|
||||
break;
|
||||
case 21:
|
||||
color = pop();
|
||||
@ -2286,7 +2286,7 @@ void ScummEngine_v90he::o90_getPaletteData() {
|
||||
case 87:
|
||||
c = pop();
|
||||
b = pop();
|
||||
push(getPaletteUnk2(1, b, c));
|
||||
push(getHEPaletteColorComponent(1, b, c));
|
||||
break;
|
||||
case 172:
|
||||
pop();
|
||||
@ -2296,7 +2296,7 @@ void ScummEngine_v90he::o90_getPaletteData() {
|
||||
b = pop();
|
||||
b = MAX(0, b);
|
||||
b = MIN(b, 255);
|
||||
push(getPaletteUnk1(1, b, c, 10, 245));
|
||||
push(getHEPaletteSimilarColor(1, b, c, 10, 245));
|
||||
break;
|
||||
default:
|
||||
error("o90_getPaletteData: Unknown case %d", subOp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user