mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 04:33:09 +00:00
MADS: Refactor MSurface and Screen to not use virtual inheritance
This commit is contained in:
parent
ac8adb07c8
commit
78e52365bd
@ -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 ext = Common::String::format(".WW%d", variant);
|
||||||
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||||
if (!Common::File::exists(fileName))
|
if (!Common::File::exists(fileName))
|
||||||
@ -217,7 +217,7 @@ void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) {
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
|
void SceneInfoDragonsphere::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
|
||||||
byte *destP = (byte *)depthSurface.getPixels();
|
byte *destP = (byte *)depthSurface.getPixels();
|
||||||
byte *walkMap = new byte[stream->size()];
|
byte *walkMap = new byte[stream->size()];
|
||||||
stream->read(walkMap, stream->size());
|
stream->read(walkMap, stream->size());
|
||||||
|
@ -647,9 +647,9 @@ public:
|
|||||||
class SceneInfoDragonsphere : public SceneInfo {
|
class SceneInfoDragonsphere : public SceneInfo {
|
||||||
friend class SceneInfo;
|
friend class SceneInfo;
|
||||||
protected:
|
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
|
* Constructor
|
||||||
|
@ -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 spaceWidth, int width) {
|
||||||
int xEnd;
|
int xEnd;
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
int maxWidth() const { return _maxWidth; }
|
int maxWidth() const { return _maxWidth; }
|
||||||
int getWidth(const Common::String &msg, int spaceWidth = -1);
|
int getWidth(const Common::String &msg, int spaceWidth = -1);
|
||||||
int getHeight() const { return _maxHeight; }
|
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);
|
int spaceWidth = 0, int width = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ void TextDisplayList::setDirtyAreas2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextDisplayList::draw(MSurface *s) {
|
void TextDisplayList::draw(BaseSurface *s) {
|
||||||
for (uint idx = 0; idx < size(); ++idx) {
|
for (uint idx = 0; idx < size(); ++idx) {
|
||||||
TextDisplay &td = (*this)[idx];
|
TextDisplay &td = (*this)[idx];
|
||||||
if (td._active && (td._expire >= 0)) {
|
if (td._active && (td._expire >= 0)) {
|
||||||
|
@ -170,7 +170,7 @@ public:
|
|||||||
* Draw any text in the list to the specified surface
|
* Draw any text in the list to the specified surface
|
||||||
* @param surface Surface
|
* @param surface Surface
|
||||||
*/
|
*/
|
||||||
void draw(MSurface *s);
|
void draw(BaseSurface *s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine dirty areas for active text areas
|
* Determine dirty areas for active text areas
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
|
|
||||||
namespace MADS {
|
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;
|
int scaled = 0;
|
||||||
while (value--) {
|
while (value--) {
|
||||||
err -= scale;
|
err -= scale;
|
||||||
@ -44,7 +44,7 @@ int MSurface::scaleValue(int value, int scale, int err) {
|
|||||||
return scaled;
|
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 {
|
enum {
|
||||||
kStatusSkip,
|
kStatusSkip,
|
||||||
kStatusScale,
|
kStatusScale,
|
||||||
@ -171,7 +171,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo
|
|||||||
delete[] scaledLineBuf;
|
delete[] scaledLineBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSurface::scrollX(int xAmount) {
|
void BaseSurface::scrollX(int xAmount) {
|
||||||
if (xAmount == 0)
|
if (xAmount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ void MSurface::scrollX(int xAmount) {
|
|||||||
markAllDirty();
|
markAllDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSurface::scrollY(int yAmount) {
|
void BaseSurface::scrollY(int yAmount) {
|
||||||
if (yAmount == 0)
|
if (yAmount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void MSurface::scrollY(int yAmount) {
|
|||||||
delete[] tempData;
|
delete[] tempData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSurface::translate(Common::Array<RGB6> &palette) {
|
void BaseSurface::translate(Common::Array<RGB6> &palette) {
|
||||||
for (int y = 0; y < this->h; ++y) {
|
for (int y = 0; y < this->h; ++y) {
|
||||||
byte *pDest = (byte *)getBasePtr(0, y);
|
byte *pDest = (byte *)getBasePtr(0, y);
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ void MSurface::translate(Common::Array<RGB6> &palette) {
|
|||||||
markAllDirty();
|
markAllDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSurface::translate(byte map[PALETTE_COUNT]) {
|
void BaseSurface::translate(byte map[PALETTE_COUNT]) {
|
||||||
for (int y = 0; y < this->h; ++y) {
|
for (int y = 0; y < this->h; ++y) {
|
||||||
byte *pDest = (byte *)getBasePtr(0, y);
|
byte *pDest = (byte *)getBasePtr(0, y);
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ void MSurface::translate(byte map[PALETTE_COUNT]) {
|
|||||||
markAllDirty();
|
markAllDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
MSurface *MSurface::flipHorizontal() const {
|
BaseSurface *BaseSurface::flipHorizontal() const {
|
||||||
MSurface *dest = new MSurface(this->w, this->h);
|
MSurface *dest = new MSurface(this->w, this->h);
|
||||||
|
|
||||||
for (int y = 0; y < this->h; ++y) {
|
for (int y = 0; y < this->h; ++y) {
|
||||||
@ -277,7 +277,7 @@ MSurface *MSurface::flipHorizontal() const {
|
|||||||
return dest;
|
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) {
|
const Common::Point &destPos, const Common::Rect &srcRect) {
|
||||||
// Loop through the lines
|
// Loop through the lines
|
||||||
for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
|
for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
|
||||||
@ -294,7 +294,7 @@ void MSurface::copyRectTranslate(MSurface &srcSurface, const byte *paletteMap,
|
|||||||
destPos.y + srcRect.height()));
|
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) {
|
DepthSurface *depthSurface, int scale, bool flipped, int transparentColor) {
|
||||||
int destX = destPos.x, destY = destPos.y;
|
int destX = destPos.x, destY = destPos.y;
|
||||||
int frameWidth = src.w;
|
int frameWidth = src.w;
|
||||||
@ -337,15 +337,13 @@ void MSurface::copyFrom(MSurface &src, const Common::Point &destPos, int depth,
|
|||||||
if (destX < 0) {
|
if (destX < 0) {
|
||||||
copyRect.left += -destX;
|
copyRect.left += -destX;
|
||||||
destX = 0;
|
destX = 0;
|
||||||
}
|
} else if (destX + copyRect.width() > w) {
|
||||||
else if (destX + copyRect.width() > w) {
|
|
||||||
copyRect.right -= destX + copyRect.width() - w;
|
copyRect.right -= destX + copyRect.width() - w;
|
||||||
}
|
}
|
||||||
if (destY < 0) {
|
if (destY < 0) {
|
||||||
copyRect.top += -destY;
|
copyRect.top += -destY;
|
||||||
destY = 0;
|
destY = 0;
|
||||||
}
|
} else if (destY + copyRect.height() > h) {
|
||||||
else if (destY + copyRect.height() > h) {
|
|
||||||
copyRect.bottom -= destY + copyRect.height() - h;
|
copyRect.bottom -= destY + copyRect.height() - h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
#include "graphics/managed_surface.h"
|
#include "graphics/screen.h"
|
||||||
#include "mads/palette.h"
|
#include "mads/palette.h"
|
||||||
|
|
||||||
namespace MADS {
|
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:
|
private:
|
||||||
/**
|
/**
|
||||||
* Helper method for calculating new dimensions when scaling a sprite
|
* Helper method for calculating new dimensions when scaling a sprite
|
||||||
@ -72,17 +74,17 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Basic constructor
|
* Basic constructor
|
||||||
*/
|
*/
|
||||||
MSurface() : Graphics::ManagedSurface() {}
|
BaseSurface() : Graphics::Screen() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a surface with fixed dimensions
|
* 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
|
* Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~MSurface() {}
|
virtual ~BaseSurface() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a rect containing the bounds of the surface
|
* 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
|
* 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
|
* Copy an area from one surface to another, translating it using a palette
|
||||||
* map as it's done
|
* 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);
|
const Common::Point &destPos, const Common::Rect &srcRect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,10 +163,22 @@ public:
|
|||||||
* @param flipped Flag for whether image is to be flipped
|
* @param flipped Flag for whether image is to be flipped
|
||||||
* @param transparentColor Transparency palette index
|
* @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);
|
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 {
|
class DepthSurface : public MSurface {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -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"));
|
File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT"));
|
||||||
MadsPack codesPack(&f);
|
MadsPack codesPack(&f);
|
||||||
Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1);
|
Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1);
|
||||||
@ -322,7 +322,7 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) {
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneInfoNebular::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
|
void SceneInfoNebular::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
|
||||||
byte *destP = (byte *)depthSurface.getPixels();
|
byte *destP = (byte *)depthSurface.getPixels();
|
||||||
byte *endP = (byte *)depthSurface.getBasePtr(0, depthSurface.h);
|
byte *endP = (byte *)depthSurface.getBasePtr(0, depthSurface.h);
|
||||||
|
|
||||||
|
@ -1373,9 +1373,9 @@ public:
|
|||||||
class SceneInfoNebular : public SceneInfo {
|
class SceneInfoNebular : public SceneInfo {
|
||||||
friend class SceneInfo;
|
friend class SceneInfo;
|
||||||
protected:
|
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
|
* Constructor
|
||||||
|
@ -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 ext = Common::String::format(".WW%d", variant);
|
||||||
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||||
if (!Common::File::exists(fileName))
|
if (!Common::File::exists(fileName))
|
||||||
@ -190,7 +190,7 @@ void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) {
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneInfoPhantom::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) {
|
void SceneInfoPhantom::loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) {
|
||||||
byte *destP = (byte *)depthSurface.getPixels();
|
byte *destP = (byte *)depthSurface.getPixels();
|
||||||
byte *walkMap = new byte[stream->size()];
|
byte *walkMap = new byte[stream->size()];
|
||||||
stream->read(walkMap, stream->size());
|
stream->read(walkMap, stream->size());
|
||||||
|
@ -474,9 +474,9 @@ public:
|
|||||||
class SceneInfoPhantom : public SceneInfo {
|
class SceneInfoPhantom : public SceneInfo {
|
||||||
friend class SceneInfo;
|
friend class SceneInfo;
|
||||||
protected:
|
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
|
* Constructor
|
||||||
|
@ -128,7 +128,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
|
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;
|
bool sceneFlag = sceneId >= 0;
|
||||||
|
|
||||||
// Figure out the resource to use
|
// 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;
|
bool sceneFlag = sceneId >= 0;
|
||||||
Common::String resourceName;
|
Common::String resourceName;
|
||||||
bool isV2 = (_vm->getGameID() != GType_RexNebular);
|
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;
|
bool sceneFlag = sceneId >= 0;
|
||||||
Common::String resourceName;
|
Common::String resourceName;
|
||||||
Common::SeekableReadStream *stream;
|
Common::SeekableReadStream *stream;
|
||||||
@ -397,7 +397,7 @@ void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName,
|
|||||||
artFile.close();
|
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");
|
Common::String tileMapResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".MM");
|
||||||
File tileMapFile(tileMapResourceName);
|
File tileMapFile(tileMapResourceName);
|
||||||
MadsPack tileMapPack(&tileMapFile);
|
MadsPack tileMapPack(&tileMapFile);
|
||||||
|
@ -189,36 +189,36 @@ public:
|
|||||||
* loads the data
|
* loads the data
|
||||||
*/
|
*/
|
||||||
void load(int sceneId, int variant, const Common::String &resName, int flags,
|
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
|
* 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
|
* 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
|
* 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
|
* Loads the given surface with depth information of a given scene
|
||||||
* @param depthSurface Depth/walk surface
|
* @param depthSurface Depth/walk surface
|
||||||
* @param variant Variant number to load
|
* @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
|
* Loads the given surface with depth information of a given scene
|
||||||
* @param depthSurface Depth/walk surface
|
* @param depthSurface Depth/walk surface
|
||||||
* @param stream Stream to load the data from
|
* @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
|
} // End of namespace MADS
|
||||||
|
@ -201,7 +201,7 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) {
|
|||||||
da1._textActive = true;
|
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) {
|
for (uint i = 0; i < size(); ++i) {
|
||||||
const Common::Rect &srcBounds = (*this)[i]._bounds;
|
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
|
// Create the screen surface separately on another surface, since the screen
|
||||||
// surface will be subject to change as the clipping area is altered
|
// surface will be subject to change as the clipping area is altered
|
||||||
_rawSurface.create(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT);
|
_rawSurface.create(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/array.h"
|
#include "common/array.h"
|
||||||
#include "graphics/screen.h"
|
|
||||||
#include "mads/msurface.h"
|
#include "mads/msurface.h"
|
||||||
#include "mads/action.h"
|
#include "mads/action.h"
|
||||||
|
|
||||||
@ -118,7 +117,7 @@ public:
|
|||||||
* @param destSurface Dest surface
|
* @param destSurface Dest surface
|
||||||
* @param posAdjust Position adjustment
|
* @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
|
* Use the lsit of dirty areas to copy areas of the screen surface to
|
||||||
@ -129,7 +128,6 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ScreenObject {
|
class ScreenObject {
|
||||||
public:
|
public:
|
||||||
bool _active;
|
bool _active;
|
||||||
@ -208,7 +206,7 @@ public:
|
|||||||
void synchronize(Common::Serializer &s);
|
void synchronize(Common::Serializer &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Screen : virtual public Graphics::Screen, virtual public MSurface {
|
class Screen : public BaseSurface {
|
||||||
private:
|
private:
|
||||||
uint16 _random;
|
uint16 _random;
|
||||||
MSurface _rawSurface;
|
MSurface _rawSurface;
|
||||||
|
@ -337,7 +337,7 @@ void SpriteSlots::drawSprites(MSurface *s) {
|
|||||||
s->copyFrom(*sprite, Common::Point(xp, yp), slot._depth, &scene._depthSurface,
|
s->copyFrom(*sprite, Common::Point(xp, yp), slot._depth, &scene._depthSurface,
|
||||||
-1, flipped, sprite->getTransparencyIndex());
|
-1, flipped, sprite->getTransparencyIndex());
|
||||||
} else {
|
} else {
|
||||||
MSurface *spr = sprite;
|
BaseSurface *spr = sprite;
|
||||||
if (flipped) {
|
if (flipped) {
|
||||||
// Create a flipped copy of the sprite temporarily
|
// Create a flipped copy of the sprite temporarily
|
||||||
spr = sprite->flipHorizontal();
|
spr = sprite->flipHorizontal();
|
||||||
|
@ -161,7 +161,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) {
|
|||||||
MSprite *sprite = asset->getFrame(frameNumber - 1);
|
MSprite *sprite = asset->getFrame(frameNumber - 1);
|
||||||
|
|
||||||
if (flipped) {
|
if (flipped) {
|
||||||
MSurface *spr = sprite->flipHorizontal();
|
BaseSurface *spr = sprite->flipHorizontal();
|
||||||
userInterface.mergeFrom(spr, spr->getBounds(), slot._position,
|
userInterface.mergeFrom(spr, spr->getBounds(), slot._position,
|
||||||
sprite->getTransparencyIndex());
|
sprite->getTransparencyIndex());
|
||||||
spr->free();
|
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) {
|
const Common::Point &destPos, int transparencyIndex) {
|
||||||
// Validation of the rectangle and position
|
// Validation of the rectangle and position
|
||||||
int destX = destPos.x, destY = destPos.y;
|
int destX = destPos.x, destY = destPos.y;
|
||||||
|
@ -238,7 +238,7 @@ public:
|
|||||||
* @param destPos Destination position to draw in current surface
|
* @param destPos Destination position to draw in current surface
|
||||||
* @param transparencyIndex Transparency color
|
* @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);
|
int transparencyIndex = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user