aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-11-06 08:10:57 +0000
committerJames Brown2002-11-06 08:10:57 +0000
commit173c0eac43706fb2e67c2332156af17f4a457978 (patch)
tree43bb41e1d1ede72ab785cf985706fb78790ece9a
parent5d873255ea078b53c4ee69a1d0038bd1ea0d5989 (diff)
downloadscummvm-rg350-173c0eac43706fb2e67c2332156af17f4a457978.tar.gz
scummvm-rg350-173c0eac43706fb2e67c2332156af17f4a457978.tar.bz2
scummvm-rg350-173c0eac43706fb2e67c2332156af17f4a457978.zip
Apply restore-bg part of patch 629043
svn-id: r5434
-rw-r--r--scumm/gfx.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 288baf279c..df2849c23f 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1762,8 +1762,8 @@ void Scumm::restoreCharsetBg()
void Scumm::restoreBG(int left, int top, int right, int bottom)
{
VirtScreen *vs;
- int topline, height, width, widthmod;
- byte *backbuff, *bgbak, *mask;
+ int topline, height, width;
+ byte *backbuff, *bgbak;
if (left == right || top == bottom)
return;
@@ -1798,21 +1798,25 @@ void Scumm::restoreBG(int left, int top, int right, int bottom)
backbuff = vs->screenPtr + height;
bgbak = getResourceAddress(rtBuffer, vs->number + 5) + height;
- mask = getResourceAddress(rtBuffer, 9) + top * gdi._numStrips + (left >> 3) + _screenStartStrip;
- if (vs->number == 0) {
- // FIXME: hardcoded value
- mask += vs->topline * 216;
- }
height = bottom - top;
width = right - left;
- widthmod = (width >> 2) + 2;
if (vs->alloctwobuffers && _currentRoom != 0 /*&& _vars[VAR_V5_DRAWFLAGS]&2 */ ) {
blit(backbuff, bgbak, width, height);
if (vs->number == 0 && charset._hasMask && height) {
+ byte *mask;
+ int mask_width = (width >> 3);
+
+ if (width & 0x07)
+ mask_width++;
+
+ mask = getResourceAddress(rtBuffer, 9) + top * gdi._numStrips + (left >> 3) + _screenStartStrip;
+ if (vs->number == 0)
+ mask += vs->topline * gdi._numStrips;
+
do {
- memset(mask, 0, widthmod);
+ memset(mask, 0, mask_width);
mask += gdi._numStrips;
} while (--height);
}