aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2010-06-15 11:19:32 +0000
committerPaul Gilbert2010-06-15 11:19:32 +0000
commitdeb907de637b963af91aa530251fad5ad6b45025 (patch)
treeb3d8d7e8fdfc8aabf4fc89d089f763e96bca07e7
parentab901bccd06ea88fdd7c16f77e8f7e437092e9eb (diff)
downloadscummvm-rg350-deb907de637b963af91aa530251fad5ad6b45025.tar.gz
scummvm-rg350-deb907de637b963af91aa530251fad5ad6b45025.tar.bz2
scummvm-rg350-deb907de637b963af91aa530251fad5ad6b45025.zip
Bugfixes to depth processing that was causing the 'Microprose Design Group' message not to appear in the first intro scene
svn-id: r49801
-rw-r--r--engines/m4/graphics.cpp10
-rw-r--r--engines/m4/graphics.h9
-rw-r--r--engines/m4/mads_views.cpp4
3 files changed, 11 insertions, 12 deletions
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index 36de60af6c..d7a0c9edfc 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -400,8 +400,8 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest
* Copies a given image onto a destination surface with scaling, transferring only pixels that meet
* the specified depth requirement on a secondary surface contain depth information
*/
-void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, M4Surface *depthsSurface,
- int scale, int transparentColour) {
+void M4Surface::copyFrom(M4Surface *src, int destX, int destY, Common::Point destAdjust,
+ int depth, M4Surface *depthsSurface, int scale, int transparentColour) {
if (scale == 100) {
// Copy the specified area
@@ -426,8 +426,8 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, M4Surf
byte *data = src->getBasePtr();
byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left);
byte *depthsData = depthsSurface->getBasePtr();
- byte *depthsPtr = depthsData + (src->width() * copyRect.top + copyRect.left);
- byte *destPtr = (byte *)pixels + (destY * width()) + destX;
+ byte *depthsPtr = depthsData + (depthsSurface->pitch * destY) + destX;
+ byte *destPtr = (byte *)pixels + ((destY + destAdjust.y) * pitch) + destX + destAdjust.x;
// 100% scaling variation
for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) {
@@ -520,7 +520,7 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, M4Surf
if (spriteHeight <= 0)
return;
- byte *destPixelsP = this->getBasePtr(destX + spriteLeft, destY + spriteTop);
+ byte *destPixelsP = this->getBasePtr(destX + spriteLeft + destAdjust.x, destY + spriteTop + destAdjust.y);
const byte *depthPixelsP = depthsSurface->getBasePtr(destX + spriteLeft, destY + spriteTop);
spriteLeft = (spriteLeft * (normalFrame ? 1 : -1));
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
index 6901b72e87..24c0edf223 100644
--- a/engines/m4/graphics.h
+++ b/engines/m4/graphics.h
@@ -157,10 +157,9 @@ public:
void reset();
void frameRect(const Common::Rect &r, uint8 color);
void fillRect(const Common::Rect &r, uint8 color);
- void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY,
- int transparentColour = -1);
- void copyFrom(M4Surface *src, int destX, int destY, int depth, M4Surface *depthSurface, int scale,
- int transparentColour = -1);
+ void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY, int transparentColour = -1);
+ void copyFrom(M4Surface *src, int destX, int destY, Common::Point destAdjust, int depth, M4Surface *depthSurface,
+ int scale, int transparentColour = -1);
void update() {
if (_isScreen) {
@@ -182,7 +181,7 @@ public:
}
inline void copyTo(M4Surface *dest, int destX, int destY, int depth, M4Surface *depthsSurface, int scale,
int transparentColour = -1) {
- dest->copyFrom(this, destX, destY, depth, depthsSurface, scale, transparentColour);
+ dest->copyFrom(this, destX, destY, Common::Point(0, 0), depth, depthsSurface, scale, transparentColour);
}
void scrollX(int xAmount);
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index af4177e6bb..5a7abcf484 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -196,7 +196,7 @@ void MadsSpriteSlots::drawForeground(View *view, int yOffset) {
// Minimalised drawing
assert(slot.spriteListIndex < (int)_sprites.size());
M4Sprite *spr = spriteSet.getFrame((slot.frameNumber & 0x7fff) - 1);
- spr->copyTo(view, slot.xp, slot.yp + yOffset, slot.depth, _owner._depthSurface, slot.scale, 0);
+ view->copyFrom(spr, slot.xp, slot.yp, Common::Point(0, yOffset), slot.depth, _owner._depthSurface, slot.scale, 0);
} else {
int xp, yp;
M4Sprite *spr = spriteSet.getFrame(slot.frameNumber - 1);
@@ -211,7 +211,7 @@ void MadsSpriteSlots::drawForeground(View *view, int yOffset) {
if (slot.depth > 1) {
// Draw the frame with depth processing
- spr->copyTo(view, xp, yp + yOffset, slot.depth, _owner._depthSurface, 100, 0);
+ view->copyFrom(spr, xp, yp, Common::Point(0, yOffset), slot.depth, _owner._depthSurface, 100, 0);
} else {
// No depth, so simply draw the image
spr->copyTo(view, xp, yp + yOffset, 0);