aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-04-13 09:53:51 +0000
committerTorbjörn Andersson2006-04-13 09:53:51 +0000
commit4ee82b0cafffbc57141570894319d60b47acb34d (patch)
treeeb9c76b820688647c67520909c55f087ba05308f
parenta4c5a691cc8ee05c21f5c2f678a730ca525fc9a4 (diff)
downloadscummvm-rg350-4ee82b0cafffbc57141570894319d60b47acb34d.tar.gz
scummvm-rg350-4ee82b0cafffbc57141570894319d60b47acb34d.tar.bz2
scummvm-rg350-4ee82b0cafffbc57141570894319d60b47acb34d.zip
Work around crash in drawSpriteRaw(). In Future Wars, when going to the future,
I walked back to the room where I first arrived. At that point, maskPtr was NULL for reasons yet unknown. svn-id: r21839
-rw-r--r--engines/cine/gfx.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 17b1e4d01d..3c365e6e86 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -324,12 +324,16 @@ void drawSpriteRaw(byte *spritePtr, byte *maskPtr, int16 width, int16 height,
int16 i;
int16 j;
+ // FIXME: Is it a bug if maskPtr == NULL?
+ if (!maskPtr)
+ warning("drawSpriteRaw: maskPtr == NULL");
+
for (i = 0; i < height; i++) {
byte *destPtr = page + x + y * 320;
destPtr += i * 320;
for (j = 0; j < width * 8; j++) {
- if (((gameType == Cine::GID_FW && !(*maskPtr)) || (gameType == Cine::GID_OS)) && (x + j >= 0
+ if (((gameType == Cine::GID_FW && (!maskPtr || !(*maskPtr))) || (gameType == Cine::GID_OS)) && (x + j >= 0
&& x + j < 320 && i + y >= 0 && i + y < 200)) {
*(destPtr++) = *(spritePtr++);
} else {
@@ -337,7 +341,8 @@ void drawSpriteRaw(byte *spritePtr, byte *maskPtr, int16 width, int16 height,
spritePtr++;
}
- maskPtr++;
+ if (maskPtr)
+ maskPtr++;
}
}
}