[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.375,2.376 gfx.h,1.93,1.94 script_v72he.cpp,2.183,2.184 script_v90he.cpp,2.107,2.108
Gregory Montoir
cyx at users.sourceforge.net
Fri Nov 12 20:06:06 CET 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29765/scumm
Modified Files:
gfx.cpp gfx.h script_v72he.cpp script_v90he.cpp
Log Message:
minor Wiz stuff update
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.375
retrieving revision 2.376
diff -u -d -r2.375 -r2.376
--- gfx.cpp 9 Nov 2004 11:27:15 -0000 2.375
+++ gfx.cpp 13 Nov 2004 04:05:34 -0000 2.376
@@ -1468,18 +1468,51 @@
dstRect.clip(r3);
srcRect = dstRect;
srcRect.moveTo(0, 0);
- return true;
+ return srcRect.isValidRect() && dstRect.isValidRect();
}
void Gdi::copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect) {
Common::Rect r1, r2;
if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
- if (r1.isValidRect() && r2.isValidRect()) {
- uint8 *dstPtr = dst + r2.left + r2.top * dstw;
- for (int i = 0; i < 256; i++)
- _wizImagePalette[i] = i;
+ for (int i = 0; i < 256; i++)
+ _wizImagePalette[i] = i;
+ dst += r2.left + r2.top * dstw;
+ decompressWizImage(dst, dstw, r2, src, r1);
+ }
+}
- decompressWizImage(dstPtr, dstw, r2, src, r1);
+void Gdi::copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor) {
+ Common::Rect r1, r2;
+ if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
+ if (flags & 0x40) {
+ int l = r1.left;
+ int r = r1.right;
+ r1.left = srcw - r;
+ r1.right = srcw - l;
+ }
+ if (flags & 0x80) {
+ int t = r1.top;
+ int b = r1.bottom;
+ r1.top = srch - b;
+ r1.bottom = srch - t;
+ }
+ if (!palPtr) {
+ for (int i = 0; i < 256; i++) {
+ _wizImagePalette[i] = i;
+ }
+ palPtr = _wizImagePalette;
+ }
+ int h = r1.height();
+ int w = r1.width();
+ dst += r2.top * dstw;
+ while (h--) {
+ for (int i = 0; i < w; ++i) {
+ uint8 col = *src++;
+ if (transColor == -1 || transColor != col) {
+ dst[r2.left + i] = palPtr[col];
+ }
+ }
+ dst += dstw;
}
}
}
@@ -1593,9 +1626,7 @@
void Gdi::copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect) {
Common::Rect r1, r2;
if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
- if (r1.isValidRect() && r2.isValidRect()) {
- decompressAuxImage(dst1, dst2, dstw, r2, src, r1);
- }
+ decompressAuxImage(dst1, dst2, dstw, r2, src, r1);
}
}
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- gfx.h 7 Oct 2004 16:10:51 -0000 1.93
+++ gfx.h 13 Nov 2004 04:05:35 -0000 1.94
@@ -278,6 +278,7 @@
void drawBMAPBg(const byte *ptr, VirtScreen *vs, int startstrip);
void drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h);
void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect);
+ void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);
void decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect);
void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect);
void decompressAuxImage(uint8 *dst1, uint8 *dst2, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect);
Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.183
retrieving revision 2.184
diff -u -d -r2.183 -r2.184
--- script_v72he.cpp 23 Oct 2004 13:49:58 -0000 2.183
+++ script_v72he.cpp 13 Nov 2004 04:05:35 -0000 2.184
@@ -1742,15 +1742,16 @@
uint8 *dst = NULL;
const uint8 *dataPtr = getResourceAddress(restype, pwi->resNum);
if (dataPtr) {
+ const uint8 *rmap = NULL;
+ const uint8 *xmap = findWrappedBlock(MKID('XMAP'), dataPtr, pwi->state, 0);
+
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, pwi->state, 0);
assert(wizh);
uint32 comp = READ_LE_UINT32(wizh + 0x0);
uint32 width = READ_LE_UINT32(wizh + 0x4);
uint32 height = READ_LE_UINT32(wizh + 0x8);
- if (comp != 1) {
- warning("%d has invalid compression type %d", pwi->resNum, comp);
- return 0;
- }
+ assert(comp == 0 || comp == 1 || comp == 2 || comp == 3 || comp == 10 || comp == 11);
+
const uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, pwi->state, 0);
assert(wizd);
if (pwi->flags & 1) {
@@ -1759,12 +1760,12 @@
setPaletteFromPtr(pal, 256);
}
if (pwi->flags & 2) {
- const uint8 *rmap = findWrappedBlock(MKID('RMAP'), dataPtr, pwi->state, 0);
+ rmap = findWrappedBlock(MKID('RMAP'), dataPtr, pwi->state, 0);
assert(rmap);
const uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, pwi->state, 0);
assert(rgbs);
-// drawWizImageHelper1(rmap + 4, _currentPalette, rgbs);
warning("drawWizImage() unhandled flag 0x2");
+ // XXX modify 'RMAP' buffer
}
uint32 cw, ch;
if (pwi->flags & 0x24) { // printing (0x4) or rendering to memory (0x20)
@@ -1786,23 +1787,35 @@
ch = pvs->h;
}
Common::Rect rScreen(cw, ch);
- if (pwi->flags & 0x80) {
-// drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 2);
- warning("drawWizImage() unhandled flag 0x80");
- } else if (pwi->flags & 0x100) {
-// drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 1);
- warning("drawWizImage() unhandled flag 0x100");
+ // XXX handle 'XMAP' / 'RMAP' data
+ if (comp == 1) {
+ if (pwi->flags & 0x80) {
+ warning("drawWizImage() unhandled flag 0x80");
+ } else if (pwi->flags & 0x100) {
+ warning("drawWizImage() unhandled flag 0x100");
+ } else {
+ gdi.copyWizImage(dst, wizd, cw, ch, pwi->x1, pwi->y1, width, height, &rScreen);
+ }
+ } else if (comp == 0 || comp == 2) {
+ const uint8 *trns = findWrappedBlock(MKID('TRNS'), dataPtr, pwi->state, 0);
+ int color = (trns == NULL) ? VAR(VAR_WIZ_TCOLOR) : -1;
+ const uint8 *pal = xmap;
+ if (pwi->flags & 2) {
+ pal = rmap + 4;
+ }
+ gdi.copyRawWizImage(dst, wizd, cw, ch, pwi->x1, pwi->y1, width, height, &rScreen, pwi->flags, pal, color);
} else {
- gdi.copyWizImage(dst, wizd, cw, ch, pwi->x1, pwi->y1, width, height, &rScreen);
+ warning("unhandled wiz compression type %d", comp);
}
if (pwi->flags & 4) {
- warning("printing Wiz image is unimplemented");
+ warning("WizImage printing is unimplemented");
+ free(dst);
dst = NULL;
} else if (!(pwi->flags & 0x20)) {
Common::Rect rImage(pwi->x1, pwi->y1, pwi->x1 + width, pwi->y1 + height);
if (rImage.intersects(rScreen)) {
rImage.clip(rScreen);
- if (pwi->flags & 0x18) {
+ if (!(pwi->flags & 8) && pwi->flags & 0x18) {
++rImage.bottom;
markRectAsDirty(kMainVirtScreen, rImage);
} else {
Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.107
retrieving revision 2.108
diff -u -d -r2.107 -r2.108
--- script_v90he.cpp 24 Oct 2004 13:43:36 -0000 2.107
+++ script_v90he.cpp 13 Nov 2004 04:05:35 -0000 2.108
@@ -1231,7 +1231,7 @@
pop();
push(0);
break;
- case 100:
+ case 100: // SO_GET_WIZ_HISTOGRAM
pop();
pop();
pop();
@@ -1240,6 +1240,11 @@
pop();
push(0);
break;
+ case 109:
+ pop();
+ pop();
+ push(0);
+ break;
default:
error("o90_unknown29: Unknown case %d", subOp);
}
More information about the Scummvm-git-logs
mailing list