From 58200eef8ec669800b39b0020fdb67486ec14a76 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 4 Nov 2005 04:53:48 +0000 Subject: Corrections to fillWizRect(). Fixes asserts in pearl locations of spyozon. svn-id: r19422 --- scumm/wiz_he.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index b6cd1892cc..26e147ff3c 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -1557,28 +1557,33 @@ void Wiz::fillWizRect(const WizParameters *params) { int w = READ_LE_UINT32(wizh + 0x4); int h = READ_LE_UINT32(wizh + 0x8); assert(c == 0); - Common::Rect r1(w, h); + Common::Rect areaRect, imageRect(w, h); if (params->processFlags & kWPFClipBox) { - if (!r1.intersects(params->box)) { + if (!imageRect.intersects(params->box)) { return; } - r1.clip(params->box); + imageRect.clip(params->box); } if (params->processFlags & kWPFClipBox2) { - r1.clip(params->box2); + areaRect = params->box2; + } else { + areaRect = imageRect; } uint8 color = _vm->VAR(93); if (params->processFlags & kWPFFillColor) { color = params->fillColor; } - uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0); - assert(wizd); - int dx = r1.width(); - int dy = r1.height(); - wizd += r1.top * w + r1.left; - while (dy--) { - memset(wizd, color, dx); - wizd += w; + if (areaRect.intersects(imageRect)) { + areaRect.clip(imageRect); + uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0); + assert(wizd); + int dx = areaRect.width(); + int dy = areaRect.height(); + wizd += areaRect.top * w + areaRect.left; + while (dy--) { + memset(wizd, color, dx); + wizd += w; + } } } } -- cgit v1.2.3