diff options
-rw-r--r-- | scumm/script_v72he.cpp | 80 | ||||
-rw-r--r-- | scumm/scumm.cpp | 1 | ||||
-rw-r--r-- | scumm/scumm.h | 1 | ||||
-rw-r--r-- | scumm/vars.cpp | 4 |
4 files changed, 53 insertions, 33 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 734c2d52c5..4f8515e07e 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -1401,7 +1401,7 @@ uint8 *ScummEngine_v72he::drawWizImage(int restype, int resnum, int state, int x drawWizPolygon(resnum, state, x1, flags); return NULL; } - + uint8 *dst = NULL; const uint8 *dataPtr = getResourceAddress(restype, resnum); if (dataPtr) { const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0); @@ -1420,54 +1420,70 @@ uint8 *ScummEngine_v72he::drawWizImage(int restype, int resnum, int state, int x setPaletteFromPtr(pal, 256); } if (flags & 2) { - warning("unhandled Wiz image w/ rmap palette"); + const uint8 *rmap = findWrappedBlock(MKID('RMAP'), dataPtr, state, 0); + assert(rmap); + const uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0); + assert(rgbs); +// drawWizImageHelper1(rmap + 4, _currentPalette, rgbs); + warning("drawWizImage() unhandled flag 0x2"); } - if (flags & 4) { - warning("printing Wiz image is unimplemented"); - return NULL; - } - - uint8 *dst = NULL; + uint32 cw, ch; if (flags & 0x24) { // printing (0x4) or rendering to memory (0x20) dst = (uint8 *)malloc(width * height); - memset(dst, 255, width * height); // make transparent - if (flags & 0x20) { - // copy width * height bytes from VAR_117 to dst + int color = 255; // FIXME: should be (VAR_WIZ_TCOLOR != 0xFF) ? VAR(VAR_WIZ_TCOLOR) : 5; + memset(dst, color, width * height); // FIXME: dirty hack until missing bits are implemented Common::Rect rScreen(0, 0, width-1, height-1); gdi.copyWizImage(dst, wizd, width, height, 0, 0, width, height, &rScreen); setCursorFromBuffer(dst, width, height, width); free(dst); - // FIXME: return a valid pointer for drawWizPolygon (0x20) return NULL; } + cw = width; + ch = height; + } else { + VirtScreen *pvs = &virtscr[kMainVirtScreen]; + if (flags & 0x10) { + dst = pvs->getPixels(0, pvs->topline); + } else { + dst = pvs->getBackPixels(0, pvs->topline); + } + cw = pvs->w; + ch = pvs->h; } - - VirtScreen *pvs = &virtscr[kMainVirtScreen]; - if (flags & 0x10) { - dst = pvs->getPixels(0, pvs->topline); - } else if (!(flags & 0x20)) { - dst = pvs->getBackPixels(0, pvs->topline); + Common::Rect rScreen(0, 0, cw, ch); + if (flags & 0x80) { +// drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 2); + warning("drawWizImage() unhandled flag 0x80"); + } else if (flags & 0x100) { +// drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 1); + warning("drawWizImage() unhandled flag 0x100"); + } else if (flags & 2) { +// drawWizImageHelper3(dst, wizd, cw, ch, x1, y1, width, height, rScreen, rmap + 4); + } else { + gdi.copyWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen); } - Common::Rect rScreen(0, 0, pvs->w, pvs->h); - gdi.copyWizImage(dst, wizd, pvs->w, pvs->h, x1, y1, width, height, &rScreen); - - Common::Rect rImage(x1, y1, x1 + width, y1 + height); - if (rImage.intersects(rScreen)) { - rImage.clip(rScreen); - if (flags & 0x18) { - ++rImage.bottom; - markRectAsDirty(kMainVirtScreen, rImage); - } else { - --rImage.right; - --rImage.bottom; - gdi.copyVirtScreenBuffers(rImage); + if (flags & 4) { + warning("printing Wiz image is unimplemented"); + dst = NULL; + } else { + Common::Rect rImage(x1, y1, x1 + width, y1 + height); + if (rImage.intersects(rScreen)) { + rImage.clip(rScreen); + if (flags & 0x18) { + ++rImage.bottom; + markRectAsDirty(kMainVirtScreen, rImage); + } else { + --rImage.right; + --rImage.bottom; + gdi.copyVirtScreenBuffers(rImage); + } } } } - return NULL; + return dst; } struct PolygonDrawData { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 244a0bbcd1..4ecb956583 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -853,6 +853,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS VAR_NUM_SPRITES = 0xFF; VAR_POLYGONS_ONLY = 0xFF; VAR_WINDOWS_VERSION = 0xFF; + VAR_WIZ_TCOLOR = 0xFF; // Use g_scumm from error() ONLY g_scumm = this; diff --git a/scumm/scumm.h b/scumm/scumm.h index 9e7e2955b9..6ee20a732b 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1337,6 +1337,7 @@ public: byte VAR_NUM_SPRITES; byte VAR_POLYGONS_ONLY; byte VAR_WINDOWS_VERSION; + byte VAR_WIZ_TCOLOR; }; // This is a constant lookup table of reverse bit masks diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 1c051fcf19..7eca4d4153 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -259,8 +259,10 @@ void ScummEngine_v72he::setupScummVars() { VAR_NUM_GLOBAL_OBJS = 74; VAR_POLYGONS_ONLY = 76; - if (_heversion >= 80) + if (_heversion >= 80) { VAR_WINDOWS_VERSION = 79; + VAR_WIZ_TCOLOR = 117; + } if (_heversion >= 90) VAR_NUM_SPRITES = 106; } |