aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-12-07 18:23:28 +0000
committerMax Horn2009-12-07 18:23:28 +0000
commitd34cdae9cea0165253a8dcfe70911c792366ec08 (patch)
tree25a1da522db8af08cd43082eb64176ca5d7920cf /engines
parentf8126d9da676e69dff384b8a8f7136ad27fb014d (diff)
downloadscummvm-rg350-d34cdae9cea0165253a8dcfe70911c792366ec08.tar.gz
scummvm-rg350-d34cdae9cea0165253a8dcfe70911c792366ec08.tar.bz2
scummvm-rg350-d34cdae9cea0165253a8dcfe70911c792366ec08.zip
M4: Move 'determine transparent color' hack into a new M4Sprite method
svn-id: r46281
Diffstat (limited to 'engines')
-rw-r--r--engines/m4/animation.cpp5
-rw-r--r--engines/m4/console.cpp5
-rw-r--r--engines/m4/mads_menus.cpp4
-rw-r--r--engines/m4/sprite.cpp6
-rw-r--r--engines/m4/sprite.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp
index 53d00cb5c0..836334a305 100644
--- a/engines/m4/animation.cpp
+++ b/engines/m4/animation.cpp
@@ -175,11 +175,8 @@ bool Animation::updateAnim() {
// Write the sprite onto the screen
M4Sprite *spr = _spriteSeries->getFrame(seriesFrameIndex);
- // FIXME: We assume that the transparent color is the color of the top left pixel
- byte *transparentColor = spr->getBasePtr(0, 0);
-
// FIXME: correct x, y
- spr->copyTo(bg, frame->x, frame->y, (int)*transparentColor);
+ spr->copyTo(bg, frame->x, frame->y, (int)spr->getTransparentColor());
// HACK: wait a bit
g_system->delayMillis(100);
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index c95108066c..9744741a52 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -223,10 +223,7 @@ bool Console::cmdShowSprite(int argc, const char **argv) {
if (y >= bg->height())
break;
- // FIXME: We assume that the transparent color is the color of the top left pixel
- byte *transparentColor = spr->getBasePtr(0, 0);
-
- spr->copyTo(bg, x, y, (int)*transparentColor);
+ spr->copyTo(bg, x, y, (int)spr->getTransparentColor());
x += spr->width();
yMax = MAX(yMax, spr->height());
diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp
index 01bfe96e25..d20e04c2e4 100644
--- a/engines/m4/mads_menus.cpp
+++ b/engines/m4/mads_menus.cpp
@@ -528,9 +528,7 @@ void DragonMainMenuView::updateState() {
_itemPalData.push_back(palData);
spr = _menuItem->getFrame(1);
- // FIXME: We assume that the transparent color is the color of the top left pixel
- byte *transparentColor = spr->getBasePtr(0, 0);
- spr->copyTo(this, spr->xOffset - 140, spr->yOffset - spr->height(), (int)*transparentColor);
+ spr->copyTo(this, spr->xOffset - 140, spr->yOffset - spr->height(), (int)spr->getTransparentColor());
_vm->_mouse->cursorOn();
}
diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp
index d3299ff699..d8d21bc34d 100644
--- a/engines/m4/sprite.cpp
+++ b/engines/m4/sprite.cpp
@@ -171,4 +171,10 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
}
}
+byte M4Sprite::getTransparentColor() const {
+ // FIXME: We assume that the transparent color is the color of the
+ // top left pixel.
+ return *getBasePtr(0, 0);
+}
+
} // End of namespace M4
diff --git a/engines/m4/sprite.h b/engines/m4/sprite.h
index 5caeaa8664..fbdd64bd29 100644
--- a/engines/m4/sprite.h
+++ b/engines/m4/sprite.h
@@ -114,6 +114,8 @@ public:
void loadRle(Common::SeekableReadStream* rleData);
void loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY);
void loadMadsSprite(Common::SeekableReadStream* source);
+
+ byte getTransparentColor() const;
protected:
};