aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-18 20:47:37 -0400
committerPaul Gilbert2016-09-18 20:47:37 -0400
commitffc31b880243f886ef265e9f4b9906328116cdd2 (patch)
tree0552c3aa10a6d99fb5326b34c4721e7e8f13cba5 /engines
parent197e85176e00b59444d0a19297e301048cd8fd93 (diff)
downloadscummvm-rg350-ffc31b880243f886ef265e9f4b9906328116cdd2.tar.gz
scummvm-rg350-ffc31b880243f886ef265e9f4b9906328116cdd2.tar.bz2
scummvm-rg350-ffc31b880243f886ef265e9f4b9906328116cdd2.zip
XEEN: Extra space in sprite line decoding as workaround for bad data
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/sprites.cpp11
-rw-r--r--engines/xeen/sprites.h7
2 files changed, 11 insertions, 7 deletions
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 3758a0f4ad..d0e9f07aee 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -171,10 +171,11 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
// Initialize the array to hold the temporary data for the line. We do this to make it simpler
// to handle both deciding which pixels to draw in a scaled image, as well as when images
- // have been horizontally flipped
- int tempLine[SCREEN_WIDTH];
- Common::fill(&tempLine[0], &tempLine[SCREEN_WIDTH], -1);
- int *lineP = flipped ? &tempLine[width - 1 - xOffset] : &tempLine[xOffset];
+ // have been horizontally flipped. Note that we allocate an extra line for before and after our
+ // work line, just in case the sprite is screwed up and overruns the line
+ int tempLine[SCREEN_WIDTH * 3];
+ Common::fill(&tempLine[SCREEN_WIDTH], &tempLine[SCREEN_WIDTH * 3], -1);
+ int *lineP = flipped ? &tempLine[SCREEN_WIDTH + width - 1 - xOffset] : &tempLine[SCREEN_WIDTH + xOffset];
// Build up the line
int byteCount, opr1, opr2;
@@ -259,7 +260,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
// Handle drawing out the line
byte *destP = (byte *)dest.getBasePtr(destPos.x, destPos.y);
int16 xp = destPos.x;
- lineP = &tempLine[0];
+ lineP = &tempLine[SCREEN_WIDTH];
for (int xCtr = 0; xCtr < width; ++xCtr, ++lineP) {
bit = (scaleMaskX >> 15) & 1;
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index f660daa053..025c8db219 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -35,8 +35,11 @@ namespace Xeen {
class XeenEngine;
class Window;
-enum SpriteFlags { SPRFLAG_SCENE_CLIPPED = 0x2000, SPRFLAG_4000 = 0x4000,
- SPRFLAG_HORIZ_FLIPPED = 0x8000, SPRFLAG_RESIZE = 0x10000 };
+enum SpriteFlags {
+ SPRFLAG_800 = 0x800, SPRFLAG_SCENE_CLIPPED = 0x2000,
+ SPRFLAG_4000 = 0x4000, SPRFLAG_HORIZ_FLIPPED = 0x8000,
+ SPRFLAG_RESIZE = 0x10000
+};
class SpriteResource {
private: