Skip to content

Commit

Permalink
SCUMM: Fix Loom (and some other graphics regressions).
Browse files Browse the repository at this point in the history
These are regressions from c05cb7f. They were
caused by VirtualScreen::getPixels differing from Surface::getBasePtr and I
accidently used the former in some cases in the conversion.

I also fixed a bug in debugger.cpp which exchanged x and y.
  • Loading branch information
Johannes Schickel committed Aug 4, 2013
1 parent 8fc54d6 commit 6485b29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions engines/scumm/charset.cpp
Expand Up @@ -1242,6 +1242,7 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) {
if (ignoreCharsetMask) {
VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen];
s = *vs;
s.setPixels(vs->getPixels(0, 0));
} else {
s = _vm->_textSurface;
drawTop -= _vm->_screenTop;
Expand Down
2 changes: 1 addition & 1 deletion engines/scumm/debugger.cpp
Expand Up @@ -641,7 +641,7 @@ static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) {
x2 = right - 1;


ptr = (byte *)vs->getBasePtr(y, x1);
ptr = (byte *)vs->getBasePtr(x1, y);

while (x1++ <= x2) {
*ptr++ = color;
Expand Down
10 changes: 5 additions & 5 deletions engines/scumm/gfx.cpp
Expand Up @@ -422,7 +422,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int

_res->createResource(rtBuffer, slot + 1, size);
vs->setPixels(getResourceAddress(rtBuffer, slot + 1));
memset(vs->getPixels(0, 0), 0, size); // reset background
memset(vs->getBasePtr(0, 0), 0, size); // reset background

if (twobufs) {
vs->backBuf = _res->createResource(rtBuffer, slot + 5, size);
Expand Down Expand Up @@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
if (vs->hasTwoBuffers)
dst = vs->backBuf + y * vs->pitch + x * 8;
else
dst = (byte *)vs->getPixels(x * 8, y);
dst = (byte *)vs->getBasePtr(x * 8, y);

mask_ptr = getMaskBuffer(x, y, 1);

Expand Down Expand Up @@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
if (vs->hasTwoBuffers)
dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel);
else
dstPtr = (byte *)vs->getPixels(x * 8, y);
dstPtr = (byte *)vs->getBasePtr(x * 8, y);

transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr);

Expand All @@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
transpStrip = true;

if (vs->hasTwoBuffers) {
byte *frontBuf = (byte *)vs->getPixels(x * 8, y);
byte *frontBuf = (byte *)vs->getBasePtr(x * 8, y);
if (lightsOn)
copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel);
else
Expand Down Expand Up @@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) {
vs->bdirty[strip] = bottom;

bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel;
backbuff_ptr = (byte *)vs->getPixels((strip + vs->xstart/8) * 8, top);
backbuff_ptr = (byte *)vs->getBasePtr((strip + vs->xstart/8) * 8, top);

numLinesToProcess = bottom - top;
if (numLinesToProcess) {
Expand Down

0 comments on commit 6485b29

Please sign in to comment.