diff options
author | Travis Howell | 2005-11-01 00:52:25 +0000 |
---|---|---|
committer | Travis Howell | 2005-11-01 00:52:25 +0000 |
commit | b7d57c9284389c3f1130b5ab103928bc595efe46 (patch) | |
tree | 438f9e5b8241975c0e4d314cd57f793897cd38bb | |
parent | 9cb06c2a5d0a6887fd0bffeae0715bcf92565c53 (diff) | |
download | scummvm-rg350-b7d57c9284389c3f1130b5ab103928bc595efe46.tar.gz scummvm-rg350-b7d57c9284389c3f1130b5ab103928bc595efe46.tar.bz2 scummvm-rg350-b7d57c9284389c3f1130b5ab103928bc595efe46.zip |
Add floodFill support for wizImages.
svn-id: r19379
-rw-r--r-- | scumm/floodfill_he.cpp | 61 | ||||
-rw-r--r-- | scumm/wiz_he.cpp | 3 | ||||
-rw-r--r-- | scumm/wiz_he.h | 1 |
3 files changed, 63 insertions, 2 deletions
diff --git a/scumm/floodfill_he.cpp b/scumm/floodfill_he.cpp index 6bca6c84d3..cf816c4ac5 100644 --- a/scumm/floodfill_he.cpp +++ b/scumm/floodfill_he.cpp @@ -226,4 +226,65 @@ void floodFill(FloodFillParameters *ffp, ScummEngine_v90he *vm) { } } +void Wiz::fillWizFlood(const WizParameters *params) { + if (params->processFlags & kWPFClipBox2) { + int px = params->box2.left; + int py = params->box2.top; + uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum); + if (dataPtr) { + int state = 0; + if (params->processFlags & kWPFNewState) { + state = params->img.state; + } + uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0); + assert(wizh); + int c = READ_LE_UINT32(wizh + 0x0); + int w = READ_LE_UINT32(wizh + 0x4); + int h = READ_LE_UINT32(wizh + 0x8); + assert(c == 0); + Common::Rect imageRect(w, h); + if (params->processFlags & kWPFClipBox) { + if (!imageRect.intersects(params->box)) { + return; + } + imageRect.clip(params->box); + } + uint8 color = _vm->VAR(93); + if (params->processFlags & kWPFFillColor) { + color = params->fillColor; + } + if (imageRect.contains(px, py)) { + uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0); + assert(wizd); + + FloodFillState *ffs = new FloodFillState; + ffs->fillLineTableCount = h * 2; + ffs->fillLineTable = new FloodFillLine[ffs->fillLineTableCount]; + ffs->color2 = color; + ffs->dst = wizd; + ffs->dst_w = w; + ffs->dst_h = h; + ffs->srcBox = imageRect; + ffs->fillLineTableCur = &ffs->fillLineTable[0]; + ffs->fillLineTableEnd = &ffs->fillLineTable[ffs->fillLineTableCount]; + + if (px < 0 || py < 0 || px >= w || py >= h) { + ffs->color1 = color; + } else { + ffs->color1 = *(wizd + py * w + px); + } + + debug(0, "floodFill() x=%d y=%d color1=%d", px, py, ffs->color1); + + if (ffs->color1 != color) { + floodFillProcess(px, py, ffs, floodFillPixelCheck); + } + + delete[] ffs->fillLineTable; + delete ffs; + } + } + } +} + } // End of namespace Scumm diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index aaedb408f9..024acc782d 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -1834,8 +1834,7 @@ void Wiz::processWizImage(const WizParameters *params) { fillWizPixel(params); break; case 12: - // Used in PuttsFunShop/SamsFunShop - // TODO: Flood Fill + fillWizFlood(params); break; case 13: // Used in PuttsFunShop/SamsFunShop diff --git a/scumm/wiz_he.h b/scumm/wiz_he.h index f2a255e3e0..0cdb558fe4 100644 --- a/scumm/wiz_he.h +++ b/scumm/wiz_he.h @@ -165,6 +165,7 @@ public: void fillWizRect(const WizParameters *params); void fillWizLine(const WizParameters *params); void fillWizPixel(const WizParameters *params); + void fillWizFlood(const WizParameters *params); void getWizImageDim(int resNum, int state, int32 &w, int32 &h); int getWizImageStates(int resnum); |