aboutsummaryrefslogtreecommitdiff
path: root/engines/access
diff options
context:
space:
mode:
authorPaul Gilbert2014-11-01 14:13:29 -0400
committerPaul Gilbert2014-12-12 22:19:13 -0500
commit21c1d0f920a530b310a68376e9aa8836ed43471b (patch)
treec0ccf13f26cc19f8adf60ebb9e16f85bc0f64196 /engines/access
parent386aae3ffa60c9ef44181cb730ab947544b2e761 (diff)
downloadscummvm-rg350-21c1d0f920a530b310a68376e9aa8836ed43471b.tar.gz
scummvm-rg350-21c1d0f920a530b310a68376e9aa8836ed43471b.tar.bz2
scummvm-rg350-21c1d0f920a530b310a68376e9aa8836ed43471b.zip
ACCESS: Workaround for background rendering bug in original
Diffstat (limited to 'engines/access')
-rw-r--r--engines/access/room.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 181dcd6c5b..9b830770af 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -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;
}