ACCESS: Workaround for background rendering bug in original

This commit is contained in:
Paul Gilbert 2014-11-01 14:13:29 -04:00
parent 386aae3ffa
commit 21c1d0f920

View File

@ -289,14 +289,16 @@ void Room::setWallCodes() {
void Room::buildScreen() {
int scrollCol = _vm->_screen->_scrollCol;
int cnt = _vm->_screen->_vWindowWidth + 1;
int offset = 0;
// Clear current background buffer
_vm->_buffer1.clearBuffer();
// WORKAROUND: Original's use of '+ 1' would frequently cause memory overruns
int w = MIN(_vm->_screen->_vWindowWidth + 1, _playFieldWidth);
// Loop through drawing each column of tiles forming the background
for (int idx = 0; idx < cnt; offset += TILE_WIDTH, ++idx) {
for (int idx = 0; idx < w; offset += TILE_WIDTH, ++idx) {
buildColumn(_vm->_screen->_scrollCol, offset);
++_vm->_screen->_scrollCol;
}