[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.377,2.378 gfx.h,1.94,1.95 intern.h,2.314,2.315 script_v72he.cpp,2.184,2.185 script_v90he.cpp,2.109,2.110
Gregory Montoir
cyx at users.sourceforge.net
Sun Nov 21 13:34:14 CET 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15210/scumm
Modified Files:
gfx.cpp gfx.h intern.h script_v72he.cpp script_v90he.cpp
Log Message:
HE wiz stuff update
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.377
retrieving revision 2.378
diff -u -d -r2.377 -r2.378
--- gfx.cpp 21 Nov 2004 17:47:05 -0000 2.377
+++ gfx.cpp 21 Nov 2004 21:31:26 -0000 2.378
@@ -1478,7 +1478,6 @@
if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
for (int i = 0; i < 256; i++)
_wizImagePalette[i] = i;
- dst += r2.left + r2.top * dstw;
decompressWizImage(dst, dstw, r2, src, r1);
}
}
@@ -1486,13 +1485,13 @@
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) {
+ if (flags & 0x400) {
int l = r1.left;
int r = r1.right;
r1.left = srcw - r;
r1.right = srcw - l;
}
- if (flags & 0x80) {
+ if (flags & 0x800) {
int t = r1.top;
int b = r1.bottom;
r1.top = srch - b;
@@ -1506,12 +1505,12 @@
}
int h = r1.height();
int w = r1.width();
- dst += r2.top * dstw;
+ dst += r2.left + 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[i] = palPtr[col];
}
}
dst += dstw;
@@ -1528,7 +1527,7 @@
uint16 off;
int color;
- dstPtr = dst;
+ dstPtr = dst + dstRect.left + dstRect.top * dstPitch;
dataPtr = src;
// Skip over the first 'srcRect->top' lines in the data
@@ -1536,10 +1535,10 @@
while (h--) {
dataPtr += READ_LE_UINT16(dataPtr) + 2;
}
- h = srcRect.bottom - srcRect.top;
+ h = srcRect.height();
if (h <= 0)
return;
- w = srcRect.right - srcRect.left;
+ w = srcRect.width();
if (w <= 0)
return;
@@ -1625,6 +1624,61 @@
}
}
+uint8 Gdi::getWizPixelColor_type0(const uint8 *data, int x, int y, int w, int h, uint8 color) {
+ uint8 c;
+ if (x >= 0 && x < w && y >= 0 && y < h) {
+ c = *(data + y * w + x);
+ } else {
+ c = color;
+ }
+ return c;
+}
+
+uint8 Gdi::getWizPixelColor_type1(const uint8 *data, int x, int y, int w, int h, uint8 color) {
+ uint8 c = color;
+ if (x >= 0 && x < w && y >= 0 && y < h) {
+ while (y != 0) {
+ data += READ_LE_UINT16(data) + 2;
+ --y;
+ }
+ uint16 off = READ_LE_UINT16(data);
+ if (off != 0) {
+ if (x == 0) {
+ c = (*data & 1) ? color : *data;
+ } else {
+ do {
+ uint8 code = *data++;
+ if (code & 1) {
+ code >>= 1;
+ if (code > x) {
+ c = color;
+ break;
+ }
+ x -= code;
+ } else if (code & 2) {
+ code = (code >> 2) + 1;
+ if (code > x) {
+ c = *data;
+ break;
+ }
+ x -= code;
+ ++data;
+ } else {
+ code = (code >> 2) + 1;
+ if (code > x) {
+ c = *(data + x);
+ break;
+ }
+ x -= code;
+ data += code;
+ }
+ } while (x > 0);
+ }
+ }
+ }
+ return c;
+}
+
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)) {
@@ -1648,10 +1702,10 @@
while (h--) {
dataPtr += READ_LE_UINT16(dataPtr) + 2;
}
- h = srcRect.bottom - srcRect.top;
+ h = srcRect.height();
if (h <= 0)
return;
- w = srcRect.right - srcRect.left;
+ w = srcRect.width();
if (w <= 0)
return;
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- gfx.h 13 Nov 2004 04:05:35 -0000 1.94
+++ gfx.h 21 Nov 2004 21:31:28 -0000 1.95
@@ -280,6 +280,8 @@
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);
+ uint8 getWizPixelColor_type0(const uint8 *data, int x, int y, int w, int h, uint8 color);
+ uint8 getWizPixelColor_type1(const uint8 *data, int x, int y, int w, int h, uint8 color);
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);
void copyVirtScreenBuffers(const Common::Rect &rect);
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.314
retrieving revision 2.315
diff -u -d -r2.314 -r2.315
--- intern.h 21 Nov 2004 20:55:56 -0000 2.314
+++ intern.h 21 Nov 2004 21:31:28 -0000 2.315
@@ -875,6 +875,8 @@
void drawWizComplexPolygon(int resnum, int state, int po_x, int po_y, int arg14, int angle, int zoom, const Common::Rect *r);
void displayWizComplexImage(const WizParameters *params);
void processWizImage(const WizParameters *params);
+ int isWizPixelNonTransparent(int restype, int resnum, int state, int x, int y, int flags);
+ uint8 getWizPixelColor(int restype, int resnum, int state, int x, int y, int flags);
/* HE version 90 script opcodes */
void o90_dup();
Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.184
retrieving revision 2.185
diff -u -d -r2.184 -r2.185
--- script_v72he.cpp 13 Nov 2004 04:05:35 -0000 2.184
+++ script_v72he.cpp 21 Nov 2004 21:31:28 -0000 2.185
@@ -1767,13 +1767,15 @@
warning("drawWizImage() unhandled flag 0x2");
// XXX modify 'RMAP' buffer
}
+ if (pwi->flags & 4) {
+ warning("WizImage printing is unimplemented");
+ return NULL;
+ }
uint32 cw, ch;
- if (pwi->flags & 0x24) { // printing (0x4) or rendering to memory (0x20)
+ if (pwi->flags & 0x20) {
dst = (uint8 *)malloc(width * height);
- if (pwi->flags & 0x20) {
- int color = 255; // FIXME: should be (VAR_WIZ_TCOLOR != 0xFF) ? VAR(VAR_WIZ_TCOLOR) : 5;
- memset(dst, color, width * height);
- }
+ int color = 255; // FIXME: should be (VAR_WIZ_TCOLOR != 0xFF) ? VAR(VAR_WIZ_TCOLOR) : 5;
+ memset(dst, color, width * height);
cw = width;
ch = height;
} else {
@@ -1807,11 +1809,8 @@
} else {
warning("unhandled wiz compression type %d", comp);
}
- if (pwi->flags & 4) {
- warning("WizImage printing is unimplemented");
- free(dst);
- dst = NULL;
- } else if (!(pwi->flags & 0x20)) {
+
+ if (!(pwi->flags & 0x20)) {
Common::Rect rImage(pwi->x1, pwi->y1, pwi->x1 + width, pwi->y1 + height);
if (rImage.intersects(rScreen)) {
rImage.clip(rScreen);
Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.109
retrieving revision 2.110
diff -u -d -r2.109 -r2.110
--- script_v90he.cpp 21 Nov 2004 20:55:55 -0000 2.109
+++ script_v90he.cpp 21 Nov 2004 21:31:28 -0000 2.110
@@ -1196,6 +1196,32 @@
}
}
+int ScummEngine_v90he::isWizPixelNonTransparent(int restype, int resnum, int state, int x, int y, int flags) {
+ warning("ScummEngine_v90he::isWizPixelNonTransparent() unimplemented");
+ return 0;
+}
+
+uint8 ScummEngine_v90he::getWizPixelColor(int restype, int resnum, int state, int x, int y, int flags) {
+ uint8 color;
+ const uint8 *data = getResourceAddress(restype, resnum);
+ assert(data);
+ const uint8 *wizh = findWrappedBlock(MKID('WIZH'), data, state, 0);
+ assert(wizh);
+ uint32 c = READ_LE_UINT32(wizh + 0x0);
+ uint32 w = READ_LE_UINT32(wizh + 0x4);
+ uint32 h = READ_LE_UINT32(wizh + 0x8);
+ const uint8 *wizd = findWrappedBlock(MKID('WIZD'), data, state, 0);
+ assert(wizd);
+ if (c == 1) {
+ color = gdi.getWizPixelColor_type1(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+ } else if (c == 0 || c == 2 || c == 3) {
+ color = gdi.getWizPixelColor_type0(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+ } else {
+ color = VAR(VAR_WIZ_TCOLOR);
+ }
+ return color;
+}
+
void ScummEngine_v90he::o90_unknown29() {
int state, resId;
int32 w, h;
@@ -1234,18 +1260,18 @@
push(getWizImageStates(resId));
break;
case 15:
- pop();
- pop();
- pop();
- pop();
- push(0);
+ y = pop();
+ x = pop();
+ state = pop();
+ resId = pop();
+ push(isWizPixelNonTransparent(rtImage, resId, state, x, y, 0));
break;
case 36:
- pop();
- pop();
- pop();
- pop();
- push(0);
+ y = pop();
+ x = pop();
+ state = pop();
+ resId = pop();
+ push(getWizPixelColor(rtImage, resId, state, x, y, 0));
break;
case 100: // SO_GET_WIZ_HISTOGRAM
pop();
More information about the Scummvm-git-logs
mailing list