ACCESS: Fixes for drawing scrolling scenes

This commit is contained in:
Paul Gilbert 2014-08-22 22:55:17 -04:00
parent e5130bcc6c
commit b4d2484633
5 changed files with 17 additions and 7 deletions

View File

@ -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;
@ -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;
@ -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) {

View File

@ -86,7 +86,7 @@ public:
*/
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);

View File

@ -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;

View File

@ -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

View File

@ -79,6 +79,8 @@ public:
int _bufferBytesWide;
int _vWindowLinesTall;
bool _screenChangeFlag;
public:
virtual void copyBlock(ASurface *src, const Common::Rect &bounds);
public:
Screen(AccessEngine *vm);