aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2005-05-14 22:55:39 +0000
committerMax Horn2005-05-14 22:55:39 +0000
commit0bb3024467c8eb1f74f716848366b9b8fdf6a8c5 (patch)
tree16fca8847f6ee8dd27f89eeace9771f8fa28ca54 /scumm
parentef8c36554ce9f3990ee1e21455b9ad9602261457 (diff)
downloadscummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.tar.gz
scummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.tar.bz2
scummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.zip
Merge loop limits into one)
svn-id: r18098
Diffstat (limited to 'scumm')
-rw-r--r--scumm/gfx.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 182a90915b..036263afc3 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1414,9 +1414,17 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi
//if (_vm->_NESStartStrip > 0)
// stripnr -= _vm->_NESStartStrip;
- for (int k = 0;
- k < numstrip && sx + k < _numStrips && (x + k) * 8 < MAX(_vm->_roomWidth, (int) vs->w);
- ++k, ++stripnr) {
+ // Compute the number of strips we have to iterate over.
+ // TODO/FIXME: The computation of its initial value looks very fishy.
+ // It was added as a kind of hack to fix some corner cases, but it compares
+ // the room width to the virtual screen width; but the former should always
+ // be bigger than the latter (except for MM NES, maybe)... strange
+ int limit = MAX(_vm->_roomWidth, (int) vs->w) / 8 - x;
+ if (limit > numstrip)
+ limit = numstrip;
+ if (limit > _numStrips - sx)
+ limit = _numStrips - sx;
+ for (int k = 0; k < limit; ++k, ++stripnr) {
CHECK_HEAP;
if (y < vs->tdirty[sx + k])