aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/compression.cpp2
-rw-r--r--engines/mads/detection_tables.h2
-rw-r--r--engines/mads/mads.h5
-rw-r--r--engines/mads/msprite.cpp96
-rw-r--r--engines/mads/msprite.h31
-rw-r--r--engines/mads/msurface.cpp100
-rw-r--r--engines/mads/msurface.h21
-rw-r--r--engines/mads/resources.cpp5
8 files changed, 10 insertions, 252 deletions
diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp
index 5000319a63..2190fc4ac0 100644
--- a/engines/mads/compression.cpp
+++ b/engines/mads/compression.cpp
@@ -181,4 +181,4 @@ int FabDecompressor::getBit() {
return bit;
}
-} // End of namespace M4
+} // End of namespace MADS
diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h
index 7410dce2f6..ac5316d4b4 100644
--- a/engines/mads/detection_tables.h
+++ b/engines/mads/detection_tables.h
@@ -38,7 +38,7 @@ static const MADSGameDescription gameDescriptions[] = {
GUIO1(GUIO_NONE)
},
GType_RexNebular,
- GF_MADS
+ 0
},
{ AD_TABLE_END_MARKER }
diff --git a/engines/mads/mads.h b/engines/mads/mads.h
index b50cf07678..b7598eb03d 100644
--- a/engines/mads/mads.h
+++ b/engines/mads/mads.h
@@ -65,11 +65,6 @@ enum {
GType_Riddle = 3
};
-enum {
- GF_MADS = 1 << 0,
- GF_M4 = 1 << 1
-};
-
struct MADSGameDescription;
diff --git a/engines/mads/msprite.cpp b/engines/mads/msprite.cpp
index 60c22d8c06..b15796d57c 100644
--- a/engines/mads/msprite.cpp
+++ b/engines/mads/msprite.cpp
@@ -38,21 +38,13 @@ enum {
MADSEngine *MSprite::_vm;
MSprite *MSprite::init(MSurface &s) {
- if (_vm->getGameFeatures() & GF_MADS) {
- return new MSpriteMADS(s);
- } else {
- return new MSpriteM4(s);
- }
+ return new MSprite(s);
}
MSprite *MSprite::init(Common::SeekableReadStream *source, const Common::Point &offset,
int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) {
- if (_vm->getGameFeatures() & GF_MADS) {
- return new MSpriteMADS(source, offset, widthVal, heightVal, decodeRle, encodingVal);
- } else {
- return new MSpriteM4(source, offset, widthVal, heightVal, decodeRle, encodingVal);
- }
+ return new MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal);
}
MSprite::MSprite(MSurface &s): _surface(s) {
@@ -65,21 +57,15 @@ MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset
_encoding(encodingVal), _offset(offset) {
// Load the sprite data
- load(source, widthVal, heightVal, decodeRle);
+ loadSprite(source);
}
MSprite::~MSprite() {
}
-/*------------------------------------------------------------------------*/
-
-void MSpriteMADS::load(Common::SeekableReadStream *stream, int widthVal, int heightVal,
- bool decodeRle) {
- loadSprite(stream);
-}
// TODO: The sprite outlines (pixel value 0xFD) are not shown
-void MSpriteMADS::loadSprite(Common::SeekableReadStream *source) {
+void MSprite::loadSprite(Common::SeekableReadStream *source) {
byte *outp, *lineStart;
bool newLine = false;
@@ -130,78 +116,4 @@ void MSpriteMADS::loadSprite(Common::SeekableReadStream *source) {
}
}
-/*------------------------------------------------------------------------*/
-
-void MSpriteM4::load(Common::SeekableReadStream *stream, int widthVal, int heightVal,
- bool decodeRle) {
- if (decodeRle) {
- loadRle(stream);
- } else {
- // Raw sprite data, load directly
- byte *dst = _surface.getData();
- stream->read(dst, widthVal * heightVal);
- }
-}
-
-void MSpriteM4::loadRle(Common::SeekableReadStream* rleData) {
- byte *dst = _surface.getData();
- for (;;) {
- byte len = rleData->readByte();
- if (len == 0) {
- len = rleData->readByte();
- if (len <= kMarker) {
- if (len == kEndOfSprite)
- break;
- } else {
- while (len--) {
- *dst++ = rleData->readByte();
- }
- }
- } else {
- byte value = rleData->readByte();
- while (len--)
- *dst++ = value;
- }
- }
-}
-
-void MSpriteM4::loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY) {
- int lineNum = 0;
- byte *dst = _surface.getBasePtr(destX, destY);
-
- for (;;) {
- byte len = rleData->readByte();
- if (len == 0) {
- len = rleData->readByte();
- if (len <= kMarker) {
- if (len == kEndOfLine) {
- dst = _surface.getBasePtr(destX, destY + lineNum);
- lineNum++;
- } else if (len == kEndOfSprite)
- break;
- } else {
- while (len--) {
- byte pixel = rleData->readByte();
- if (pixel == 0)
- dst++;
- else
- *dst++ = pixel;
- /* NOTE: The change below behaved differently than the old code,
- so I put the old code back in again above.
- If the pixel value is 0, nothing should be written to the
- output buffer, since 0 means transparent. */
- //*dst++ = (pixel == 0xFD) ? 0 : pixel;
- }
- }
- } else {
- byte value = rleData->readByte();
- if (value == 0)
- dst += len;
- else
- while (len--)
- *dst++ = value;
- }
- }
-}
-
} // End of namespace MADS
diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h
index c454597a3a..bb21772908 100644
--- a/engines/mads/msprite.h
+++ b/engines/mads/msprite.h
@@ -107,7 +107,7 @@ protected:
MSprite(Common::SeekableReadStream *source, const Common::Point &offset,
int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0);
- virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle) {}
+ void loadSprite(Common::SeekableReadStream *source);
public:
static void setVm(MADSEngine *vm) { _vm = vm; }
virtual ~MSprite();
@@ -118,35 +118,6 @@ public:
uint8 _encoding;
};
-class MSpriteMADS: public MSprite {
- friend class MSprite;
-private:
- void loadSprite(Common::SeekableReadStream *source);
-protected:
- MSpriteMADS(MSurface &s): MSprite(s) {}
- MSpriteMADS(Common::SeekableReadStream *source, const Common::Point &offset,
- int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0):
- MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {}
-
- virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle);
-};
-
-class MSpriteM4: public MSprite {
- friend class MSprite;
-private:
- // Loads a sprite from the given stream, and optionally decompresses the RLE-encoded data
- // Loads an RLE compressed sprite; the surface must have been created before
- void loadRle(Common::SeekableReadStream *rleData);
- void loadDeltaRle(Common::SeekableReadStream *rleData, int destX, int destY);
-protected:
- MSpriteM4(MSurface &s): MSprite(s) {}
- MSpriteM4(Common::SeekableReadStream *source, const Common::Point &offset,
- int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0):
- MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {}
-
- virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle);
-};
-
} // End of namespace MADS
#endif /* MADS_MSPRITE_H */
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp
index 2c0b433159..b4ee129545 100644
--- a/engines/mads/msurface.cpp
+++ b/engines/mads/msurface.cpp
@@ -35,20 +35,16 @@ MADSEngine *MSurface::_vm = nullptr;
MSurface *MSurface::init(bool isScreen) {
if (_vm->getGameID() == GType_RexNebular) {
return new MSurfaceNebular(isScreen);
- } else if (_vm->getGameFeatures() & GF_MADS) {
- return new MSurfaceMADS(isScreen);
} else {
- return new MSurfaceM4(isScreen);
+ return new MSurfaceMADS(isScreen);
}
}
MSurface *MSurface::init(int width, int height) {
if (_vm->getGameID() == GType_RexNebular) {
return new MSurfaceNebular(width, height);
- } else if (_vm->getGameFeatures() & GF_MADS) {
- return new MSurfaceMADS(width, height);
} else {
- return new MSurfaceM4(width, height);
+ return new MSurfaceMADS(width, height);
}
}
@@ -579,96 +575,4 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R
delete sourceUnc;
}
-/*------------------------------------------------------------------------*/
-
-void MSurfaceM4::loadCodes(Common::SeekableReadStream *source) {
- if (!source) {
- free();
- return;
- }
-
- uint16 width = source->readUint16LE();
- uint16 height = source->readUint16LE();
-
- setSize(width, height);
- source->read(pixels, width * height);
-}
-
-void MSurfaceM4::loadBackground(int roomNumber, RGBList **palData) {
- if (palData)
- *palData = NULL;
- Common::String resourceName = Common::String::format("%i.tt", roomNumber);
- Common::SeekableReadStream *stream = nullptr;//_vm->_resources->get(resourceName);
- loadBackgroundStream(stream);
-
-// _vm->_resources->toss(resourceName);
-}
-
-void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) {
- MSurface *tileBuffer = MSurface::init();
- uint curTileX = 0, curTileY = 0;
- int clipX = 0, clipY = 0;
- byte palette[256];
-
- source->skip(4);
- /*uint32 size =*/ source->readUint32LE();
- uint32 width = source->readUint32LE();
- uint32 height = source->readUint32LE();
- uint32 tilesX = source->readUint32LE();
- uint32 tilesY = source->readUint32LE();
- uint32 tileWidth = source->readUint32LE();
- uint32 tileHeight = source->readUint32LE();
- uint8 blackIndex = 0;
-
- // BGR data, which is converted to RGB8
- for (uint i = 0; i < 256; i++) {
- byte r, g, b;
- palette[i * 3] = r = source->readByte() << 2;
- palette[i * 3 + 1] = g = source->readByte() << 2;
- palette[i * 3 + 2] = b = source->readByte() << 2;
- source->skip(1);
-
- if ((blackIndex == 0) && !r && !g && !b)
- blackIndex = i;
- }
-
- _vm->_palette->setPalette(palette, 0, 256);
-
- // resize or create the surface
- // Note that the height of the scene in game scenes is smaller than the screen height,
- // as the bottom part of the screen is the inventory
- assert(getWidth() == (int)width);
-
- tileBuffer->setSize(tileWidth, tileHeight);
-
- for (curTileY = 0; curTileY < tilesY; curTileY++) {
- clipY = MIN(height, (1 + curTileY) * tileHeight) - (curTileY * tileHeight);
-
- for (curTileX = 0; curTileX < tilesX; curTileX++) {
- clipX = MIN(width, (1 + curTileX) * tileWidth) - (curTileX * tileWidth);
-
- // Read a tile and copy it to the destination surface
- source->read(tileBuffer->getData(), tileWidth * tileHeight);
- Common::Rect srcBounds(0, 0, clipX, clipY);
- copyFrom(tileBuffer, srcBounds,
- Common::Point(curTileX * tileWidth, curTileY * tileHeight));
- }
- }
-
- if (height < (uint)getHeight())
- fillRect(Common::Rect(0, height, getWidth(), getHeight()), blackIndex);
-
- delete tileBuffer;
-}
-
-/*------------------------------------------------------------------------*/
-
-void MSurfaceRiddle::loadBackground(const Common::String &sceneName) {
- // Loads a Riddle scene
- Common::String resName = Common::String::format("%s.tt", sceneName.c_str());
- File stream(resName);
-
- loadBackgroundStream(&stream);
-}
-
} // End of namespace MADS
diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h
index 42c56e9393..940c5b5704 100644
--- a/engines/mads/msurface.h
+++ b/engines/mads/msurface.h
@@ -282,27 +282,6 @@ public:
virtual void loadBackground(int roomNumber, RGBList **palData);
};
-class MSurfaceM4: public MSurface {
- friend class MSurface;
-protected:
- MSurfaceM4(bool isScreen = false): MSurface(isScreen) {}
- MSurfaceM4(int width, int height): MSurface(width, height) {}
-
- void loadBackgroundStream(Common::SeekableReadStream *source);
-public:
- virtual void loadCodes(Common::SeekableReadStream *source);
- virtual void loadBackground(int roomNumber, RGBList **palData);
-};
-
-class MSurfaceRiddle: public MSurfaceM4 {
- friend class MSurface;
-protected:
- MSurfaceRiddle(bool isScreen = false): MSurfaceM4(isScreen) {}
- MSurfaceRiddle(int width, int height): MSurfaceM4(width, height) {}
-public:
- virtual void loadBackground(const Common::String &sceneName);
-};
-
} // End of namespace MADS
#endif /* MADS_MSURFACE_H */
diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp
index ac46df96c5..fe021fcfd8 100644
--- a/engines/mads/resources.cpp
+++ b/engines/mads/resources.cpp
@@ -89,10 +89,7 @@ public:
};
void ResourcesManager::init(MADSEngine *vm) {
- if (vm->getGameFeatures() & GF_MADS)
- SearchMan.add("HAG", new HagArchive());
- else
- error("Unsupported game engine");
+ SearchMan.add("HAG", new HagArchive());
}
/*------------------------------------------------------------------------*/