Add palette function foe He99+ games.
svn-id: r17736
This commit is contained in:
parent
f281ea4427
commit
098e0cce58
3 changed files with 69 additions and 9 deletions
|
@ -1002,6 +1002,8 @@ protected:
|
||||||
|
|
||||||
uint8 *getHEPaletteIndex(int palSlot);
|
uint8 *getHEPaletteIndex(int palSlot);
|
||||||
int getHEPaletteColor(int palSlot, int color);
|
int getHEPaletteColor(int palSlot, int color);
|
||||||
|
int getPaletteUnk1(int palSlot, int arg_4, int arg_8, int start, int end);
|
||||||
|
|
||||||
void setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b);
|
void setHEPaletteColor(int palSlot, uint8 color, uint8 r, uint8 g, uint8 b);
|
||||||
void setHEPaletteFromPtr(int palSlot, const uint8 *palData);
|
void setHEPaletteFromPtr(int palSlot, const uint8 *palData);
|
||||||
void setHEPaletteFromCostume(int palSlot, int resId);
|
void setHEPaletteFromCostume(int palSlot, int resId);
|
||||||
|
|
|
@ -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) {
|
int ScummEngine_v90he::getHEPaletteColor(int palSlot, int color) {
|
||||||
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
assert(palSlot >= 1 && palSlot <= _numPalettes);
|
||||||
assert(color >= 1 && color <= 255);
|
assert(color >= 1 && color <= 255);
|
||||||
|
|
|
@ -2256,6 +2256,7 @@ void ScummEngine_v90he::o90_getObjectData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine_v90he::o90_getPaletteData() {
|
void ScummEngine_v90he::o90_getPaletteData() {
|
||||||
|
int b, c, d, e;
|
||||||
int palSlot, color;
|
int palSlot, color;
|
||||||
|
|
||||||
byte subOp = fetchScriptByte();
|
byte subOp = fetchScriptByte();
|
||||||
|
@ -2263,13 +2264,13 @@ void ScummEngine_v90he::o90_getPaletteData() {
|
||||||
|
|
||||||
switch (subOp) {
|
switch (subOp) {
|
||||||
case 0:
|
case 0:
|
||||||
|
e = pop();
|
||||||
|
d = pop();
|
||||||
|
palSlot = pop();
|
||||||
pop();
|
pop();
|
||||||
pop();
|
c = pop();
|
||||||
pop();
|
b = pop();
|
||||||
pop();
|
push(getPaletteUnk1(palSlot, b, c, d, e));
|
||||||
pop();
|
|
||||||
pop();
|
|
||||||
push(0);
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
pop();
|
pop();
|
||||||
|
@ -2289,9 +2290,13 @@ void ScummEngine_v90he::o90_getPaletteData() {
|
||||||
break;
|
break;
|
||||||
case 172:
|
case 172:
|
||||||
pop();
|
pop();
|
||||||
pop();
|
c = pop();
|
||||||
pop();
|
c = MAX(0, c);
|
||||||
push(0);
|
c = MIN(c, 255);
|
||||||
|
b = pop();
|
||||||
|
b = MAX(0, b);
|
||||||
|
b = MIN(b, 255);
|
||||||
|
push(getPaletteUnk1(1, b, c, 10, 245));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("o90_getPaletteData: Unknown case %d", subOp);
|
error("o90_getPaletteData: Unknown case %d", subOp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue