aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/msurface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-06-01 16:29:07 -0400
committerPaul Gilbert2014-06-01 16:29:07 -0400
commit6d9ff6ceeb0b9ab704b0feceb2bda7e9f4f34639 (patch)
tree3d6a34e8c48fa31b9108b8c0cebe248ff9e1488c /engines/mads/msurface.cpp
parentf60ecc1f55e8567121add733f0c9b4935cd03aaf (diff)
downloadscummvm-rg350-6d9ff6ceeb0b9ab704b0feceb2bda7e9f4f34639.tar.gz
scummvm-rg350-6d9ff6ceeb0b9ab704b0feceb2bda7e9f4f34639.tar.bz2
scummvm-rg350-6d9ff6ceeb0b9ab704b0feceb2bda7e9f4f34639.zip
MADS: Fix Rex's moonwalking
Diffstat (limited to 'engines/mads/msurface.cpp')
-rw-r--r--engines/mads/msurface.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index 00d85635fa..18a9a4f547 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -262,6 +262,7 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
int destX = destPos.x, destY = destPos.y;
int frameWidth = src->getWidth();
int frameHeight = src->getHeight();
+ int direction = flipped ? -1 : 1;
int highestDim = MAX(frameWidth, frameHeight);
bool lineDist[MADS_SCREEN_WIDTH];
@@ -314,15 +315,19 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
byte *data = src->getData();
byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left);
byte *destPtr = (byte *)pixels + (destY * pitch) + destX;
+ if (flipped)
+ srcPtr += copyRect.width() - 1;
// 100% scaling variation
for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) {
// Copy each byte one at a time checking against the depth
for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) {
+ byte *srcP = srcPtr + xCtr * direction;
int pixelDepth = depthSurface == nullptr ? 15 :
depthSurface->getDepth(Common::Point(destX + xCtr, destY + rowCtr));
- if ((depth <= pixelDepth) && (srcPtr[xCtr] != transparentColor))
- destPtr[xCtr] = srcPtr[xCtr];
+
+ if ((depth <= pixelDepth) && (*srcP != transparentColor))
+ destPtr[xCtr] = *srcP;
}
srcPtr += src->getWidth();
@@ -342,7 +347,6 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
int spriteLeft = 0;
int spriteWidth = distXCount;
int widthAmount = destX + distXCount - 1;
- int direction = flipped ? -1 : 1;
if (destX < 0) {
spriteWidth += destX;