diff options
author | Paul Gilbert | 2014-08-23 17:19:54 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-23 17:19:54 -0400 |
commit | f98d4668d718b04713ebe9ed2abc41f8bcaed609 (patch) | |
tree | 28857bf2e2b356a293a245bb21142a93a1efeee4 /engines/access | |
parent | ec70f3feaf3f2e81376d0bbb0ab6c11554ef1fbc (diff) | |
download | scummvm-rg350-f98d4668d718b04713ebe9ed2abc41f8bcaed609.tar.gz scummvm-rg350-f98d4668d718b04713ebe9ed2abc41f8bcaed609.tar.bz2 scummvm-rg350-f98d4668d718b04713ebe9ed2abc41f8bcaed609.zip |
ACCESS: Improvements for horizontal scrolling
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/asurface.cpp | 20 | ||||
-rw-r--r-- | engines/access/asurface.h | 8 | ||||
-rw-r--r-- | engines/access/player.cpp | 51 | ||||
-rw-r--r-- | engines/access/screen.cpp | 12 | ||||
-rw-r--r-- | engines/access/screen.h | 6 |
5 files changed, 53 insertions, 44 deletions
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index e88bd27c91..138978f9d9 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -324,4 +324,24 @@ void ASurface::flipHorizontal(ASurface &dest) { } +void ASurface::moveBufferLeft() { + byte *p = (byte *)getPixels(); + Common::copy(p + TILE_WIDTH, p + (w * h), p); +} + +void ASurface::moveBufferRight() { + byte *p = (byte *)getPixels(); + Common::copy_backward(p, p + (w * h) - TILE_WIDTH, p + (w * h)); +} + +void ASurface::moveBufferUp() { + byte *p = (byte *)getPixels(); + Common::copy(p + w, p + (w * h), p); +} + +void ASurface::moveBufferDown() { + byte *p = (byte *)getPixels(); + Common::copy_backward(p, p + (w * (h - 1)), p + (w * h)); +} + } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 84fe90dbbd..62e292334d 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -97,6 +97,14 @@ public: void restoreBlock(); void drawRect(); + + void moveBufferLeft(); + + void moveBufferRight(); + + void moveBufferUp(); + + void moveBufferDown(); }; class SpriteFrame : public ASurface { diff --git a/engines/access/player.cpp b/engines/access/player.cpp index 4be24f4253..7df277c3a0 100644 --- a/engines/access/player.cpp +++ b/engines/access/player.cpp @@ -738,7 +738,7 @@ bool Player::scrollUp() { while (_vm->_screen->_scrollY >= TILE_HEIGHT && !_vm->shouldQuit()) { _vm->_screen->_scrollY -= TILE_HEIGHT; ++_vm->_screen->_scrollRow; - _vm->_screen->moveBufferUp(); + _vm->_buffer1.moveBufferUp(); _vm->_room->buildRow(_vm->_screen->_scrollRow + _vm->_screen->_vWindowHeight, _vm->_screen->_vWindowLinesTall * _vm->_screen->_bufferBytesWide); @@ -766,7 +766,7 @@ bool Player::scrollDown() { if (--_vm->_screen->_scrollRow < 0) break; - _vm->_screen->moveBufferDown(); + _vm->_buffer1.moveBufferDown(); _vm->_room->buildRow(_vm->_screen->_scrollRow, 0); if (_vm->_screen->_scrollY >= 0) @@ -780,28 +780,29 @@ bool Player::scrollDown() { } bool Player::scrollLeft() { - _scrollAmount = -(_vm->_screen->_clipWidth - _playerX - _scrollThreshold); - if ((_vm->_rScrollCol + _vm->_screen->_vWindowWidth) == _vm->_room->_playFieldWidth) { + Screen &screen = *_vm->_screen; + _scrollAmount = -(screen._clipWidth - _playerX - _scrollThreshold); + if ((_vm->_rScrollCol + screen._vWindowWidth) == _vm->_room->_playFieldWidth) { _scrollEnd = 2; - _vm->_screen->_scrollX = 0; + screen._scrollX = 0; _scrollFlag = true; return true; } else { _scrollFlag = true; - _vm->_screen->_scrollX = _vm->_screen->_scrollX + _scrollAmount; + screen._scrollX = screen._scrollX + _scrollAmount; - while (_vm->_screen->_scrollX >= TILE_WIDTH && !_vm->shouldQuit()) { - _vm->_screen->_scrollX -= TILE_WIDTH; - ++_vm->_screen->_scrollCol; - _vm->_screen->moveBufferLeft(); - _vm->_room->buildColumn(_vm->_screen->_scrollCol + - _vm->_screen->_vWindowWidth, _vm->_screen->_vWindowBytesWide); + do { + if (screen._scrollX < TILE_WIDTH) + return true; - if (_vm->_screen->_scrollX < TILE_WIDTH) - return _playerDirection == UPRIGHT; - } + screen._scrollX -= TILE_WIDTH; + ++screen._scrollCol; + _vm->_buffer1.moveBufferLeft(); + _vm->_room->buildColumn(screen._scrollCol + screen._vWindowWidth, + screen._vWindowBytesWide); + } while (!_vm->shouldQuit() && (screen._scrollX >= TILE_WIDTH)); - return true; + return (_playerDirection == UPRIGHT); } } @@ -811,18 +812,16 @@ bool Player::scrollRight() { _vm->_screen->_scrollX -= _scrollAmount; if (_vm->_screen->_scrollX < 0) { - _scrollFlag = true; - _vm->_screen->_scrollX += _scrollAmount; + do { + _vm->_screen->_scrollX += TILE_WIDTH; + if (--_vm->_screen->_scrollCol < 0) + return true; - while (_vm->_screen->_scrollX >= TILE_WIDTH && !_vm->shouldQuit()) { - _vm->_screen->_scrollX -= TILE_WIDTH; - _vm->_screen->moveBufferLeft(); - _vm->_room->buildColumn(_vm->_screen->_scrollCol - - _vm->_screen->_vWindowWidth, _vm->_screen->_vWindowBytesWide); + _vm->_buffer1.moveBufferRight(); + _vm->_room->buildColumn(_vm->_screen->_scrollCol, 0); + } while (!_vm->shouldQuit() && (_vm->_screen->_scrollX >= 0)); - if (_vm->_screen->_scrollX < TILE_WIDTH) - return _playerDirection == UPLEFT; - } + return false; } return true; diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index f62c2f5baf..57002c0f7c 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -224,18 +224,6 @@ void Screen::restoreScreen() { _screenYOff = _screenSave._screenYOff; } -void Screen::moveBufferLeft() { - error("TODO: LEFT"); -} - -void Screen::moveBufferDown() { - error("TODO: DOWN"); -} - -void Screen::moveBufferUp() { - error("TODO: UP"); -} - void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) { Common::Rect destBounds = bounds; destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff); diff --git a/engines/access/screen.h b/engines/access/screen.h index 5ffba5ad3e..3935f2c149 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -149,12 +149,6 @@ public: * Restores previously saved screen display state variables */ void restoreScreen(); - - void moveBufferLeft(); - - void moveBufferDown(); - - void moveBufferUp(); }; } // End of namespace Access |