Skip to content

Commit

Permalink
ACCESS: Implemented copyBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 12, 2014
1 parent eee84b8 commit c0cb03c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 16 deletions.
16 changes: 15 additions & 1 deletion engines/access/access.cpp
Expand Up @@ -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;
Expand All @@ -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
6 changes: 4 additions & 2 deletions engines/access/access.h
Expand Up @@ -134,8 +134,8 @@ class AccessEngine : public Engine {
int _establishGroup;
int _numAnimTimers;
Common::Array<TimerEntry> _timers;
Common::Array<Common::Rect> _newRect;
Common::Array<Common::Rect> _oldRect;
Common::Array<Common::Rect> _newRects;
Common::Array<Common::Rect> _oldRects;
Common::Array<ExtraCell> _extraCells;
Common::Array<ImageEntry> _images;
int _pCount;
Expand Down Expand Up @@ -240,6 +240,8 @@ class AccessEngine : public Engine {

void plotList();
void plotList1();

void copyBlocks();
};

} // End of namespace Access
Expand Down
4 changes: 2 additions & 2 deletions engines/access/amazon/amazon_room.cpp
Expand Up @@ -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() {
Expand Down
11 changes: 11 additions & 0 deletions engines/access/asurface.cpp
Expand Up @@ -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
2 changes: 2 additions & 0 deletions engines/access/asurface.h
Expand Up @@ -62,6 +62,8 @@ class ASurface : public Graphics::Surface {

void plotB(SpriteFrame *frame, const Common::Point &pt);

void copyBlock(ASurface *src, const Common::Rect &bounds);

void copyTo(ASurface *dest, const Common::Point &destPos);
};

Expand Down
10 changes: 5 additions & 5 deletions engines/access/room.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -109,7 +109,7 @@ void Room::doRoom() {

if (_vm->_screen->_scrollFlag) {
_vm->_screen->copyBF1BF2();
_vm->_newRect.clear();
_vm->_newRects.clear();
_function = 0;
roomLoop();

Expand All @@ -124,7 +124,7 @@ void Room::doRoom() {
}
} else {
_vm->_screen->copyBF1BF2();
_vm->_newRect.clear();
_vm->_newRects.clear();
_function = 0;
roomLoop();

Expand All @@ -133,7 +133,7 @@ void Room::doRoom() {
break;
} else {
_vm->plotList();
_vm->_screen->copyBlocks();
_vm->copyBlocks();
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions engines/access/screen.cpp
Expand Up @@ -162,10 +162,6 @@ void Screen::copyBF2Vid() {
warning("TODO");
}

void Screen::copyBlocks() {
warning("TODO: copyBlocks");
}

void Screen::copyRects() {
warning("TODO: copyRects");
}
Expand Down
2 changes: 0 additions & 2 deletions engines/access/screen.h
Expand Up @@ -123,8 +123,6 @@ class Screen: public ASurface {

void copyBF2Vid();

void copyBlocks();

void copyRects();

void setBufferScan();
Expand Down

0 comments on commit c0cb03c

Please sign in to comment.