Add initial rmap support for wizImages.

svn-id: r17497
This commit is contained in:
Travis Howell 2005-04-10 01:25:33 +00:00
parent 475ee92117
commit b40fa83d41
3 changed files with 47 additions and 2 deletions

View file

@ -783,6 +783,8 @@ protected:
int readFileToArray(int slot, int32 size);
void writeFileFromArray(int slot, int resID);
void remapPalette(uint8 *src, uint8 *dst);
void displayWizImage(WizImage *pwi);
void displayWizComplexImage(const WizParameters *params);
void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum);

View file

@ -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);

View file

@ -912,8 +912,8 @@ uint8 *ScummEngine_v72he::drawWizImage(int resNum, int state, int x1, int y1, in
assert(rmap);
uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
assert(rgbs);
warning("drawWizImage() unhandled flag 0x2");
// XXX modify 'RMAP' buffer
remapPalette(rgbs, rmap + 4);
warning("drawWizImage() flag 0x2");
}
if (flags & kWIFPrint) {
warning("WizImage printing is unimplemented");