aboutsummaryrefslogtreecommitdiff
path: root/engines/m4
diff options
context:
space:
mode:
Diffstat (limited to 'engines/m4')
-rw-r--r--engines/m4/assets.cpp4
-rw-r--r--engines/m4/compression.cpp6
-rw-r--r--engines/m4/compression.h4
-rw-r--r--engines/m4/converse.cpp1
-rw-r--r--engines/m4/graphics.cpp2
-rw-r--r--engines/m4/m4.cpp2
-rw-r--r--engines/m4/midi.cpp2
-rw-r--r--engines/m4/resource.cpp2
-rw-r--r--engines/m4/script.h2
-rw-r--r--engines/m4/woodscript.cpp2
-rw-r--r--engines/m4/woodscript.h2
11 files changed, 20 insertions, 9 deletions
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp
index 07cbff5bf1..c4113e00d0 100644
--- a/engines/m4/assets.cpp
+++ b/engines/m4/assets.cpp
@@ -28,6 +28,8 @@
#include "m4/compression.h"
#include "m4/graphics.h"
+#include "common/memstream.h"
+
namespace M4 {
BaseAsset::BaseAsset(MadsM4Engine *vm) : _vm(vm) {
@@ -382,7 +384,7 @@ void SpriteAsset::loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX,
loadFrameHeader(frameHeader);
if (frameHeader.w > 0 && frameHeader.h > 0) {
- Common::MemoryReadStream *frameData = _stream->readStream(getFrameSize(frameIndex));
+ Common::SeekableReadStream *frameData = _stream->readStream(getFrameSize(frameIndex));
if (frameHeader.stream) {
frame->loadDeltaRle(frameData, destX - frameHeader.x, destY - frameHeader.y);
} else {
diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp
index 2b3f4e1388..9b1416945c 100644
--- a/engines/m4/compression.cpp
+++ b/engines/m4/compression.cpp
@@ -26,6 +26,8 @@
#include "m4/compression.h"
#include "m4/m4.h"
+#include "common/memstream.h"
+
namespace M4 {
const char *madsPackString = "MADSPACK";
@@ -90,6 +92,10 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) {
_dataOffset = stream->pos();
}
+Common::SeekableReadStream *MadsPack::getItemStream(int index) {
+ return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO);
+}
+
MadsPack::~MadsPack() {
for (int i = 0; i < _count; ++i)
delete[] _items[i].data;
diff --git a/engines/m4/compression.h b/engines/m4/compression.h
index 00e3d1f927..93c7d9af9e 100644
--- a/engines/m4/compression.h
+++ b/engines/m4/compression.h
@@ -58,9 +58,7 @@ public:
int getCount() const { return _count; }
MadsPackEntry &getItem(int index) const { return _items[index]; }
MadsPackEntry &operator[](int index) const { return _items[index]; }
- Common::MemoryReadStream *getItemStream(int index) {
- return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO);
- }
+ Common::SeekableReadStream *getItemStream(int index);
int getDataOffset() const { return _dataOffset; }
};
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 1a0e2e8d3b..70c30d28f2 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "common/hashmap.h"
+#include "common/substream.h"
#include "m4/converse.h"
#include "m4/resource.h"
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index 6d01db50bd..eb2fc9e4b5 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -740,7 +740,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) {
void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData) {
MadsPack packData(source);
- Common::MemoryReadStream *sourceUnc = packData.getItemStream(0);
+ Common::SeekableReadStream *sourceUnc = packData.getItemStream(0);
int sceneWidth = sourceUnc->readUint16LE();
int sceneHeight = sourceUnc->readUint16LE();
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 93490a0821..73dba87e99 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -288,7 +288,7 @@ void MadsM4Engine::dumpFile(const char* filename, bool uncompress) {
}
} else {
MadsPack packData(fileS);
- Common::MemoryReadStream *sourceUnc;
+ Common::SeekableReadStream *sourceUnc;
for (int i = 0; i < packData.getCount(); i++) {
sourceUnc = packData.getItemStream(i);
debugCN(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index 2c767fdf5a..f130ddc3b5 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -28,7 +28,7 @@
#include "m4/m4.h"
#include "m4/midi.h"
-#include "common/stream.h"
+#include "common/memstream.h"
namespace M4 {
diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp
index fd54d439a6..70abc47960 100644
--- a/engines/m4/resource.cpp
+++ b/engines/m4/resource.cpp
@@ -27,6 +27,8 @@
#include "m4/resource.h"
#include "m4/events.h"
+#include "common/substream.h"
+
namespace M4 {
FileSystem::FileSystem(const char *hashFilename) {
diff --git a/engines/m4/script.h b/engines/m4/script.h
index 2012926330..32b5701419 100644
--- a/engines/m4/script.h
+++ b/engines/m4/script.h
@@ -223,7 +223,7 @@ public:
uint32 readUint32();
protected:
ScriptInterpreter *_inter;
- Common::MemoryReadStream *_code;
+ Common::SeekableReadStream *_code;
};
struct ScriptFunctionEntry {
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index ccd3401d3c..4928e0af8d 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -25,6 +25,8 @@
#include "m4/woodscript.h"
+#include "common/memstream.h"
+
namespace M4 {
// FIXME: Put in Engine/WoodScript class
diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h
index 0f72935f8d..4b0f457193 100644
--- a/engines/m4/woodscript.h
+++ b/engines/m4/woodscript.h
@@ -77,7 +77,7 @@ public:
uint32 pos() const { return _code->pos() / 4; }
protected:
WoodScript *_ws;
- Common::MemoryReadStream *_code;
+ Common::SeekableReadStream *_code;
Sequence *_sequence;
static int32 _dataFormats[];
bool decodeArgument(int32 format, int32 data, long *&arg, long &value);