From 0cccbb29d63a03582b7c3cd89265296a46530414 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 8 Sep 2007 11:15:27 +0000 Subject: Some cleanup (yay for whomever had the brilliant idea to let SVN work over HTTPS and hence through proxies&firewalls :) svn-id: r28877 --- engines/scumm/actor.cpp | 6 ++-- engines/scumm/akos.cpp | 8 ++--- engines/scumm/base-costume.cpp | 4 +-- engines/scumm/camera.cpp | 2 +- engines/scumm/charset.cpp | 2 +- engines/scumm/cursor.cpp | 2 +- engines/scumm/debugger.cpp | 2 +- engines/scumm/gfx.cpp | 59 ++++++++++++++++++------------------ engines/scumm/gfx.h | 2 +- engines/scumm/he/animation_he.cpp | 2 +- engines/scumm/he/floodfill_he.cpp | 2 +- engines/scumm/he/script_v60he.cpp | 4 +-- engines/scumm/he/sprite_he.cpp | 2 +- engines/scumm/he/wiz_he.cpp | 6 ++-- engines/scumm/input.cpp | 7 +++-- engines/scumm/object.cpp | 8 ++--- engines/scumm/saveload.cpp | 2 +- engines/scumm/script_v0.cpp | 10 +++--- engines/scumm/script_v2.cpp | 22 +++++++------- engines/scumm/script_v5.cpp | 4 +-- engines/scumm/script_v6.cpp | 2 +- engines/scumm/scumm.cpp | 4 +-- engines/scumm/scumm.h | 3 +- engines/scumm/smush/smush_player.cpp | 12 +++++--- engines/scumm/string.cpp | 4 +-- engines/scumm/verbs.cpp | 12 ++++---- 26 files changed, 98 insertions(+), 95 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 187a45b836..bf8e85bb99 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1446,7 +1446,7 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_actorX *= V12_X_MULTIPLIER; bcr->_actorY *= V12_Y_MULTIPLIER; } - bcr->_actorX -= _vm->virtscr[0].xstart; + bcr->_actorX -= _vm->_virtscr[kMainVirtScreen].xstart; if (_vm->_game.platform == Common::kPlatformNES) { // In the NES version, when the actor is facing right, @@ -1532,7 +1532,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[kMainVirtScreen], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) { _needRedraw = (_vm->_game.version <= 6); } @@ -2325,7 +2325,7 @@ void ScummEngine_v71he::postProcessAuxQueue() { int y = (int16)READ_LE_UINT16(axfd + 4) + dy; int w = (int16)READ_LE_UINT16(axfd + 6); int h = (int16)READ_LE_UINT16(axfd + 8); - VirtScreen *pvs = &virtscr[kMainVirtScreen]; + VirtScreen *pvs = &_virtscr[kMainVirtScreen]; uint8 *dst1 = pvs->getPixels(0, pvs->topline); uint8 *dst2 = pvs->getBackPixels(0, pvs->topline); switch (comp) { diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 88cc864ba1..86a19540d6 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -546,7 +546,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) { scaleytab = &v1.scaletable[v1.scaleYindex]; maskbit = revBitMask(v1.x & 7); - mask = _vm->getMaskBuffer(v1.x - (_vm->virtscr[0].xstart & 7), v1.y, _zbuf); + mask = _vm->getMaskBuffer(v1.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), v1.y, _zbuf); if (len) goto StartPos; @@ -610,7 +610,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) { skip_column = true; v1.scaleXindex += v1.scaleXstep; dst = v1.destptr; - mask = _vm->getMaskBuffer(v1.x - (_vm->virtscr[0].xstart & 7), v1.y, _zbuf); + mask = _vm->getMaskBuffer(v1.x - (_vm->_virtscr[kMainVirtScreen].xstart & 7), v1.y, _zbuf); } StartPos:; } while (--len); @@ -982,8 +982,8 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } void AkosRenderer::markRectAsDirty(Common::Rect rect) { - rect.left -= _vm->virtscr[0].xstart & 7; - rect.right -= _vm->virtscr[0].xstart & 7; + rect.left -= _vm->_virtscr[kMainVirtScreen].xstart & 7; + rect.right -= _vm->_virtscr[kMainVirtScreen].xstart & 7; _vm->markRectAsDirty(kMainVirtScreen, rect, _actorID); } diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index 8886dbfcd4..fe87dc65ec 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -39,9 +39,9 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const else _out.pixels = vs.getPixels(0, 0); - _actorX += _vm->virtscr[0].xstart & 7; + _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _out.w = _out.pitch; - _out.pixels = (byte *)_out.pixels - (_vm->virtscr[0].xstart & 7); + _out.pixels = (byte *)_out.pixels - (_vm->_virtscr[kMainVirtScreen].xstart & 7); _numStrips = numStrips; diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index d6ecc715ea..ea6ac9b528 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -199,7 +199,7 @@ void ScummEngine::cameraMoved() { screenLeft = _screenStartStrip * 8; } - virtscr[0].xstart = screenLeft; + _virtscr[kMainVirtScreen].xstart = screenLeft; } void ScummEngine::panCameraTo(int x, int y) { diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index c3f1d132f0..b90bba6526 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1758,7 +1758,7 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) { int drawTop = _top; if (ignoreCharsetMask) { - VirtScreen *vs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; s = *vs; s.pixels = vs->getPixels(0, 0); } else { diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 23657946c6..b8b2cbcb6d 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -236,7 +236,7 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { } void ScummEngine_v6::useIm01Cursor(const byte *im, int w, int h) { - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; byte *buf, *dst; const byte *src; int i; diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 83ba9e24c1..68a001c983 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -652,7 +652,7 @@ static int gfxPrimitivesCompareInt(const void *a, const void *b); static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) { - VirtScreen *vs = &scumm->virtscr[0]; + VirtScreen *vs = &scumm->_virtscr[kMainVirtScreen]; byte *ptr; // Clip y diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 28c77dcafb..8d111492a2 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -51,6 +51,7 @@ static void copy8Col(byte *dst, int dstPitch, const byte *src, int height); static void clear8Col(byte *dst, int dstPitch, int height); static void ditherHerc(byte *src, byte *hercbuf, int srcPitch, int *x, int *y, int *width, int *height); +static void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h); struct StripTable { int offsets[160]; @@ -318,7 +319,7 @@ void ScummEngine::initScreens(int b, int h) { void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int height, bool twobufs, bool scrollable) { - VirtScreen *vs = &virtscr[slot]; + VirtScreen *vs = &_virtscr[slot]; int size; assert(height >= 0); @@ -374,7 +375,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int } VirtScreen *ScummEngine::findVirtScreen(int y) { - VirtScreen *vs = virtscr; + VirtScreen *vs = _virtscr; int i; for (i = 0; i < 3; i++, vs++) { @@ -386,7 +387,7 @@ VirtScreen *ScummEngine::findVirtScreen(int y) { } void ScummEngine::markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit) { - VirtScreen *vs = &virtscr[virt]; + VirtScreen *vs = &_virtscr[virt]; int lp, rp; if (left > right || top > bottom) @@ -452,7 +453,7 @@ void ScummEngine::drawDirtyScreenParts() { // Update game area ("stage") if (camera._last.x != camera._cur.x || (_game.version >= 7 && (camera._cur.y != camera._last.y))) { // Camera moved: redraw everything - VirtScreen *vs = &virtscr[kMainVirtScreen]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; drawStripToScreen(vs, 0, vs->w, 0, vs->h); vs->setDirtyRange(vs->h, 0); } else { @@ -497,7 +498,7 @@ void ScummEngine_v6::drawDirtyScreenParts() { * a full blit is done, otherwise only the visible dirty areas are updated. */ void ScummEngine::updateDirtyScreen(VirtScreenNumber slot) { - VirtScreen *vs = &virtscr[slot]; + VirtScreen *vs = &_virtscr[slot]; // Do nothing for unused virtual screens if (vs->h == 0) @@ -741,7 +742,7 @@ void ditherHerc(byte *src, byte *hercbuf, int srcPitch, int *x, int *y, int *wid *height = dsty - *y; } -void ScummEngine::scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h) { +void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h) { byte *dstL1 = dst; byte *dstL2 = dst + dstPitch; @@ -775,7 +776,7 @@ void ScummEngine::initBGBuffers(int height) { // Resize main virtual screen in V7 games. This is necessary // because in V7, rooms may be higher than one screen, so we have // to accomodate for that. - initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, true, true); + initVirtScreen(kMainVirtScreen, _virtscr[kMainVirtScreen].topline, _screenWidth, height, true, true); } if (_game.heversion >= 70) @@ -899,7 +900,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[kMainVirtScreen]); } drawRoomObjects(0); @@ -925,7 +926,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[kMainVirtScreen], s, 0, _roomWidth, _virtscr[kMainVirtScreen].h, s, num, 0); } void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) { @@ -983,7 +984,7 @@ void ScummEngine::restoreCharsetBg() { // restoreBackground(), but was changed to only restore those parts which are // currently covered by the charset mask. - VirtScreen *vs = &virtscr[_charset->_textScreenID]; + VirtScreen *vs = &_virtscr[_charset->_textScreenID]; if (!vs->h) return; @@ -1018,7 +1019,7 @@ void ScummEngine::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[kMainVirtScreen].xstart) / 8, y, z); } byte *Gdi::getMaskBuffer(int x, int y, int z) { @@ -1219,7 +1220,7 @@ void ScummEngine_v5::clearFlashlight() { void ScummEngine_v5::drawFlashlight() { int i, j, x, y; - VirtScreen *vs = &virtscr[kMainVirtScreen]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; // Remove the flash light first if it was previously drawn if (_flashlight.isDrawn) { @@ -1919,7 +1920,7 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, if (code == 8 || code == 9) { Common::Rect rScreen(0, 0, vs->w, vs->h); - byte *dst = (byte *)_vm->virtscr[0].backBuf + scrX; + byte *dst = (byte *)_vm->_virtscr[kMainVirtScreen].backBuf + scrX; Wiz::copyWizImage(dst, bmap_ptr, vs->w, vs->h, x - scrX, y, w, h, &rScreen); } @@ -1939,7 +1940,7 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) { byte *src, *dst; - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; if (rect.top > vs->h || rect.bottom < 0) return; @@ -1965,12 +1966,12 @@ void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) { if (rw == 0 || rh == 0) return; - src = virtscr[0].getBackPixels(rect.left, rect.top); - dst = virtscr[0].getPixels(rect.left, rect.top); + src = _virtscr[kMainVirtScreen].getBackPixels(rect.left, rect.top); + dst = _virtscr[kMainVirtScreen].getPixels(rect.left, rect.top); assert(rw <= _screenWidth && rw > 0); assert(rh <= _screenHeight && rh > 0); - blit(dst, virtscr[0].pitch, src, virtscr[0].pitch, rw, rh); + blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh); markRectAsDirty(kMainVirtScreen, rect, dirtybit); } #endif @@ -1979,7 +1980,7 @@ void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) { * Reset the background behind an actor or blast object. */ void Gdi::resetBackground(int top, int bottom, int strip) { - VirtScreen *vs = &_vm->virtscr[0]; + VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; byte *backbuff_ptr, *bgbak_ptr; int numLinesToProcess; @@ -3158,7 +3159,7 @@ void ScummEngine::fadeIn(int effect) { // that broke the FOA intro. Probably other things as well. // // Hopefully it's safe to do it at this point, at least. - virtscr[0].setDirtyRange(0, 0); + _virtscr[kMainVirtScreen].setDirtyRange(0, 0); transitionEffect(effect - 1); break; case 128: @@ -3176,7 +3177,7 @@ void ScummEngine::fadeIn(int effect) { dissolveEffect(1, 1); break; case 135: - dissolveEffect(1, virtscr[0].h); + dissolveEffect(1, _virtscr[kMainVirtScreen].h); break; default: error("Unknown screen effect, %d", effect); @@ -3185,7 +3186,7 @@ void ScummEngine::fadeIn(int effect) { } void ScummEngine::fadeOut(int effect) { - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; vs->setDirtyRange(0, 0); if (_game.version < 7) @@ -3222,7 +3223,7 @@ void ScummEngine::fadeOut(int effect) { dissolveEffect(1, 1); break; case 135: - dissolveEffect(1, virtscr[0].h); + dissolveEffect(1, _virtscr[kMainVirtScreen].h); break; default: error("fadeOut: default case %d", effect); @@ -3252,7 +3253,7 @@ void ScummEngine::transitionEffect(int a) { int i, j; int bottom; int l, t, r, b; - const int height = MIN((int)virtscr[0].h, _screenHeight); + const int height = MIN((int)_virtscr[kMainVirtScreen].h, _screenHeight); const int delay = (VAR_FADE_DELAY != 0xFF) ? VAR(VAR_FADE_DELAY) * kFadeDelay : kPictureDelay; for (i = 0; i < 16; i++) { @@ -3274,8 +3275,8 @@ void ScummEngine::transitionEffect(int a) { if (t == b) { while (l <= r) { if (l >= 0 && l < _gdi->_numStrips && t < bottom) { - virtscr[0].tdirty[l] = _screenTop + t * 8; - virtscr[0].bdirty[l] = _screenTop + (b + 1) * 8; + _virtscr[kMainVirtScreen].tdirty[l] = _screenTop + t * 8; + _virtscr[kMainVirtScreen].bdirty[l] = _screenTop + (b + 1) * 8; } l++; } @@ -3286,8 +3287,8 @@ void ScummEngine::transitionEffect(int a) { b = bottom; if (t < 0) t = 0; - virtscr[0].tdirty[l] = _screenTop + t * 8; - virtscr[0].bdirty[l] = _screenTop + (b + 1) * 8; + _virtscr[kMainVirtScreen].tdirty[l] = _screenTop + t * 8; + _virtscr[kMainVirtScreen].bdirty[l] = _screenTop + (b + 1) * 8; } updateDirtyScreen(kMainVirtScreen); } @@ -3310,7 +3311,7 @@ void ScummEngine::transitionEffect(int a) { * dissolveEffect(virtsrc[0].width, 1) produces a line-by-line dissolve */ void ScummEngine::dissolveEffect(int width, int height) { - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; int *offsets; int blits_before_refresh, blits; int x, y; @@ -3419,7 +3420,7 @@ void ScummEngine::dissolveEffect(int width, int height) { } void ScummEngine::scrollEffect(int dir) { - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; int x, y; int step; diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h index fb8da562c8..4e92fad0fd 100644 --- a/engines/scumm/gfx.h +++ b/engines/scumm/gfx.h @@ -84,7 +84,7 @@ enum VirtScreenNumber { struct VirtScreen : Graphics::Surface { /** * The unique id of this screen (corresponds to its position in the - * ScummEngine:virtscr array). + * ScummEngine:_virtscr array). */ VirtScreenNumber number; diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 3bc2f3e5d7..3c7d742ba2 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -89,7 +89,7 @@ void MoviePlayer::handleNextFrame() { return; } - VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; decodeNextFrame(); diff --git a/engines/scumm/he/floodfill_he.cpp b/engines/scumm/he/floodfill_he.cpp index 1fdd11fce8..ea2043d69f 100644 --- a/engines/scumm/he/floodfill_he.cpp +++ b/engines/scumm/he/floodfill_he.cpp @@ -179,7 +179,7 @@ skip: void floodFill(FloodFillParameters *ffp, ScummEngine_v90he *vm) { uint8 *dst; - VirtScreen *vs = &vm->virtscr[kMainVirtScreen]; + VirtScreen *vs = &vm->_virtscr[kMainVirtScreen]; if (ffp->flags & 0x8000) { dst = vs->getBackPixels(0, vs->topline); } else { diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index baee2f3e49..0b9c94fe18 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -801,7 +801,7 @@ void ScummEngine_v60he::o60_kernelSetFunctions() { void ScummEngine_v60he::virtScreenLoad(int resIdx, int x1, int y1, int x2, int y2) { vsUnpackCtx ctx; memset(&ctx, 0, sizeof(ctx)); - VirtScreen &vs = virtscr[kMainVirtScreen]; + VirtScreen &vs = _virtscr[kMainVirtScreen]; ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, resIdx); virtScreenLoadUnpack(&ctx, ah->data); @@ -875,7 +875,7 @@ void ScummEngine_v60he::o60_kernelGetFunctions() { int ScummEngine_v60he::virtScreenSave(byte *dst, int x1, int y1, int x2, int y2) { int packedSize = 0; - VirtScreen &vs = virtscr[kMainVirtScreen]; + VirtScreen &vs = _virtscr[kMainVirtScreen]; for (int j = y1; j <= y2; ++j) { uint8 *p = vs.getBackPixels(x1, j - vs.topline); diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp index 8e6f3ce4c2..15698dedba 100644 --- a/engines/scumm/he/sprite_he.cpp +++ b/engines/scumm/he/sprite_he.cpp @@ -1120,7 +1120,7 @@ void Sprite::resetBackground() { } void Sprite::setRedrawFlags(bool checkZOrder) { - VirtScreen *vs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; for (int i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (!(spi->flags & kSFNeedRedraw)) { diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 549e4480f6..a99f3b1ad5 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -1009,7 +1009,7 @@ static int wizPackType0(uint8 *dst, const uint8 *src, int srcPitch, const Common void Wiz::captureWizImage(int resNum, const Common::Rect& r, bool backBuffer, int compType) { debug(5, "ScummEngine_v72he::captureWizImage(%d, %d, [%d,%d,%d,%d])", resNum, compType, r.left, r.top, r.right, r.bottom); uint8 *src = NULL; - VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; if (backBuffer) { src = pvs->getBackPixels(0, 0); } else { @@ -1182,7 +1182,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int assert(dst); getWizImageDim(dstResNum, 0, cw, ch); } else { - VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; if (flags & kWIFMarkBufferDirty) { dst = pvs->getPixels(0, pvs->topline); } else { @@ -1377,7 +1377,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int if (srcWizBuf) { uint8 *dst; int32 dstw, dsth, dstpitch, wizW, wizH; - VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen]; + VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; int transColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : 5; if (dstResNum) { diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 6647e9fe8d..94fafc78de 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -249,14 +249,15 @@ void ScummEngine::processInput() { if (_mouse.y > _screenHeight-1) _mouse.y = _screenHeight-1; - _virtualMouse.x = _mouse.x + virtscr[0].xstart; - _virtualMouse.y = _mouse.y - virtscr[0].topline; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; + _virtualMouse.x = _mouse.x + vs->xstart; + _virtualMouse.y = _mouse.y - vs->topline; if (_game.version >= 7) _virtualMouse.y += _screenTop; if (_virtualMouse.y < 0) _virtualMouse.y = -1; - if (_virtualMouse.y >= virtscr[0].h) + if (_virtualMouse.y >= vs->h) _virtualMouse.y = -1; // diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index a88c56bc5a..2644a2faf8 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -619,10 +619,10 @@ void ScummEngine::drawObject(int obj, int arg) { #ifndef DISABLE_HE 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[kMainVirtScreen], obj, od.x_pos, od.y_pos, od.width, od.height); else #endif - _gdi->drawBitmap(ptr, &virtscr[0], x, ypos, width * 8, height, x - xpos, numstrip, flags); + _gdi->drawBitmap(ptr, &_virtscr[kMainVirtScreen], x, ypos, width * 8, height, x - xpos, numstrip, flags); } } @@ -1626,7 +1626,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { int objnum; BompDrawData bdd; - vs = &virtscr[0]; + vs = &_virtscr[kMainVirtScreen]; assertRange(30, eo->number, _numGlobalObjects - 1, "blast object"); @@ -1704,7 +1704,7 @@ void ScummEngine_v6::removeBlastObjects() { } void ScummEngine_v6::removeBlastObject(BlastObject *eo) { - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; Common::Rect r; int left_strip, right_strip; diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 9d0d0ad654..4e8d670403 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -344,7 +344,7 @@ bool ScummEngine::loadState(int slot, bool compat) { // Restore the virtual screens and force a fade to black. initScreens(0, _screenHeight); - VirtScreen *vs = &virtscr[kMainVirtScreen]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; memset(vs->getPixels(0, 0), 0, vs->pitch * vs->h); vs->setDirtyRange(0, vs->h); updateDirtyScreen(kMainVirtScreen); diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index 62e5cee03b..143e926604 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -527,9 +527,9 @@ void ScummEngine_v0::drawSentence() { } _string[2].charset = 1; - _string[2].ypos = virtscr[kVerbVirtScreen].topline; + _string[2].ypos = _virtscr[kVerbVirtScreen].topline; _string[2].xpos = 0; - _string[2].right = virtscr[kVerbVirtScreen].w - 1; + _string[2].right = _virtscr[kVerbVirtScreen].w - 1; _string[2].color = 16; byte string[80]; @@ -550,10 +550,10 @@ void ScummEngine_v0::drawSentence() { } string[i] = 0; - sentenceline.top = virtscr[kVerbVirtScreen].topline; - sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 8; + sentenceline.top = _virtscr[kVerbVirtScreen].topline; + sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8; sentenceline.left = 0; - sentenceline.right = virtscr[kVerbVirtScreen].w - 1; + sentenceline.right = _virtscr[kVerbVirtScreen].w - 1; restoreBackground(sentenceline); drawString(2, (byte*)string); diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index 767d9495cc..532acc98a3 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -1053,9 +1053,9 @@ void ScummEngine_v2::o2_drawSentence() { } _string[2].charset = 1; - _string[2].ypos = virtscr[kVerbVirtScreen].topline; + _string[2].ypos = _virtscr[kVerbVirtScreen].topline; _string[2].xpos = 0; - _string[2].right = virtscr[kVerbVirtScreen].w - 1; + _string[2].right = _virtscr[kVerbVirtScreen].w - 1; if (_game.platform == Common::kPlatformNES) { _string[2].xpos = 16; _string[2].color = 0; @@ -1087,15 +1087,15 @@ void ScummEngine_v2::o2_drawSentence() { string[i] = 0; if (_game.platform == Common::kPlatformNES) { - sentenceline.top = virtscr[kVerbVirtScreen].topline; - sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 16; + sentenceline.top = _virtscr[kVerbVirtScreen].topline; + sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 16; sentenceline.left = 16; - sentenceline.right = virtscr[kVerbVirtScreen].w - 1; + sentenceline.right = _virtscr[kVerbVirtScreen].w - 1; } else { - sentenceline.top = virtscr[kVerbVirtScreen].topline; - sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 8; + sentenceline.top = _virtscr[kVerbVirtScreen].topline; + sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8; sentenceline.left = 0; - sentenceline.right = virtscr[kVerbVirtScreen].w - 1; + sentenceline.right = _virtscr[kVerbVirtScreen].w - 1; } restoreBackground(sentenceline); @@ -1590,9 +1590,9 @@ void ScummEngine_v2::setUserState(byte state) { // Hide all verbs and inventory Common::Rect rect; - rect.top = virtscr[kVerbVirtScreen].topline; - rect.bottom = virtscr[kVerbVirtScreen].topline + 8 * 88; - rect.right = virtscr[kVerbVirtScreen].w - 1; + rect.top = _virtscr[kVerbVirtScreen].topline; + rect.bottom = _virtscr[kVerbVirtScreen].topline + 8 * 88; + rect.right = _virtscr[kVerbVirtScreen].w - 1; if (_game.platform == Common::kPlatformNES) { rect.left = 16; } else { diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index c4f7937aa4..3cd71bac08 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -2929,8 +2929,8 @@ void ScummEngine_v5::o5_oldRoomEffect() { // For now, we force a redraw of the screen background. This // way the Zak end credits seem to work mostly correct. - VirtScreen *vs = &virtscr[0]; - restoreBackground(Common::Rect(0,vs->topline, vs->w, vs->topline + vs->h)); + VirtScreen *vs = &_virtscr[kMainVirtScreen]; + restoreBackground(Common::Rect(0, vs->topline, vs->w, vs->topline + vs->h)); vs->setDirtyRange(0, vs->h); updateDirtyScreen(kMainVirtScreen); diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 7e0d705377..e436489f25 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -2715,7 +2715,7 @@ void ScummEngine_v6::o6_kernelGetFunctions() { int i; int slot; Actor *a; - VirtScreen *vs = &virtscr[0]; + VirtScreen *vs = &_virtscr[kMainVirtScreen]; getStackList(args, ARRAYSIZE(args)); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index cafa060a7d..60911a97dd 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -228,7 +228,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _roomWidth = 0; _screenHeight = 0; _screenWidth = 0; - memset(virtscr, 0, sizeof(virtscr)); + memset(_virtscr, 0, sizeof(_virtscr)); memset(&camera, 0, sizeof(CameraData)); memset(_colorCycle, 0, sizeof(_colorCycle)); memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle)); @@ -1377,7 +1377,7 @@ void ScummEngine::resetScumm() { } camera._follows = 0; - virtscr[0].xstart = 0; + _virtscr[0].xstart = 0; _mouse.x = 104; _mouse.y = 56; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 18c2275029..2a155c7e02 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -917,7 +917,7 @@ protected: public: int _roomHeight, _roomWidth; int _screenHeight, _screenWidth; - VirtScreen virtscr[4]; // Virtual screen areas + VirtScreen _virtscr[4]; // Virtual screen areas CameraData camera; // 'Camera' - viewport int _screenStartStrip, _screenEndStrip; @@ -1031,7 +1031,6 @@ protected: void updateDirtyScreen(VirtScreenNumber slot); void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b); void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const; - void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h); public: VirtScreen *findVirtScreen(int y); diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index ce39302e25..612f2771db 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -265,6 +265,8 @@ SmushPlayer::~SmushPlayer() { } void SmushPlayer::init(int32 speed) { + VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; + _frame = 0; _speed = speed; _endOfFile = false; @@ -273,7 +275,7 @@ void SmushPlayer::init(int32 speed) { _vm->_smushActive = true; _vm->setDirtyColors(0, 255); - _dst = _vm->virtscr[0].getPixels(0, 0); + _dst = vs->getPixels(0, 0); // HACK HACK HACK: This is an *evil* trick, beware! // We do this to fix bug #1037052. A proper solution would change all the @@ -281,10 +283,10 @@ void SmushPlayer::init(int32 speed) { // However, since a lot of the SMUSH code currently assumes the screen // 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; + _origPitch = vs->pitch; _origNumStrips = _vm->_gdi->_numStrips; - _vm->virtscr[0].pitch = _vm->virtscr[0].w; - _vm->_gdi->_numStrips = _vm->virtscr[0].w / 8; + vs->pitch = vs->w; + _vm->_gdi->_numStrips = vs->w / 8; _vm->_mixer->stopHandle(_compressedFileSoundHandle); _vm->_mixer->stopHandle(_IACTchannel); @@ -319,7 +321,7 @@ void SmushPlayer::release() { // HACK HACK HACK: This is an *evil* trick, beware! See above for // some explanation. - _vm->virtscr[0].pitch = _origPitch; + _vm->_virtscr[kMainVirtScreen].pitch = _origPitch; _vm->_gdi->_numStrips = _origNumStrips; delete _codec37; diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 32fdf0e04e..62a29b3013 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -456,7 +456,7 @@ void ScummEngine::CHARSET_1() { if (a && _string[0].overhead) { int s; - _string[0].xpos = a->getPos().x - virtscr[0].xstart; + _string[0].xpos = a->getPos().x - _virtscr[kMainVirtScreen].xstart; _string[0].ypos = a->getPos().y - a->getElevation() - _screenTop; if (_game.version <= 5) { @@ -678,7 +678,7 @@ void ScummEngine_v8::CHARSET_1() { if (a && _string[0].overhead) { int s; - _string[0].xpos = a->getPos().x - virtscr[0].xstart; + _string[0].xpos = a->getPos().x - _virtscr[kMainVirtScreen].xstart; s = a->_scalex * a->_talkPosX / 255; _string[0].xpos += (a->_talkPosX - s) / 2 + s; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 56ee454240..953ed90a1a 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -86,7 +86,7 @@ static const VerbSettings v0VerbTable_German[] = { }; void ScummEngine_v0::resetVerbs() { - VirtScreen *virt = &virtscr[kVerbVirtScreen]; + VirtScreen *virt = &_virtscr[kVerbVirtScreen]; VerbSlot *vs; int i; @@ -121,7 +121,7 @@ void ScummEngine_v0::resetVerbs() { } void ScummEngine_v0::setNewKidVerbs() { - VirtScreen *virt = &virtscr[kVerbVirtScreen]; + VirtScreen *virt = &_virtscr[kVerbVirtScreen]; VerbSlot *vs; int i; @@ -283,7 +283,7 @@ void ScummEngine_v2::initNESMouseOver() { } void ScummEngine_v2::checkV2MouseOver(Common::Point pos) { - VirtScreen *vs = &virtscr[kVerbVirtScreen]; + VirtScreen *vs = &_virtscr[kVerbVirtScreen]; Common::Rect rect; byte *ptr, *dst; int i, x, y, new_box = -1; @@ -346,7 +346,7 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) { int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32; int object = 0; - y -= virtscr[kVerbVirtScreen].topline; + y -= _virtscr[kVerbVirtScreen].topline; if ((y < inventoryArea) || !(_mouseAndKeyboardStat & MBS_LEFT_CLICK)) return; @@ -391,7 +391,7 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) { } void ScummEngine_v2::redrawV2Inventory() { - VirtScreen *vs = &virtscr[kVerbVirtScreen]; + VirtScreen *vs = &_virtscr[kVerbVirtScreen]; int i; int max_inv; Common::Rect inventoryBox; @@ -405,7 +405,7 @@ void ScummEngine_v2::redrawV2Inventory() { // Clear on all invocations inventoryBox.top = vs->topline + inventoryArea; - inventoryBox.bottom = vs->topline + virtscr[kVerbVirtScreen].h; + inventoryBox.bottom = vs->topline + vs->h; inventoryBox.left = 0; inventoryBox.right = vs->w; restoreBackground(inventoryBox); -- cgit v1.2.3