aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-04-10 01:25:33 +0000
committerTravis Howell2005-04-10 01:25:33 +0000
commitb40fa83d4134f13eefb360c173044159674d687c (patch)
treedb5d29c6e1ddfce8a068e259ebd763a72d525863
parent475ee9211744f09d7bce812a5a911a1334526a44 (diff)
downloadscummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.tar.gz
scummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.tar.bz2
scummvm-rg350-b40fa83d4134f13eefb360c173044159674d687c.zip
Add initial rmap support for wizImages.
svn-id: r17497
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/palette_he.cpp43
-rw-r--r--scumm/wiz_he.cpp4
3 files changed, 47 insertions, 2 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index dd85c58c20..46d612b9c2 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -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);
diff --git a/scumm/palette_he.cpp b/scumm/palette_he.cpp
index b2259918a3..d268d80861 100644
--- a/scumm/palette_he.cpp
+++ b/scumm/palette_he.cpp
@@ -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);
diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp
index ff23a4ca3d..fe37156c6a 100644
--- a/scumm/wiz_he.cpp
+++ b/scumm/wiz_he.cpp
@@ -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");