From d34cdae9cea0165253a8dcfe70911c792366ec08 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 7 Dec 2009 18:23:28 +0000 Subject: M4: Move 'determine transparent color' hack into a new M4Sprite method svn-id: r46281 --- engines/m4/animation.cpp | 5 +---- engines/m4/console.cpp | 5 +---- engines/m4/mads_menus.cpp | 4 +--- engines/m4/sprite.cpp | 6 ++++++ engines/m4/sprite.h | 2 ++ 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'engines') 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: }; -- cgit v1.2.3