aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-29 21:35:59 -0400
committerPaul Gilbert2014-05-29 21:35:59 -0400
commit06387c25d8e908f174d081769b94dd0625e00b58 (patch)
treee1dedb811efc2f74162c6f4cc37a8d182a1ae842 /engines/mads
parentd36155247f37de6fdc07dbe59c395c3b1c2d2d2c (diff)
downloadscummvm-rg350-06387c25d8e908f174d081769b94dd0625e00b58.tar.gz
scummvm-rg350-06387c25d8e908f174d081769b94dd0625e00b58.tar.bz2
scummvm-rg350-06387c25d8e908f174d081769b94dd0625e00b58.zip
MADS: Fix positioning of teleporter window backgrounds
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/msurface.cpp21
-rw-r--r--engines/mads/msurface.h15
-rw-r--r--engines/mads/scene_data.cpp6
3 files changed, 39 insertions, 3 deletions
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index 39c7808560..839882a354 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -419,6 +419,27 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth,
}
}
+void MSurface::copyFromScaled(MSurface *src, const Common::Point &destPos, int depth,
+ DepthSurface *depthSurface, int scale, int transparentColor) {
+ int distXCount = 0, distYCount = 0;
+ int highestDim = MAX(src->w, src->h);
+ int accum = 0;
+
+ for (int idx = 0; idx < highestDim; ++idx) {
+ accum += scale;
+ if (accum >= 100) {
+ accum -= 100;
+ if (idx < src->w)
+ ++distXCount;
+ if (idx < src->h)
+ ++distYCount;
+ }
+ }
+
+ Common::Point newPos(destPos.x - distXCount / 2, destPos.y - distYCount);
+ copyFrom(src, src->getBounds(), newPos, transparentColor);
+}
+
void MSurface::scrollX(int xAmount) {
if (xAmount == 0)
return;
diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h
index 8ad0b1cda4..985a097d4a 100644
--- a/engines/mads/msurface.h
+++ b/engines/mads/msurface.h
@@ -161,12 +161,27 @@ public:
* @param destPos Destination position to draw in current surface
* @param depth Depth of sprite
* @param depthSurface Depth surface to use with sprite depth
+ * @param scale Scale for image
* @param transparentColor Transparency palette index
*/
void copyFrom(MSurface *src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
int scale, int transparentColor = -1);
/**
+ * Copys a sub-section of another surface into the current one, taking into
+ * account variation in the destination copy position based on item size
+ * and scaling.
+ * @param src Source surface
+ * @param destPos Destination position to draw in current surface
+ * @param depth Depth of sprite
+ * @param depthSurface Depth surface to use with sprite depth
+ * @param scale Scale for image
+ * @param transparentColor Transparency palette index
+ */
+ void copyFromScaled(MSurface *src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
+ int scale, int transparentColor = -1);
+
+ /**
* Copies the surface to a given destination surface
*/
void copyTo(MSurface *dest, int transparentColor = -1) {
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index de75b04457..d53a668fd3 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -265,13 +265,13 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
assert(asset && _depthStyle != 2);
MSprite *spr = asset->getFrame(asset->getCount() - 1);
- bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale,
- spr->getTransparencyIndex());
+ bgSurface.copyFromScaled(spr, si._position, si._depth, &depthSurface,
+ si._scale, spr->getTransparencyIndex());
}
// Free the sprite sets
for (int i = (int)spriteSets.size() - 1; i >= 0; --i) {
- warning("TODO: sub_201C8 SPRITE_SET.field_6");
+ _vm->_palette->_paletteUsage.resetPalFlags(spriteSets[i]->_usageIndex);
delete spriteSets[i];
}
}