diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/asurface.cpp | 4 | ||||
-rw-r--r-- | engines/access/room.cpp | 22 |
2 files changed, 23 insertions, 3 deletions
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index dbbf119171..96cb1991be 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -337,12 +337,12 @@ void ASurface::moveBufferRight() { void ASurface::moveBufferUp() { byte *p = (byte *)getPixels(); - Common::copy(p + w, p + (w * h), p); + Common::copy(p + (w * TILE_HEIGHT), p + (w * h), p); } void ASurface::moveBufferDown() { byte *p = (byte *)getPixels(); - Common::copy_backward(p, p + (w * (h - 1)), p + (w * h)); + Common::copy_backward(p, p + (w * (h - TILE_HEIGHT)), p + (w * h)); } } // End of namespace Access diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 37746d1b7c..f32bc95ae0 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -339,7 +339,27 @@ void Room::buildColumn(int playX, int screenX) { } void Room::buildRow(int playY, int screenY) { - error("TODO: buildRow"); + if (playY < 0 || playY >= _playFieldHeight) + return; + assert(screenY <= (_vm->_screen->h - TILE_HEIGHT)); + + const byte *pSrc = _playField + screenY *_playFieldWidth + _vm->_screen->_scrollCol; + + // WORKAROUND: Original's use of '+ 1' would frequently cause memory overruns + int w = MIN(_vm->_screen->_vWindowWidth + 1, _playFieldWidth); + + for (int x = 0; x < w; ++x) { + byte *pTile = _tile + (*pSrc << 8); + byte *pDest = (byte *)_vm->_buffer1.getBasePtr(w * TILE_WIDTH, screenY); + + for (int tileY = 0; tileY < TILE_HEIGHT; ++tileY) { + Common::copy(pTile, pTile + TILE_WIDTH, pDest); + pTile += TILE_WIDTH; + pDest += _vm->_buffer1.pitch; + } + + ++pSrc; + } } void Room::loadPlayField(int fileNum, int subfile) { |