From c0cb03cea276832b2d178155786c0418eccfd21d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Aug 2014 08:38:12 -0400 Subject: ACCESS: Implemented copyBlocks --- engines/access/access.cpp | 16 +++++++++++++++- engines/access/access.h | 6 ++++-- engines/access/amazon/amazon_room.cpp | 4 ++-- engines/access/asurface.cpp | 11 +++++++++++ engines/access/asurface.h | 2 ++ engines/access/room.cpp | 10 +++++----- engines/access/screen.cpp | 4 ---- engines/access/screen.h | 2 -- 8 files changed, 39 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 9fb0287883..29e5188fb3 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -276,7 +276,7 @@ void AccessEngine::plotList1() { || _buffer2._topSkip != 0 || _buffer2._bottomSkip != 0) ie._flags |= 1; - _newRect.push_back(bounds); + _newRects.push_back(bounds); if (!_scaleFlag) { _buffer2._rightSkip /= _scale; @@ -298,4 +298,18 @@ void AccessEngine::plotList1() { } } +void AccessEngine::copyBlocks() { + // Copy the block list from the previous frame + for (uint i = 0; i < _oldRects.size(); ++i) { + _screen->copyBlock(&_buffer2, _oldRects[i]); + } + + // Copy the new block list, replacing the old one at the same time + _oldRects.clear(); + for (uint i = 0; i < _newRects.size(); ++i) { + _screen->copyBlock(&_buffer2, _newRects[i]); + _oldRects.push_back(_newRects[i]); + } +} + } // End of namespace Access diff --git a/engines/access/access.h b/engines/access/access.h index 819f7faaa7..3cd98f0c45 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -134,8 +134,8 @@ public: int _establishGroup; int _numAnimTimers; Common::Array _timers; - Common::Array _newRect; - Common::Array _oldRect; + Common::Array _newRects; + Common::Array _oldRects; Common::Array _extraCells; Common::Array _images; int _pCount; @@ -240,6 +240,8 @@ public: void plotList(); void plotList1(); + + void copyBlocks(); }; } // End of namespace Access diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index 5b840afc2e..b8ed0d20de 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -110,8 +110,8 @@ void AmazonRoom::reloadRoom1() { } _vm->_player->_frame = 0; - _vm->_oldRect.clear(); - _vm->_newRect.clear(); + _vm->_oldRects.clear(); + _vm->_newRects.clear(); } void AmazonRoom::roomSet() { diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index fe11612075..5a090afaca 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -231,4 +231,15 @@ void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) { error("TODO"); } +void ASurface::copyBlock(ASurface *src, const Common::Rect &bounds) { + byte *srcP = (byte *)getBasePtr(bounds.left, bounds.top + _scrollY); + byte *destP = (byte *)getBasePtr(bounds.left, bounds.top); /* + _windowYAdd */ + + for (int y = 0; y < bounds.height(); ++y) { + Common::copy(srcP, srcP + bounds.width(), destP); + srcP += src->pitch; + destP += this->pitch; + } +} + } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 99f99ae696..776b9506e9 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -62,6 +62,8 @@ public: void plotB(SpriteFrame *frame, const Common::Point &pt); + void copyBlock(ASurface *src, const Common::Rect &bounds); + void copyTo(ASurface *dest, const Common::Point &destPos); }; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index b39e99815b..ab3592a247 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -65,8 +65,8 @@ void Room::doRoom() { while (!_vm->shouldQuit()) { if (!reloadFlag) { _vm->_numImages = 0; - _vm->_newRect.clear(); - _vm->_oldRect.clear(); + _vm->_newRects.clear(); + _vm->_oldRects.clear(); _vm->_nextImage = 0; _vm->_numAnimTimers = 0; @@ -109,7 +109,7 @@ void Room::doRoom() { if (_vm->_screen->_scrollFlag) { _vm->_screen->copyBF1BF2(); - _vm->_newRect.clear(); + _vm->_newRects.clear(); _function = 0; roomLoop(); @@ -124,7 +124,7 @@ void Room::doRoom() { } } else { _vm->_screen->copyBF1BF2(); - _vm->_newRect.clear(); + _vm->_newRects.clear(); _function = 0; roomLoop(); @@ -133,7 +133,7 @@ void Room::doRoom() { break; } else { _vm->plotList(); - _vm->_screen->copyBlocks(); + _vm->copyBlocks(); } } } diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 2dc86982b7..b47cd3e005 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -162,10 +162,6 @@ void Screen::copyBF2Vid() { warning("TODO"); } -void Screen::copyBlocks() { - warning("TODO: copyBlocks"); -} - void Screen::copyRects() { warning("TODO: copyRects"); } diff --git a/engines/access/screen.h b/engines/access/screen.h index 6c1d96e360..670da8282d 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -123,8 +123,6 @@ public: void copyBF2Vid(); - void copyBlocks(); - void copyRects(); void setBufferScan(); -- cgit v1.2.3