aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-26 21:37:52 -0400
committerPaul Gilbert2016-05-26 21:37:52 -0400
commit78e52365bd1d8cdd56ddce6ae3d52ae04f9abd4c (patch)
treefb00b3cdbef3011a309b084d680d139750824701 /engines/mads
parentac8adb07c835885584517674b9b03bab14e8a772 (diff)
downloadscummvm-rg350-78e52365bd1d8cdd56ddce6ae3d52ae04f9abd4c.tar.gz
scummvm-rg350-78e52365bd1d8cdd56ddce6ae3d52ae04f9abd4c.tar.bz2
scummvm-rg350-78e52365bd1d8cdd56ddce6ae3d52ae04f9abd4c.zip
MADS: Refactor MSurface and Screen to not use virtual inheritance
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes.cpp4
-rw-r--r--engines/mads/dragonsphere/dragonsphere_scenes.h4
-rw-r--r--engines/mads/font.cpp2
-rw-r--r--engines/mads/font.h2
-rw-r--r--engines/mads/messages.cpp2
-rw-r--r--engines/mads/messages.h2
-rw-r--r--engines/mads/msurface.cpp26
-rw-r--r--engines/mads/msurface.h32
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp4
-rw-r--r--engines/mads/nebular/nebular_scenes.h4
-rw-r--r--engines/mads/phantom/phantom_scenes.cpp4
-rw-r--r--engines/mads/phantom/phantom_scenes.h4
-rw-r--r--engines/mads/scene_data.cpp8
-rw-r--r--engines/mads/scene_data.h12
-rw-r--r--engines/mads/screen.cpp4
-rw-r--r--engines/mads/screen.h6
-rw-r--r--engines/mads/sprites.cpp2
-rw-r--r--engines/mads/user_interface.cpp4
-rw-r--r--engines/mads/user_interface.h2
19 files changed, 69 insertions, 59 deletions
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp
index a18d03d143..c20eeb72fa 100644
--- a/engines/mads/dragonsphere/dragonsphere_scenes.cpp
+++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp
@@ -201,7 +201,7 @@ Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
-void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) {
+void SceneInfoDragonsphere::loadCodes(BaseSurface &depthSurface, int variant) {
Common::String ext = Common::String::format(".WW%d", variant);
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
if (!Common::File::exists(fileName))
@@ -217,7 +217,7 @@ void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) {
f.close();
}
-void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
+void SceneInfoDragonsphere::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
byte *destP = (byte *)depthSurface.getPixels();
byte *walkMap = new byte[stream->size()];
stream->read(walkMap, stream->size());
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h
index e9b48715db..22d894b9d9 100644
--- a/engines/mads/dragonsphere/dragonsphere_scenes.h
+++ b/engines/mads/dragonsphere/dragonsphere_scenes.h
@@ -647,9 +647,9 @@ public:
class SceneInfoDragonsphere : public SceneInfo {
friend class SceneInfo;
protected:
- virtual void loadCodes(MSurface &depthSurface, int variant);
+ virtual void loadCodes(BaseSurface &depthSurface, int variant);
- virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream);
+ virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream);
/**
* Constructor
diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp
index 3828c3df8e..684418da91 100644
--- a/engines/mads/font.cpp
+++ b/engines/mads/font.cpp
@@ -145,7 +145,7 @@ void Font::setColorMode(SelectionMode mode) {
}
}
-int Font::writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt,
+int Font::writeString(BaseSurface *surface, const Common::String &msg, const Common::Point &pt,
int spaceWidth, int width) {
int xEnd;
if (width > 0)
diff --git a/engines/mads/font.h b/engines/mads/font.h
index 486cadcfff..a27de6e283 100644
--- a/engines/mads/font.h
+++ b/engines/mads/font.h
@@ -86,7 +86,7 @@ public:
int maxWidth() const { return _maxWidth; }
int getWidth(const Common::String &msg, int spaceWidth = -1);
int getHeight() const { return _maxHeight; }
- int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt,
+ int writeString(BaseSurface *surface, const Common::String &msg, const Common::Point &pt,
int spaceWidth = 0, int width = 0);
};
diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index 2bee77dae7..773ebd309c 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -558,7 +558,7 @@ void TextDisplayList::setDirtyAreas2() {
}
}
-void TextDisplayList::draw(MSurface *s) {
+void TextDisplayList::draw(BaseSurface *s) {
for (uint idx = 0; idx < size(); ++idx) {
TextDisplay &td = (*this)[idx];
if (td._active && (td._expire >= 0)) {
diff --git a/engines/mads/messages.h b/engines/mads/messages.h
index 2b673a8a4d..ced8c5bb6d 100644
--- a/engines/mads/messages.h
+++ b/engines/mads/messages.h
@@ -170,7 +170,7 @@ public:
* Draw any text in the list to the specified surface
* @param surface Surface
*/
- void draw(MSurface *s);
+ void draw(BaseSurface *s);
/**
* Determine dirty areas for active text areas
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index 40c69c0f08..8ea9c39bf5 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -30,9 +30,9 @@
namespace MADS {
-MADSEngine *MSurface::_vm = nullptr;
+MADSEngine *BaseSurface::_vm = nullptr;
-int MSurface::scaleValue(int value, int scale, int err) {
+int BaseSurface::scaleValue(int value, int scale, int err) {
int scaled = 0;
while (value--) {
err -= scale;
@@ -44,7 +44,7 @@ int MSurface::scaleValue(int value, int scale, int err) {
return scaled;
}
-void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Common::Rect &clipRect) {
+void BaseSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Common::Rect &clipRect) {
enum {
kStatusSkip,
kStatusScale,
@@ -171,7 +171,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo
delete[] scaledLineBuf;
}
-void MSurface::scrollX(int xAmount) {
+void BaseSurface::scrollX(int xAmount) {
if (xAmount == 0)
return;
@@ -203,7 +203,7 @@ void MSurface::scrollX(int xAmount) {
markAllDirty();
}
-void MSurface::scrollY(int yAmount) {
+void BaseSurface::scrollY(int yAmount) {
if (yAmount == 0)
return;
@@ -238,7 +238,7 @@ void MSurface::scrollY(int yAmount) {
delete[] tempData;
}
-void MSurface::translate(Common::Array<RGB6> &palette) {
+void BaseSurface::translate(Common::Array<RGB6> &palette) {
for (int y = 0; y < this->h; ++y) {
byte *pDest = (byte *)getBasePtr(0, y);
@@ -251,7 +251,7 @@ void MSurface::translate(Common::Array<RGB6> &palette) {
markAllDirty();
}
-void MSurface::translate(byte map[PALETTE_COUNT]) {
+void BaseSurface::translate(byte map[PALETTE_COUNT]) {
for (int y = 0; y < this->h; ++y) {
byte *pDest = (byte *)getBasePtr(0, y);
@@ -263,7 +263,7 @@ void MSurface::translate(byte map[PALETTE_COUNT]) {
markAllDirty();
}
-MSurface *MSurface::flipHorizontal() const {
+BaseSurface *BaseSurface::flipHorizontal() const {
MSurface *dest = new MSurface(this->w, this->h);
for (int y = 0; y < this->h; ++y) {
@@ -277,7 +277,7 @@ MSurface *MSurface::flipHorizontal() const {
return dest;
}
-void MSurface::copyRectTranslate(MSurface &srcSurface, const byte *paletteMap,
+void BaseSurface::copyRectTranslate(BaseSurface &srcSurface, const byte *paletteMap,
const Common::Point &destPos, const Common::Rect &srcRect) {
// Loop through the lines
for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
@@ -294,7 +294,7 @@ void MSurface::copyRectTranslate(MSurface &srcSurface, const byte *paletteMap,
destPos.y + srcRect.height()));
}
-void MSurface::copyFrom(MSurface &src, const Common::Point &destPos, int depth,
+void BaseSurface::copyFrom(BaseSurface &src, const Common::Point &destPos, int depth,
DepthSurface *depthSurface, int scale, bool flipped, int transparentColor) {
int destX = destPos.x, destY = destPos.y;
int frameWidth = src.w;
@@ -337,15 +337,13 @@ void MSurface::copyFrom(MSurface &src, const Common::Point &destPos, int depth,
if (destX < 0) {
copyRect.left += -destX;
destX = 0;
- }
- else if (destX + copyRect.width() > w) {
+ } else if (destX + copyRect.width() > w) {
copyRect.right -= destX + copyRect.width() - w;
}
if (destY < 0) {
copyRect.top += -destY;
destY = 0;
- }
- else if (destY + copyRect.height() > h) {
+ } else if (destY + copyRect.height() > h) {
copyRect.bottom -= destY + copyRect.height() - h;
}
diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h
index e92770900d..733a29d9e3 100644
--- a/engines/mads/msurface.h
+++ b/engines/mads/msurface.h
@@ -25,7 +25,7 @@
#include "common/scummsys.h"
#include "common/rect.h"
-#include "graphics/managed_surface.h"
+#include "graphics/screen.h"
#include "mads/palette.h"
namespace MADS {
@@ -48,9 +48,11 @@ struct SpriteInfo {
};
/*
- * MADS graphics surface
+ * Base MADS surface class. This derivces from Graphics::Screen
+ * because it has logic we'll need for our own Screen class that
+ * derives from this one
*/
-class MSurface : virtual public Graphics::ManagedSurface {
+class BaseSurface : public Graphics::Screen {
private:
/**
* Helper method for calculating new dimensions when scaling a sprite
@@ -72,17 +74,17 @@ public:
/**
* Basic constructor
*/
- MSurface() : Graphics::ManagedSurface() {}
+ BaseSurface() : Graphics::Screen() {}
/**
* Constructor for a surface with fixed dimensions
*/
- MSurface(int width, int height) : Graphics::ManagedSurface(width, height) {}
+ BaseSurface(int width, int height) : Graphics::Screen(width, height) {}
/**
* Destructor
*/
- virtual ~MSurface() {}
+ virtual ~BaseSurface() {}
/**
* Return a rect containing the bounds of the surface
@@ -142,13 +144,13 @@ public:
/**
* Create a new surface which is a flipped horizontal copy of the current one
*/
- MSurface *flipHorizontal() const;
+ BaseSurface *flipHorizontal() const;
/**
* Copy an area from one surface to another, translating it using a palette
* map as it's done
*/
- void copyRectTranslate(MSurface &srcSurface, const byte *paletteMap,
+ void copyRectTranslate(BaseSurface &srcSurface, const byte *paletteMap,
const Common::Point &destPos, const Common::Rect &srcRect);
/**
@@ -161,10 +163,22 @@ public:
* @param flipped Flag for whether image is to be flipped
* @param transparentColor Transparency palette index
*/
- void copyFrom(MSurface &src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
+ void copyFrom(BaseSurface &src, const Common::Point &destPos, int depth, DepthSurface *depthSurface,
int scale, bool flipped, int transparentColor = -1);
};
+class MSurface : public BaseSurface {
+protected:
+ /**
+ * Override the addDirtyRect from Graphics::Screen, since for standard
+ * surfaces we don't need dirty rects to be tracked
+ */
+ virtual void addDirtyRect(const Common::Rect &r) {}
+public:
+ MSurface() : BaseSurface() {}
+ MSurface(int width, int height) : BaseSurface(width, height) {}
+};
+
class DepthSurface : public MSurface {
public:
/**
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index 40228b4b7d..9502d273ea 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -311,7 +311,7 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
-void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) {
+void SceneInfoNebular::loadCodes(BaseSurface &depthSurface, int variant) {
File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT"));
MadsPack codesPack(&f);
Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1);
@@ -322,7 +322,7 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) {
f.close();
}
-void SceneInfoNebular::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
+void SceneInfoNebular::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
byte *destP = (byte *)depthSurface.getPixels();
byte *endP = (byte *)depthSurface.getBasePtr(0, depthSurface.h);
diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h
index 58a6d1c98f..b600c6dbe1 100644
--- a/engines/mads/nebular/nebular_scenes.h
+++ b/engines/mads/nebular/nebular_scenes.h
@@ -1373,9 +1373,9 @@ public:
class SceneInfoNebular : public SceneInfo {
friend class SceneInfo;
protected:
- virtual void loadCodes(MSurface &depthSurface, int variant);
+ virtual void loadCodes(BaseSurface &depthSurface, int variant);
- virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream);
+ virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream);
/**
* Constructor
diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp
index 7ef627ceeb..bfb521e369 100644
--- a/engines/mads/phantom/phantom_scenes.cpp
+++ b/engines/mads/phantom/phantom_scenes.cpp
@@ -174,7 +174,7 @@ Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
-void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) {
+void SceneInfoPhantom::loadCodes(BaseSurface &depthSurface, int variant) {
Common::String ext = Common::String::format(".WW%d", variant);
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
if (!Common::File::exists(fileName))
@@ -190,7 +190,7 @@ void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) {
f.close();
}
-void SceneInfoPhantom::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
+void SceneInfoPhantom::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
byte *destP = (byte *)depthSurface.getPixels();
byte *walkMap = new byte[stream->size()];
stream->read(walkMap, stream->size());
diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h
index a6a8395a2c..6b7ab697f3 100644
--- a/engines/mads/phantom/phantom_scenes.h
+++ b/engines/mads/phantom/phantom_scenes.h
@@ -474,9 +474,9 @@ public:
class SceneInfoPhantom : public SceneInfo {
friend class SceneInfo;
protected:
- virtual void loadCodes(MSurface &depthSurface, int variant);
+ virtual void loadCodes(BaseSurface &depthSurface, int variant);
- virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream);
+ virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream);
/**
* Constructor
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index 5323178ec7..21fd4f9026 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -128,7 +128,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) {
}
void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
- int flags, DepthSurface &depthSurface, MSurface &bgSurface) {
+ int flags, DepthSurface &depthSurface, BaseSurface &bgSurface) {
bool sceneFlag = sceneId >= 0;
// Figure out the resource to use
@@ -299,7 +299,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
}
}
-void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, MSurface &bgSurface) {
+void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, BaseSurface &bgSurface) {
bool sceneFlag = sceneId >= 0;
Common::String resourceName;
bool isV2 = (_vm->getGameID() != GType_RexNebular);
@@ -351,7 +351,7 @@ void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &r
}
}
-void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface) {
+void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface) {
bool sceneFlag = sceneId >= 0;
Common::String resourceName;
Common::SeekableReadStream *stream;
@@ -397,7 +397,7 @@ void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName,
artFile.close();
}
-void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface) {
+void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface) {
Common::String tileMapResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".MM");
File tileMapFile(tileMapResourceName);
MadsPack tileMapPack(&tileMapFile);
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
index 41a08f74eb..a28c42c5ab 100644
--- a/engines/mads/scene_data.h
+++ b/engines/mads/scene_data.h
@@ -189,36 +189,36 @@ public:
* loads the data
*/
void load(int sceneId, int variant, const Common::String &resName, int flags,
- DepthSurface &depthSurface, MSurface &bgSurface);
+ DepthSurface &depthSurface, BaseSurface &bgSurface);
/**
* Loads the palette for a scene
*/
- void loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, MSurface &bgSurface);
+ void loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, BaseSurface &bgSurface);
/**
* Loads a V1 game background
*/
- void loadMadsV1Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface);
+ void loadMadsV1Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
/**
* Loads a V2 game background
*/
- void loadMadsV2Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface);
+ void loadMadsV2Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
/**
* Loads the given surface with depth information of a given scene
* @param depthSurface Depth/walk surface
* @param variant Variant number to load
*/
- virtual void loadCodes(MSurface &depthSurface, int variant) = 0;
+ virtual void loadCodes(BaseSurface &depthSurface, int variant) = 0;
/**
* Loads the given surface with depth information of a given scene
* @param depthSurface Depth/walk surface
* @param stream Stream to load the data from
*/
- virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
+ virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
};
} // End of namespace MADS
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp
index 05f9de61e2..b17b6e93b8 100644
--- a/engines/mads/screen.cpp
+++ b/engines/mads/screen.cpp
@@ -201,7 +201,7 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) {
da1._textActive = true;
}
-void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust) {
+void DirtyAreas::copy(BaseSurface *srcSurface, BaseSurface *destSurface, const Common::Point &posAdjust) {
for (uint i = 0; i < size(); ++i) {
const Common::Rect &srcBounds = (*this)[i]._bounds;
@@ -555,7 +555,7 @@ void ScreenObjects::synchronize(Common::Serializer &s) {
/*------------------------------------------------------------------------*/
-Screen::Screen(): Graphics::Screen(), MSurface() {
+Screen::Screen(): BaseSurface() {
// Create the screen surface separately on another surface, since the screen
// surface will be subject to change as the clipping area is altered
_rawSurface.create(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT);
diff --git a/engines/mads/screen.h b/engines/mads/screen.h
index 626080580e..eeb15453f8 100644
--- a/engines/mads/screen.h
+++ b/engines/mads/screen.h
@@ -25,7 +25,6 @@
#include "common/scummsys.h"
#include "common/array.h"
-#include "graphics/screen.h"
#include "mads/msurface.h"
#include "mads/action.h"
@@ -118,7 +117,7 @@ public:
* @param destSurface Dest surface
* @param posAdjust Position adjustment
*/
- void copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust);
+ void copy(BaseSurface *srcSurface, BaseSurface *destSurface, const Common::Point &posAdjust);
/**
* Use the lsit of dirty areas to copy areas of the screen surface to
@@ -129,7 +128,6 @@ public:
void reset();
};
-
class ScreenObject {
public:
bool _active;
@@ -208,7 +206,7 @@ public:
void synchronize(Common::Serializer &s);
};
-class Screen : virtual public Graphics::Screen, virtual public MSurface {
+class Screen : public BaseSurface {
private:
uint16 _random;
MSurface _rawSurface;
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index fc8ddf22d2..84060ccdfe 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -337,7 +337,7 @@ void SpriteSlots::drawSprites(MSurface *s) {
s->copyFrom(*sprite, Common::Point(xp, yp), slot._depth, &scene._depthSurface,
-1, flipped, sprite->getTransparencyIndex());
} else {
- MSurface *spr = sprite;
+ BaseSurface *spr = sprite;
if (flipped) {
// Create a flipped copy of the sprite temporarily
spr = sprite->flipHorizontal();
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 8f7cb0a24b..204f71fe43 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -161,7 +161,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) {
MSprite *sprite = asset->getFrame(frameNumber - 1);
if (flipped) {
- MSurface *spr = sprite->flipHorizontal();
+ BaseSurface *spr = sprite->flipHorizontal();
userInterface.mergeFrom(spr, spr->getBounds(), slot._position,
sprite->getTransparencyIndex());
spr->free();
@@ -429,7 +429,7 @@ void UserInterface::drawTextElements() {
}
}
-void UserInterface::mergeFrom(MSurface *src, const Common::Rect &srcBounds,
+void UserInterface::mergeFrom(BaseSurface *src, const Common::Rect &srcBounds,
const Common::Point &destPos, int transparencyIndex) {
// Validation of the rectangle and position
int destX = destPos.x, destY = destPos.y;
diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h
index 9232dc1bb1..6c9485998a 100644
--- a/engines/mads/user_interface.h
+++ b/engines/mads/user_interface.h
@@ -238,7 +238,7 @@ public:
* @param destPos Destination position to draw in current surface
* @param transparencyIndex Transparency color
*/
- void mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos,
+ void mergeFrom(BaseSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos,
int transparencyIndex = -1);
/**