Skip to content

Commit

Permalink
ACCESS: Fixes for drawing scrolling scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 23, 2014
1 parent e5130bc commit b4d2484
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
9 changes: 3 additions & 6 deletions engines/access/asurface.cpp
Expand Up @@ -152,7 +152,7 @@ bool ASurface::clip(Common::Rect &r) {
_leftSkip = _rightSkip = 0;
_topSkip = _bottomSkip = 0;

if (r.left > _clipWidth) {
if (r.left > _clipWidth || r.left < 0) {
if (r.left >= 0)
return true;

Expand All @@ -171,7 +171,7 @@ bool ASurface::clip(Common::Rect &r) {
_rightSkip = skip;
}

if (r.top > _clipHeight) {
if (r.top > _clipHeight || r.top < 0) {
if (r.top >= 0)
return true;

Expand Down Expand Up @@ -285,10 +285,7 @@ void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) {
}

void ASurface::copyBlock(ASurface *src, const Common::Rect &bounds) {
Common::Rect destBounds = bounds;
//destBounds.translate(src->_scrollX, src->_scrollY);

copyRectToSurface(*src, destBounds.left, destBounds.top, bounds);
copyRectToSurface(*src, bounds.left, bounds.top, bounds);
}

void ASurface::saveBlock(const Common::Rect &bounds) {
Expand Down
2 changes: 1 addition & 1 deletion engines/access/asurface.h
Expand Up @@ -86,7 +86,7 @@ class ASurface : public Graphics::Surface {
*/
void plotB(SpriteFrame *frame, const Common::Point &pt);

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

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

Expand Down
4 changes: 4 additions & 0 deletions engines/access/room.cpp
Expand Up @@ -296,6 +296,10 @@ void Room::buildScreen() {
int cnt = _vm->_screen->_vWindowWidth + 1;
int offset = 0;

// Clear current background buffer
_vm->_buffer1.clearBuffer();

// Loop through drawing each column of tiles forming the background
for (int idx = 0; idx < cnt; offset += TILE_WIDTH, ++idx) {
buildColumn(_vm->_screen->_scrollCol, offset);
++_vm->_screen->_scrollCol;
Expand Down
7 changes: 7 additions & 0 deletions engines/access/screen.cpp
Expand Up @@ -236,4 +236,11 @@ void Screen::moveBufferUp() {
error("TODO: UP");
}

void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
Common::Rect destBounds = bounds;
destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff);

copyRectToSurface(*src, destBounds.left, destBounds.top, bounds);
}

} // End of namespace Access
2 changes: 2 additions & 0 deletions engines/access/screen.h
Expand Up @@ -79,6 +79,8 @@ class Screen: public ASurface {
int _bufferBytesWide;
int _vWindowLinesTall;
bool _screenChangeFlag;
public:
virtual void copyBlock(ASurface *src, const Common::Rect &bounds);
public:
Screen(AccessEngine *vm);

Expand Down

0 comments on commit b4d2484

Please sign in to comment.