aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/msurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads/msurface.cpp')
-rw-r--r--engines/mads/msurface.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index cc12442db1..702b9e5f08 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -400,14 +400,16 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
const byte *srcP = srcPixelsP;
byte *destP = destPixelsP;
- for (int xp = 0, sprX = 0; xp < frameWidth; ++xp, ++srcP) {
- if (xp < spriteLeft)
- // Not yet reached start of display area
- continue;
- if (!lineDist[sprX++])
+ for (int xp = 0, sprX = -1; xp < frameWidth; ++xp, ++srcP) {
+ if (!lineDist[xp])
// Not a display pixel
continue;
+ ++sprX;
+ if (sprX < spriteLeft || sprX >= spriteRight)
+ // Skip pixel if it's not in horizontal display portion
+ continue;
+
// Get depth of current output pixel in depth surface
Common::Point pt((destP - (byte *)this->pixels) % this->pitch,
(destP - (byte *)this->pixels) / this->pitch);