XEEN: Extra space in sprite line decoding as workaround for bad data

This commit is contained in:
Paul Gilbert 2016-09-18 20:47:37 -04:00
parent 197e85176e
commit ffc31b8802
2 changed files with 11 additions and 7 deletions

View File

@ -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;

View File

@ -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: