aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2004-10-05 05:52:48 +0000
committerTravis Howell2004-10-05 05:52:48 +0000
commit56ae86ef4fd96807e3fa4c25f89b45ecfa377266 (patch)
treea048cc32eb9398aab5b950542e3ec483cfedfca5 /scumm
parentf1ffeaf3ecebbbb1806645d70b3b745d9da4b7ea (diff)
downloadscummvm-rg350-56ae86ef4fd96807e3fa4c25f89b45ecfa377266.tar.gz
scummvm-rg350-56ae86ef4fd96807e3fa4c25f89b45ecfa377266.tar.bz2
scummvm-rg350-56ae86ef4fd96807e3fa4c25f89b45ecfa377266.zip
HE71+ games use wizImages for charset too.
svn-id: r15417
Diffstat (limited to 'scumm')
-rw-r--r--scumm/akos.cpp4
-rw-r--r--scumm/charset.cpp109
-rw-r--r--scumm/gfx.cpp5
-rw-r--r--scumm/intern.h1
-rw-r--r--scumm/script_v80he.cpp16
-rw-r--r--scumm/script_v90he.cpp2
6 files changed, 91 insertions, 46 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index f6ff91584f..ee416227da 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -1238,7 +1238,9 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
if (_draw_bottom < dst.bottom)
_draw_bottom = dst.bottom;
- _vm->gdi.decompressWizImage(_outptr, _outwidth, dst, _srcptr, src);
+ byte *dstPtr = _outptr + dst.left + dst.top * _outwidth;
+
+ _vm->gdi.decompressWizImage(dstPtr, _outwidth, dst, _srcptr, src);
return 0;
}
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index aed8e66e1c..f9d55c1e79 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -1213,6 +1213,7 @@ void CharsetRendererClassic::printChar(int chr) {
_vm->_charsetColorMap[1] = _color;
+ int charUnk = *_fontPtr;
if (is2byte) {
_dropShadow = true;
charPtr = _vm->get2byteCharPtr(chr);
@@ -1282,7 +1283,7 @@ void CharsetRendererClassic::printChar(int chr) {
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY);
- byte *dst;
+ byte *dstPtr;
byte *back = NULL;
if (!_ignoreCharsetMask) {
@@ -1294,64 +1295,90 @@ void CharsetRendererClassic::printChar(int chr) {
Graphics::Surface backSurface;
if (_ignoreCharsetMask || !vs->hasTwoBuffers) {
dstSurface = *vs;
- dst = vs->getPixels(_left, drawTop);
+ dstPtr = vs->getPixels(_left, drawTop);
} else {
dstSurface = _vm->gdi._textSurface;
- dst = (byte *)_vm->gdi._textSurface.pixels + (_top - _vm->_screenTop) * _vm->gdi._textSurface.pitch + _left;
+ dstPtr = (byte *)_vm->gdi._textSurface.pixels + (_top - _vm->_screenTop) * _vm->gdi._textSurface.pitch + _left;
}
if (_blitAlso && vs->hasTwoBuffers) {
backSurface = dstSurface;
- back = dst;
+ back = dstPtr;
dstSurface = *vs;
- dst = vs->getBackPixels(_left, drawTop);
+ dstPtr = vs->getBackPixels(_left, drawTop);
}
if (!_ignoreCharsetMask && vs->hasTwoBuffers) {
drawTop = _top - _vm->_screenTop;
}
- if (is2byte) {
- drawBits1(dstSurface, dst, charPtr, drawTop, origWidth, origHeight);
- } else {
- drawBitsN(dstSurface, dst, charPtr, *_fontPtr, drawTop, origWidth, origHeight);
- }
+ if (_vm->_heversion >= 71 && charUnk >= 8) {
+ Common::Rect clip, src, dst;
- if (_blitAlso && vs->hasTwoBuffers) {
- // FIXME: Revisiting this code, I think the _blitAlso mode is likely broken
- // right now -- we are copying stuff from "dst" to "back", but "dst" really
- // only conatains charset data...
- // One way to fix this: don't copy etc.; rather simply render the char twice,
- // once to each of the two buffers. That should hypothetically yield
- // identical results, though I didn't try it and right now I don't know
- // any spots where I can test this...
- if (!_ignoreCharsetMask)
- warning("This might be broken -- please report where you encountered this to Fingolfin");
-
- // Perform some clipping
- int w = MIN(width, dstSurface.w - _left);
- int h = MIN(height, dstSurface.h - drawTop);
- if (_left < 0) {
- w += _left;
- back -= _left;
- dst -= _left;
- }
- if (drawTop < 0) {
- h += drawTop;
- back -= drawTop * backSurface.pitch;
- dst -= drawTop * dstSurface.pitch;
+ clip.top = clip.left = 0;
+ clip.right = vs->w - 1;
+ clip.bottom = vs->h - 1;
+
+ dst.left = _left;
+ dst.top = _top;
+ dst.right = dst.left + width;
+ dst.bottom = dst.top + height;
+
+ dst.clip(clip);
+ if ((dst.left >= dst.right) || (dst.top >= dst.bottom))
+ return;
+
+ src = dst;
+ src.moveTo(0, 0);
+
+ _vm->gdi.decompressWizImage(dstPtr, vs->w, dst, charPtr, src);
+
+ if (_blitAlso && vs->hasTwoBuffers)
+ _vm->gdi.copyVirtScreenBuffers(dst);
+
+ } else {
+ if (is2byte) {
+ drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight);
+ } else {
+ drawBitsN(dstSurface, dstPtr, charPtr, *_fontPtr, drawTop, origWidth, origHeight);
}
+
+ if (_blitAlso && vs->hasTwoBuffers) {
+ // FIXME: Revisiting this code, I think the _blitAlso mode is likely broken
+ // right now -- we are copying stuff from "dstPtr" to "back", but "dstPtr" really
+ // only conatains charset data...
+ // One way to fix this: don't copy etc.; rather simply render the char twice,
+ // once to each of the two buffers. That should hypothetically yield
+ // identical results, though I didn't try it and right now I don't know
+ // any spots where I can test this...
+ if (!_ignoreCharsetMask)
+ warning("This might be broken -- please report where you encountered this to Fingolfin");
+
+ // Perform some clipping
+ int w = MIN(width, dstSurface.w - _left);
+ int h = MIN(height, dstSurface.h - drawTop);
+ if (_left < 0) {
+ w += _left;
+ back -= _left;
+ dstPtr -= _left;
+ }
+ if (drawTop < 0) {
+ h += drawTop;
+ back -= drawTop * backSurface.pitch;
+ dstPtr -= drawTop * dstSurface.pitch;
+ }
- // Blit the image data
- if (w > 0) {
- while (h-- > 0) {
- memcpy(back, dst, w);
- back += backSurface.pitch;
- dst += dstSurface.pitch;
+ // Blit the image data
+ if (w > 0) {
+ while (h-- > 0) {
+ memcpy(back, dstPtr, w);
+ back += backSurface.pitch;
+ dstPtr += dstSurface.pitch;
+ }
}
}
- }
-
+ }
+
_left += origWidth;
if (_str.right < _left) {
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 135459c0c5..46fbce1446 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1478,7 +1478,8 @@ void Gdi::copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int src
Common::Rect r1, r2;
if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
if (r1.isValidRect() && r2.isValidRect()) {
- decompressWizImage(dst, dstw, r2, src, r1);
+ uint8 *dstPtr = dst + r2.left + r2.top * dstw;
+ decompressWizImage(dstPtr, dstw, r2, src, r1);
}
}
}
@@ -1491,7 +1492,7 @@ void Gdi::decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRe
int h, w, xoff;
uint16 off;
- dstPtr = dst + dstRect.left + dstRect.top * dstPitch;
+ dstPtr = dst;
dataPtr = src;
// Skip over the first 'srcRect->top' lines in the data
diff --git a/scumm/intern.h b/scumm/intern.h
index 4f85e36624..42519bf78f 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -809,6 +809,7 @@ protected:
void o80_writeConfigFile();
void o80_cursorCommand();
void o80_setState();
+ void o80_drawBox();
void o80_drawWizPolygon();
void o80_unknownE0();
void o80_pickVarRandom();
diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp
index 6b100a14b6..486def2e0f 100644
--- a/scumm/script_v80he.cpp
+++ b/scumm/script_v80he.cpp
@@ -251,7 +251,7 @@ void ScummEngine_v80he::setupOpcodes() {
/* A4 */
OPCODE(o72_arrayOps),
OPCODE(o6_invalid),
- OPCODE(o6_drawBox),
+ OPCODE(o80_drawBox),
OPCODE(o6_pop),
/* A8 */
OPCODE(o6_getActorWidth),
@@ -611,6 +611,20 @@ void ScummEngine_v80he::o80_setState() {
removeObjectFromDrawQue(obj);
}
+void ScummEngine_v80he::o80_drawBox() {
+ int x, y, x2, y2, color;
+ color = pop();
+ y2 = pop();
+ x2 = pop();
+ y = pop();
+ x = pop();
+
+ if (color & 0x8000)
+ color &= 0x7FFF;
+
+ drawBox(x, y, x2, y2, color);
+}
+
void ScummEngine_v80he::o80_drawWizPolygon() {
WizImage wi;
wi.x1 = wi.y1 = pop();
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index 103f4958bb..99aa154c7d 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -251,7 +251,7 @@ void ScummEngine_v90he::setupOpcodes() {
/* A4 */
OPCODE(o72_arrayOps),
OPCODE(o90_unknownA5),
- OPCODE(o6_drawBox),
+ OPCODE(o80_drawBox),
OPCODE(o6_pop),
/* A8 */
OPCODE(o6_getActorWidth),