From 8c0b0c012007d938ab500c5ccc64f6e0cbcf13e0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 17 Sep 2006 20:22:47 +0000 Subject: Changed ScummEngine::gdi to _gdi and allocate the Gdi object on the heap (i.e. _gdi is a pointer now) svn-id: r23921 --- engines/scumm/actor.cpp | 18 ++++----- engines/scumm/bomp.cpp | 4 +- engines/scumm/camera.cpp | 4 +- engines/scumm/charset.cpp | 2 +- engines/scumm/cursor.cpp | 6 +-- engines/scumm/gfx.cpp | 72 ++++++++++++++++++------------------ engines/scumm/he/animation_he.cpp | 2 +- engines/scumm/he/floodfill_he.cpp | 2 +- engines/scumm/he/script_v100he.cpp | 2 +- engines/scumm/he/script_v72he.cpp | 2 +- engines/scumm/he/sprite_he.cpp | 10 ++--- engines/scumm/he/wiz_he.cpp | 4 +- engines/scumm/object.cpp | 10 ++--- engines/scumm/room.cpp | 4 +- engines/scumm/saveload.cpp | 12 +++--- engines/scumm/script_v8.cpp | 4 +- engines/scumm/scumm.cpp | 6 ++- engines/scumm/scumm.h | 2 +- engines/scumm/smush/smush_player.cpp | 6 +-- engines/scumm/verbs.cpp | 6 +-- 20 files changed, 91 insertions(+), 87 deletions(-) diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 809adceb07..eb2e46893d 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1153,8 +1153,8 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_zbuf = _forceClip; if (bcr->_zbuf == 100) { bcr->_zbuf = _vm->getMaskFromBox(_walkbox); - if (bcr->_zbuf > _vm->gdi._numZBuffer-1) - bcr->_zbuf = _vm->gdi._numZBuffer-1; + if (bcr->_zbuf > _vm->_gdi->_numZBuffer-1) + bcr->_zbuf = _vm->_gdi->_numZBuffer-1; } } else { @@ -1164,8 +1164,8 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_zbuf = 0; else { bcr->_zbuf = _vm->getMaskFromBox(_walkbox); - if (bcr->_zbuf > _vm->gdi._numZBuffer-1) - bcr->_zbuf = _vm->gdi._numZBuffer-1; + if (bcr->_zbuf > _vm->_gdi->_numZBuffer-1) + bcr->_zbuf = _vm->_gdi->_numZBuffer-1; } } @@ -1194,7 +1194,7 @@ void Actor::drawActorCostume(bool hitTestMode) { _heNoTalkAnimation = 0; // If the actor is partially hidden, redraw it next frame. - if (bcr->drawCostume(_vm->virtscr[0], _vm->gdi._numStrips, this, _drawToBackBuf) & 1) { + if (bcr->drawCostume(_vm->virtscr[0], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) { _needRedraw = (_vm->_game.version <= 6); } @@ -1293,7 +1293,7 @@ void ScummEngine::setActorRedrawFlags() { _actors[j]._needRedraw = true; } } else { - for (i = 0; i < gdi._numStrips; i++) { + for (i = 0; i < _gdi->_numStrips; i++) { int strip = _screenStartStrip + i; if (testGfxAnyUsageBits(strip)) { for (j = 1; j < _numActors; j++) { @@ -1309,7 +1309,7 @@ void ScummEngine::setActorRedrawFlags() { void ScummEngine::resetActorBgs() { int i, j; - for (i = 0; i < gdi._numStrips; i++) { + for (i = 0; i < _gdi->_numStrips; i++) { int strip = _screenStartStrip + i; clearGfxUsageBit(strip, USAGE_BIT_DIRTY); clearGfxUsageBit(strip, USAGE_BIT_RESTORED); @@ -1321,7 +1321,7 @@ void ScummEngine::resetActorBgs() { ((_actors[j]._top != 0x7fffffff && _actors[j]._needRedraw) || _actors[j]._needBgReset)) { clearGfxUsageBit(strip, j); if ((_actors[j]._bottom - _actors[j]._top) >= 0) - gdi.resetBackground(_actors[j]._top, _actors[j]._bottom, i); + _gdi->resetBackground(_actors[j]._top, _actors[j]._bottom, i); } } } @@ -2095,7 +2095,7 @@ void ScummEngine_v71he::preProcessAuxQueue() { for (int i = 0; i < _auxBlocksNum; ++i) { AuxBlock *ab = &_auxBlocks[i]; if (ab->r.top <= ab->r.bottom) { - gdi.copyVirtScreenBuffers(ab->r); + _gdi->copyVirtScreenBuffers(ab->r); } } } diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp index f3f78e4731..bb7333d9bb 100644 --- a/engines/scumm/bomp.cpp +++ b/engines/scumm/bomp.cpp @@ -241,7 +241,7 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) { // Mask against any additionally imposed mask if (bd.maskPtr) { - mask = bd.maskPtr + (bd.y * gdi._numStrips) + ((bd.x + clip.left) / 8); + mask = bd.maskPtr + (bd.y * _gdi->_numStrips) + ((bd.x + clip.left) / 8); } // Setup vertical scaling @@ -326,7 +326,7 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) { // Advance to the next line pos_y++; - mask += gdi._numStrips; + mask += _gdi->_numStrips; dst += bd.dst.pitch; } } diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index 45df41d20c..219cf40980 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -186,8 +186,8 @@ void ScummEngine::cameraMoved() { } } - _screenStartStrip = camera._cur.x / 8 - gdi._numStrips / 2; - _screenEndStrip = _screenStartStrip + gdi._numStrips - 1; + _screenStartStrip = camera._cur.x / 8 - _gdi->_numStrips / 2; + _screenEndStrip = _screenStartStrip + _gdi->_numStrips - 1; _screenTop = camera._cur.y - (_screenHeight / 2); if (_game.features & GF_NEW_CAMERA) { diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index b4cba89460..164e84ae65 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1429,7 +1429,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { if (_blitAlso && vs->hasTwoBuffers) { Common::Rect dst(_left, _top, _left + origWidth, _top + origHeight); - _vm->gdi.copyVirtScreenBuffers(dst); + _vm->_gdi->copyVirtScreenBuffers(dst); } #endif } else { diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 7a7e36fcca..63967871f0 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -257,10 +257,10 @@ void ScummEngine_v6::useIm01Cursor(const byte *im, int w, int h) { drawBox(0, 0, w - 1, h - 1, 0xFF); vs->hasTwoBuffers = false; - gdi.disableZBuffer(); - gdi.drawBitmap(im, vs, _screenStartStrip, 0, w, h, 0, w / 8, 0); + _gdi->disableZBuffer(); + _gdi->drawBitmap(im, vs, _screenStartStrip, 0, w, h, 0, w / 8, 0); vs->hasTwoBuffers = true; - gdi.enableZBuffer(); + _gdi->enableZBuffer(); // Grab the data we just drew and setup the cursor with it setCursorFromBuffer(vs->getPixels(0, 0), w, h, vs->pitch); diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 14ee5db0c9..2c615ba3e7 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -290,7 +290,7 @@ void ScummEngine::initScreens(int b, int h) { _screenB = b; _screenH = h; - gdi.init(); + _gdi->init(); } void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int height, bool twobufs, @@ -399,12 +399,12 @@ void ScummEngine::markRectAsDirty(VirtScreenNumber virt, int left, int right, in lp = left / 8; rp = right / 8; - if ((lp >= gdi._numStrips) || (rp < 0)) + if ((lp >= _gdi->_numStrips) || (rp < 0)) return; if (lp < 0) lp = 0; - if (rp >= gdi._numStrips) - rp = gdi._numStrips - 1; + if (rp >= _gdi->_numStrips) + rp = _gdi->_numStrips - 1; while (lp <= rp) { if (top < vs->tdirty[lp]) @@ -485,13 +485,13 @@ void ScummEngine::updateDirtyScreen(VirtScreenNumber slot) { int w = 8; int start = 0; - for (i = 0; i < gdi._numStrips; i++) { + for (i = 0; i < _gdi->_numStrips; i++) { if (vs->bdirty[i]) { const int top = vs->tdirty[i]; const int bottom = vs->bdirty[i]; vs->tdirty[i] = vs->h; vs->bdirty[i] = 0; - if (i != (gdi._numStrips - 1) && vs->bdirty[i + 1] == bottom && vs->tdirty[i + 1] == top) { + if (i != (_gdi->_numStrips - 1) && vs->bdirty[i + 1] == bottom && vs->tdirty[i + 1] == top) { // Simple optimizations: if two or more neighbouring strips // form one bigger rectangle, coalesce them. w += 8; @@ -708,49 +708,49 @@ void ScummEngine::initBGBuffers(int height) { room = getResourceAddress(rtRoom, _roomResource); if (_game.version <= 3) { - gdi._numZBuffer = 2; + _gdi->_numZBuffer = 2; } else if (_game.features & GF_SMALL_HEADER) { int off; ptr = findResourceData(MKID_BE('SMAP'), room); - gdi._numZBuffer = 0; + _gdi->_numZBuffer = 0; if (_game.features & GF_16COLOR) off = READ_LE_UINT16(ptr); else off = READ_LE_UINT32(ptr); - while (off && gdi._numZBuffer < 4) { - gdi._numZBuffer++; + while (off && _gdi->_numZBuffer < 4) { + _gdi->_numZBuffer++; ptr += off; off = READ_LE_UINT16(ptr); } } else if (_game.version == 8) { // in V8 there is no RMIH and num z buffers is in RMHD ptr = findResource(MKID_BE('RMHD'), room); - gdi._numZBuffer = READ_LE_UINT32(ptr + 24) + 1; + _gdi->_numZBuffer = READ_LE_UINT32(ptr + 24) + 1; } else if (_game.heversion >= 70) { ptr = findResource(MKID_BE('RMIH'), room); - gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1; + _gdi->_numZBuffer = READ_LE_UINT16(ptr + 8) + 1; } else { ptr = findResource(MKID_BE('RMIH'), findResource(MKID_BE('RMIM'), room)); - gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1; + _gdi->_numZBuffer = READ_LE_UINT16(ptr + 8) + 1; } - assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 8); + assert(_gdi->_numZBuffer >= 1 && _gdi->_numZBuffer <= 8); if (_game.version >= 7) - itemsize = (_roomHeight + 10) * gdi._numStrips; + itemsize = (_roomHeight + 10) * _gdi->_numStrips; else - itemsize = (_roomHeight + 4) * gdi._numStrips; + itemsize = (_roomHeight + 4) * _gdi->_numStrips; - size = itemsize * gdi._numZBuffer; + size = itemsize * _gdi->_numZBuffer; memset(res.createResource(rtBuffer, 9, size), 0, size); - for (i = 0; i < (int)ARRAYSIZE(gdi._imgBufOffs); i++) { - if (i < gdi._numZBuffer) - gdi._imgBufOffs[i] = i * itemsize; + for (i = 0; i < (int)ARRAYSIZE(_gdi->_imgBufOffs); i++) { + if (i < _gdi->_numZBuffer) + _gdi->_imgBufOffs[i] = i * itemsize; else - gdi._imgBufOffs[i] = (gdi._numZBuffer - 1) * itemsize; + _gdi->_imgBufOffs[i] = (_gdi->_numZBuffer - 1) * itemsize; } } @@ -769,7 +769,7 @@ void ScummEngine::redrawBGAreas() { // Redraw parts of the background which are marked as dirty. if (!_fullRedraw && _bgNeedsRedraw) { - for (i = 0; i != gdi._numStrips; i++) { + for (i = 0; i != _gdi->_numStrips; i++) { if (testGfxUsageBit(_screenStartStrip + i, USAGE_BIT_DIRTY)) { redrawBGStrip(i, 1); } @@ -778,12 +778,12 @@ void ScummEngine::redrawBGAreas() { if (_game.features & GF_NEW_CAMERA) { diff = camera._cur.x / 8 - camera._last.x / 8; - if (_fullRedraw || ABS(diff) >= gdi._numStrips) { + if (_fullRedraw || ABS(diff) >= _gdi->_numStrips) { _bgNeedsRedraw = false; - redrawBGStrip(0, gdi._numStrips); + redrawBGStrip(0, _gdi->_numStrips); } else if (diff > 0) { val = -diff; - redrawBGStrip(gdi._numStrips - diff, diff); + redrawBGStrip(_gdi->_numStrips - diff, diff); } else if (diff < 0) { val = -diff; redrawBGStrip(0, -diff); @@ -792,7 +792,7 @@ void ScummEngine::redrawBGAreas() { diff = camera._cur.x - camera._last.x; if (!_fullRedraw && diff == 8) { val = -1; - redrawBGStrip(gdi._numStrips - 1, 1); + redrawBGStrip(_gdi->_numStrips - 1, 1); } else if (!_fullRedraw && diff == -8) { val = +1; redrawBGStrip(0, 1); @@ -801,7 +801,7 @@ void ScummEngine::redrawBGAreas() { ((ScummEngine_v5 *)this)->clearFlashlight(); } _bgNeedsRedraw = false; - redrawBGStrip(0, gdi._numStrips); + redrawBGStrip(0, _gdi->_numStrips); } } @@ -817,7 +817,7 @@ void ScummEngine_v71he::redrawBGAreas() { byte *room = getResourceAddress(rtRoomImage, _roomResource) + _IM00_offs; if (_fullRedraw) { _bgNeedsRedraw = false; - gdi.drawBMAPBg(room, &virtscr[0]); + _gdi->drawBMAPBg(room, &virtscr[0]); } drawRoomObjects(0); @@ -843,7 +843,7 @@ void ScummEngine::redrawBGStrip(int start, int num) { else room = getResourceAddress(rtRoom, _roomResource); - gdi.drawBitmap(room + _IM00_offs, &virtscr[0], s, 0, _roomWidth, virtscr[0].h, s, num, 0); + _gdi->drawBitmap(room + _IM00_offs, &virtscr[0], s, 0, _roomWidth, virtscr[0].h, s, num, 0); } void ScummEngine::restoreBG(Common::Rect rect, byte backColor) { @@ -928,7 +928,7 @@ void CharsetRenderer::restoreCharsetBg() { } void CharsetRenderer::clearCharsetMask() { - memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]); + memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->_gdi->_imgBufOffs[1]); } void CharsetRenderer::clearTextSurface() { @@ -936,7 +936,7 @@ void CharsetRenderer::clearTextSurface() { } byte *ScummEngine::getMaskBuffer(int x, int y, int z) { - return gdi.getMaskBuffer((x + virtscr[0].xstart) / 8, y, z); + return _gdi->getMaskBuffer((x + virtscr[0].xstart) / 8, y, z); } byte *Gdi::getMaskBuffer(int x, int y, int z) { @@ -1171,8 +1171,8 @@ void ScummEngine_v5::drawFlashlight() { // Clip the flashlight at the borders if (_flashlight.x < 0) _flashlight.x = 0; - else if (_flashlight.x + _flashlight.w > gdi._numStrips * 8) - _flashlight.x = gdi._numStrips * 8 - _flashlight.w; + else if (_flashlight.x + _flashlight.w > _gdi->_numStrips * 8) + _flashlight.x = _gdi->_numStrips * 8 - _flashlight.w; if (_flashlight.y < 0) _flashlight.y = 0; else if (_flashlight.y + _flashlight.h> vs->h) @@ -1180,7 +1180,7 @@ void ScummEngine_v5::drawFlashlight() { // Redraw any actors "under" the flashlight for (i = _flashlight.x / 8; i < (_flashlight.x + _flashlight.w) / 8; i++) { - assert(0 <= i && i < gdi._numStrips); + assert(0 <= i && i < _gdi->_numStrips); setGfxUsageBit(_screenStartStrip + i, USAGE_BIT_DIRTY); vs->tdirty[i] = 0; vs->bdirty[i] = vs->h; @@ -3139,14 +3139,14 @@ void ScummEngine::transitionEffect(int a) { if (t == b) { while (l <= r) { - if (l >= 0 && l < gdi._numStrips && t < bottom) { + if (l >= 0 && l < _gdi->_numStrips && t < bottom) { virtscr[0].tdirty[l] = _screenTop + t * 8; virtscr[0].bdirty[l] = _screenTop + (b + 1) * 8; } l++; } } else { - if (l < 0 || l >= gdi._numStrips || b <= t) + if (l < 0 || l >= _gdi->_numStrips || b <= t) continue; if (b > bottom) b = bottom; diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 23d1231e97..76184633e1 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -93,7 +93,7 @@ void MoviePlayer::handleNextFrame() { copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, _vm->_screenWidth); Common::Rect imageRect(_width, _height); - _vm->gdi.copyVirtScreenBuffers(imageRect); + _vm->_gdi->copyVirtScreenBuffers(imageRect); } else { copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, _vm->_screenWidth); diff --git a/engines/scumm/he/floodfill_he.cpp b/engines/scumm/he/floodfill_he.cpp index 5a1ede852a..f4a3cc7998 100644 --- a/engines/scumm/he/floodfill_he.cpp +++ b/engines/scumm/he/floodfill_he.cpp @@ -220,7 +220,7 @@ void floodFill(FloodFillParameters *ffp, ScummEngine_v90he *vm) { if (r.left <= r.right && r.top <= r.bottom) { if (ffp->flags & 0x8000) { - vm->gdi.copyVirtScreenBuffers(r); + vm->_gdi->copyVirtScreenBuffers(r); } else { ++r.bottom; vm->markRectAsDirty(kMainVirtScreen, r); diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 6d4b84883d..6efa7d612a 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -2151,7 +2151,7 @@ void ScummEngine_v100he::o100_systemOps() { debug(0, "Start executable (%s)", string); break; case 75: - gdi.copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); + _gdi->copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); updatePalette(); break; default: diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index e4bfad4b0d..dfc8b89151 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1528,7 +1528,7 @@ void ScummEngine_v72he::o72_systemOps() { clearDrawObjectQueue(); break; case 26: // HE80+ - gdi.copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); + _gdi->copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); updatePalette(); break; case 158: diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp index a86305d2b9..40b05e2f68 100644 --- a/engines/scumm/he/sprite_he.cpp +++ b/engines/scumm/he/sprite_he.cpp @@ -1066,7 +1066,7 @@ void Sprite::resetTables(bool refreshScreen) { resetGroup(curGrp); if (refreshScreen) { - _vm->gdi.copyVirtScreenBuffers(Common::Rect(_vm->_screenWidth, _vm->_screenHeight)); + _vm->_gdi->copyVirtScreenBuffers(Common::Rect(_vm->_screenWidth, _vm->_screenHeight)); } _numSpritesToProcess = 0; } @@ -1084,7 +1084,7 @@ void Sprite::resetBackground() { spi->flags &= ~kSFChanged; if (spi->bbox.left <= spi->bbox.right && spi->bbox.top <= spi->bbox.bottom) { if (spi->flags & kSFBlitDirectly) { - _vm->gdi.copyVirtScreenBuffers(spi->bbox, USAGE_BIT_RESTORED); + _vm->_gdi->copyVirtScreenBuffers(spi->bbox, USAGE_BIT_RESTORED); } else if (firstLoop) { xmin = spi->bbox.left; ymin = spi->bbox.top; @@ -1113,7 +1113,7 @@ void Sprite::resetBackground() { } } if (refreshScreen) { - _vm->gdi.copyVirtScreenBuffers(Common::Rect(xmin, ymin, xmax, ymax), USAGE_BIT_RESTORED); + _vm->_gdi->copyVirtScreenBuffers(Common::Rect(xmin, ymin, xmax, ymax), USAGE_BIT_RESTORED); } } @@ -1125,10 +1125,10 @@ void Sprite::setRedrawFlags(bool checkZOrder) { if ((!checkZOrder || spi->priority >= 0) && (spi->flags & kSFMarkDirty)) { int32 lp = spi->bbox.left / 8; lp = MAX((int32)0, lp); - lp = MIN(lp, _vm->gdi._numStrips); + lp = MIN(lp, _vm->_gdi->_numStrips); int32 rp = (spi->bbox.right + 7) / 8; rp = MAX((int32)0, rp); - rp = MIN(rp, _vm->gdi._numStrips); + rp = MIN(rp, _vm->_gdi->_numStrips); for (; lp < rp; lp++) { if (vs->tdirty[lp] < vs->h && spi->bbox.bottom >= vs->tdirty[lp] && spi->bbox.top <= vs->bdirty[lp]) { spi->flags |= kSFNeedRedraw; diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 74414fc2cc..f2c60223d8 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -1226,7 +1226,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int ++rImage.bottom; _vm->markRectAsDirty(kMainVirtScreen, rImage); } else { - _vm->gdi.copyVirtScreenBuffers(rImage); + _vm->_gdi->copyVirtScreenBuffers(rImage); } } } @@ -1485,7 +1485,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int if (flags & kWIFMarkBufferDirty) { _vm->markRectAsDirty(kMainVirtScreen, bound); } else { - _vm->gdi.copyVirtScreenBuffers(bound); + _vm->_gdi->copyVirtScreenBuffers(bound); } free(srcWizBuf); diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 4cb8122a4f..39dd978fa0 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -475,9 +475,9 @@ void ScummEngine::drawObject(int obj, int arg) { flags |= Gdi::dbDrawMaskOnAll; if (_game.heversion >= 70 && findResource(MKID_BE('SMAP'), ptr) == NULL) - gdi.drawBMAPObject(ptr, &virtscr[0], obj, od.x_pos, od.y_pos, od.width, od.height); + _gdi->drawBMAPObject(ptr, &virtscr[0], obj, od.x_pos, od.y_pos, od.width, od.height); else - gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width * 8, height, x - xpos, numstrip, flags); + _gdi->drawBitmap(ptr, &virtscr[0], x, ypos, width * 8, height, x - xpos, numstrip, flags); } } @@ -1705,10 +1705,10 @@ void ScummEngine_v6::removeBlastObject(BlastObject *eo) { if (left_strip < 0) left_strip = 0; - if (right_strip > gdi._numStrips - 1) - right_strip = gdi._numStrips - 1; + if (right_strip > _gdi->_numStrips - 1) + right_strip = _gdi->_numStrips - 1; for (i = left_strip; i <= right_strip; i++) - gdi.resetBackground(r.top, r.bottom, i); + _gdi->resetBackground(r.top, r.bottom, i); markRectAsDirty(kMainVirtScreen, r, USAGE_BIT_RESTORED); } diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index fa76d7c882..0fa4ebea51 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -440,7 +440,7 @@ void ScummEngine::setupRoomSubBlocks() { putClass(182, kObjectClassUntouchable, 0); } - gdi.roomChanged(roomptr, _IM00_offs, trans); + _gdi->roomChanged(roomptr, _IM00_offs, trans); } /** @@ -694,7 +694,7 @@ void ScummEngine_v3old::setupRoomSubBlocks() { } } - gdi.roomChanged(roomptr, _IM00_offs, 255); + _gdi->roomChanged(roomptr, _IM00_offs, 255); } void ScummEngine_v3old::resetRoomSubBlocks() { diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index b75728248b..459823a8ff 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -712,7 +712,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { MKLINE(ScummEngine, _userPut, sleByte, VER(8)), MKLINE(ScummEngine, _userState, sleUint16, VER(17)), MKLINE(ScummEngine, _cursor.state, sleByte, VER(8)), - MK_OBSOLETE(ScummEngine, gdi._cursorActive, sleByte, VER(8), VER(20)), + MK_OBSOLETE(ScummEngine, _gdi->_cursorActive, sleByte, VER(8), VER(20)), MKLINE(ScummEngine, _currentCursor, sleByte, VER(8)), MKARRAY(ScummEngine, _grabbedCursor[0], sleByte, 8192, VER(20)), MKLINE(ScummEngine, _cursor.width, sleInt16, VER(20)), @@ -741,7 +741,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { MKARRAY_OLD(ScummEngine, gfxUsageBits[0], sleUint32, 410, VER(10), VER(13)), MKARRAY(ScummEngine, gfxUsageBits[0], sleUint32, 3 * 410, VER(14)), - MK_OBSOLETE(ScummEngine, gdi._transparentColor, sleByte, VER(8), VER(50)), + MK_OBSOLETE(ScummEngine, _gdi->_transparentColor, sleByte, VER(8), VER(50)), MKARRAY(ScummEngine, _currentPalette[0], sleByte, 768, VER(8)), MKARRAY(ScummEngine, _darkenPalette[0], sleByte, 768, VER(53)), @@ -752,13 +752,13 @@ void ScummEngine::saveOrLoad(Serializer *s) { MKLINE(ScummEngine, _egoPositioned, sleByte, VER(8)), - // gdi._imgBufOffs grew from 4 to 5 entries. Then one day we realized + // _gdi->_imgBufOffs grew from 4 to 5 entries. Then one day we realized // that we don't have to store it since initBGBuffers() recomputes it. - MK_OBSOLETE_ARRAY(ScummEngine, gdi._imgBufOffs[0], sleUint16, 4, VER(8), VER(9)), - MK_OBSOLETE_ARRAY(ScummEngine, gdi._imgBufOffs[0], sleUint16, 5, VER(10), VER(26)), + MK_OBSOLETE_ARRAY(ScummEngine, _gdi->_imgBufOffs[0], sleUint16, 4, VER(8), VER(9)), + MK_OBSOLETE_ARRAY(ScummEngine, _gdi->_imgBufOffs[0], sleUint16, 5, VER(10), VER(26)), // See _imgBufOffs: _numZBuffer is recomputed by initBGBuffers(). - MK_OBSOLETE(ScummEngine, gdi._numZBuffer, sleByte, VER(8), VER(26)), + MK_OBSOLETE(ScummEngine, _gdi->_numZBuffer, sleByte, VER(8), VER(26)), MKLINE(ScummEngine, _screenEffectFlag, sleByte, VER(8)), diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index 6bce0c7a93..3d6e30f8c7 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -1419,8 +1419,8 @@ void ScummEngine_v8::o8_getActorZPlane() { int z = a->_forceClip; if (z == 100) { z = getMaskFromBox(a->_walkbox); - if (z > gdi._numZBuffer - 1) - z = gdi._numZBuffer - 1; + if (z > _gdi->_numZBuffer - 1) + z = _gdi->_numZBuffer - 1; } push(z); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7da88fe5e6..56fecdfe16 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -84,10 +84,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _language(dr.language), _debugger(0), _currentScript(0xFF), // Let debug() work on init stage - gdi(this), res(this), _pauseDialog(0), _mainMenuDialog(0), _versionDialog(0) { + _gdi = new Gdi(this); + //_res = new ResourceManager(this); + // Copy MD5 checksum memcpy(_gameMD5, dr.md5sum, 16); @@ -702,6 +704,8 @@ ScummEngine::~ScummEngine() { free(_herculesBuf); delete _debugger; + + delete _gdi; } ScummEngine_v5::ScummEngine_v5(OSystem *syst, const DetectorResult &dr) diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 36aa285a5a..0980b10535 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -443,7 +443,7 @@ public: Common::RandomSource _rnd; /** Graphics manager */ - Gdi gdi; + Gdi *_gdi; /** Central resource data. */ ResourceManager res; diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 8b22e42867..1c4ab0e732 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -296,9 +296,9 @@ void SmushPlayer::init() { // width and pitch to be equal, this will require lots of changes. So // we resort to this hackish solution for now. _origPitch = _vm->virtscr[0].pitch; - _origNumStrips = _vm->gdi._numStrips; + _origNumStrips = _vm->_gdi->_numStrips; _vm->virtscr[0].pitch = _vm->virtscr[0].w; - _vm->gdi._numStrips = _vm->virtscr[0].w / 8; + _vm->_gdi->_numStrips = _vm->virtscr[0].w / 8; _vm->_smixer->stop(); @@ -348,7 +348,7 @@ void SmushPlayer::release() { // HACK HACK HACK: This is an *evil* trick, beware! See above for // some explanation. _vm->virtscr[0].pitch = _origPitch; - _vm->gdi._numStrips = _origNumStrips; + _vm->_gdi->_numStrips = _origNumStrips; _initDone = false; } diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 9eb8e64859..a93cc83354 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -815,7 +815,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { if ((vs = findVirtScreen(y)) == NULL) return; - gdi.disableZBuffer(); + _gdi->disableZBuffer(); twobufs = vs->hasTwoBuffers; vs->hasTwoBuffers = false; @@ -849,7 +849,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { assert(imptr); for (i = 0; i < imgw; i++) { tmp = xstrip + i; - gdi.drawBitmap(imptr, vs, tmp, ydiff, imgw * 8, imgh * 8, i, 1, Gdi::dbAllowMaskOr | Gdi::dbObjectMode); + _gdi->drawBitmap(imptr, vs, tmp, ydiff, imgw * 8, imgh * 8, i, 1, Gdi::dbAllowMaskOr | Gdi::dbObjectMode); } vst = &_verbs[verb]; @@ -857,7 +857,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { vst->curRect.bottom = vst->curRect.top + imgh * 8; vst->oldRect = vst->curRect; - gdi.enableZBuffer(); + _gdi->enableZBuffer(); vs->hasTwoBuffers = twobufs; } -- cgit v1.2.3