aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2010-11-18 16:38:03 +0000
committerMax Horn2010-11-18 16:38:03 +0000
commita008d1405582e1a25e5dea57b19d03899f44542d (patch)
treebbe73d970029d3acd94a5f47f266b00e4490c520 /engines
parent4707b610fca45c0762e25994594fc58557945a02 (diff)
downloadscummvm-rg350-a008d1405582e1a25e5dea57b19d03899f44542d.tar.gz
scummvm-rg350-a008d1405582e1a25e5dea57b19d03899f44542d.tar.bz2
scummvm-rg350-a008d1405582e1a25e5dea57b19d03899f44542d.zip
ENGINES: Do not use MemoryReadStream where (Seekable)ReadStream suffices; avoid using 'using'
svn-id: r54323
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/script.cpp2
-rw-r--r--engines/draci/script.h4
-rw-r--r--engines/gob/resources.cpp4
-rw-r--r--engines/gob/resources.h10
-rw-r--r--engines/saga/actor.h2
-rw-r--r--engines/saga/animation.cpp4
-rw-r--r--engines/saga/objectmap.cpp2
-rw-r--r--engines/saga/objectmap.h2
-rw-r--r--engines/saga/resource.cpp4
-rw-r--r--engines/saga/saga.h8
-rw-r--r--engines/saga/script.h2
-rw-r--r--engines/saga/sprite.cpp6
-rw-r--r--engines/saga/sthread.cpp2
13 files changed, 25 insertions, 27 deletions
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index f657dfe33c..583afa736f 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -900,7 +900,7 @@ void Script::popNewRoom(const Common::Array<int> &params) {
* @brief Evaluates mathematical expressions
* @param reader Stream reader set to the beginning of the expression
*/
-int Script::handleMathExpression(Common::MemoryReadStream *reader) const {
+int Script::handleMathExpression(Common::ReadStream *reader) const {
Common::Stack<int> stk;
mathExpressionObject obj;
GPL2Operator oper;
diff --git a/engines/draci/script.h b/engines/draci/script.h
index 1551d3573c..e81691204e 100644
--- a/engines/draci/script.h
+++ b/engines/draci/script.h
@@ -30,7 +30,7 @@
#include "common/stream.h"
namespace Common {
- class MemoryReadStream;
+ class ReadStream;
}
namespace Draci {
@@ -193,7 +193,7 @@ private:
void setupCommandList();
const GPL2Command *findCommand(byte num, byte subnum) const;
- int handleMathExpression(Common::MemoryReadStream *reader) const;
+ int handleMathExpression(Common::ReadStream *reader) const;
DraciEngine *_vm;
};
diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index b5b3d7aaa2..9b0cc39215 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -71,7 +71,7 @@ int16 Resource::getHeight() const {
return _height;
}
-Common::MemoryReadStream *Resource::stream() const {
+Common::SeekableReadStream *Resource::stream() const {
return _stream;
}
@@ -95,7 +95,7 @@ int32 TextItem::getSize() const {
return _size;
}
-Common::MemoryReadStream *TextItem::stream() const {
+Common::SeekableReadStream *TextItem::stream() const {
return _stream;
}
diff --git a/engines/gob/resources.h b/engines/gob/resources.h
index 7511185954..9921dc6e76 100644
--- a/engines/gob/resources.h
+++ b/engines/gob/resources.h
@@ -29,7 +29,7 @@
#include "common/str.h"
namespace Common {
- class MemoryReadStream;
+ class SeekableReadStream;
}
namespace Gob {
@@ -47,7 +47,7 @@ public:
int16 getWidth () const;
int16 getHeight() const;
- Common::MemoryReadStream *stream() const;
+ Common::SeekableReadStream *stream() const;
private:
byte *_data;
@@ -56,7 +56,7 @@ private:
int16 _height;
bool _needFree;
- Common::MemoryReadStream *_stream;
+ Common::SeekableReadStream *_stream;
};
class TextItem {
@@ -67,13 +67,13 @@ public:
byte *getData() const;
int32 getSize() const;
- Common::MemoryReadStream *stream() const;
+ Common::SeekableReadStream *stream() const;
private:
byte *_data;
int32 _size;
- Common::MemoryReadStream *_stream;
+ Common::SeekableReadStream *_stream;
};
class Resources {
diff --git a/engines/saga/actor.h b/engines/saga/actor.h
index 2b6b5c2a3b..6f74eea771 100644
--- a/engines/saga/actor.h
+++ b/engines/saga/actor.h
@@ -267,7 +267,7 @@ struct Location {
screenPoint.x = x / ACTOR_LMULT;
screenPoint.y = y / ACTOR_LMULT - z;
}
- void fromStream(MemoryReadStream &stream) {
+ void fromStream(Common::ReadStream &stream) {
x = stream.readUint16LE();
y = stream.readUint16LE();
z = stream.readUint16LE();
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index aca29ed82e..4aee111aa7 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -680,7 +680,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
error("decodeFrame() Buffer size inadequate");
}
- MemoryReadStream readS(&anim->resourceData[frameOffset], anim->resourceData.size() - frameOffset);
+ Common::MemoryReadStream readS(&anim->resourceData[frameOffset], anim->resourceData.size() - frameOffset);
// FIXME: This is thrown when the first video of the IHNM end sequence is shown (the "turn off screen"
// video), however the video is played correctly and the rest of the end sequence continues normally
@@ -817,7 +817,7 @@ int Anim::fillFrameOffsets(AnimationData *anim, bool reallyFill) {
int i;
bool longData = isLongData();
- MemoryReadStreamEndian readS(&anim->resourceData.front(), anim->resourceData.size(), !_vm->isBigEndian()); // RLE has inversion BE<>LE
+ Common::MemoryReadStreamEndian readS(&anim->resourceData.front(), anim->resourceData.size(), !_vm->isBigEndian()); // RLE has inversion BE<>LE
while (readS.pos() != readS.size()) {
if (reallyFill) {
diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp
index 61d90cda69..9799edc34a 100644
--- a/engines/saga/objectmap.cpp
+++ b/engines/saga/objectmap.cpp
@@ -45,7 +45,7 @@
namespace Saga {
-void HitZone::load(SagaEngine *vm, MemoryReadStreamEndian *readStream, int index, int sceneNumber) {
+void HitZone::load(SagaEngine *vm, Common::MemoryReadStreamEndian *readStream, int index, int sceneNumber) {
_index = index;
_flags = readStream->readByte();
_clickAreas.resize(readStream->readByte());
diff --git a/engines/saga/objectmap.h b/engines/saga/objectmap.h
index 446afd478e..9e7c004fc0 100644
--- a/engines/saga/objectmap.h
+++ b/engines/saga/objectmap.h
@@ -36,7 +36,7 @@ private:
typedef Common::Array<Point> ClickArea;
typedef Common::Array<ClickArea> ClickAreas;
public:
- void load(SagaEngine *vm, MemoryReadStreamEndian *readStream, int index, int sceneNumber);
+ void load(SagaEngine *vm, Common::MemoryReadStreamEndian *readStream, int index, int sceneNumber);
int getIndex() const {
return _index;
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index 0fb7327f0d..169c901950 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -58,7 +58,7 @@ bool ResourceContext::loadResV1(uint32 contextOffset, uint32 contextSize) {
return false;
}
- MemoryReadStreamEndian readS(tableInfo, RSC_TABLEINFO_SIZE, _isBigEndian);
+ Common::MemoryReadStreamEndian readS(tableInfo, RSC_TABLEINFO_SIZE, _isBigEndian);
resourceTableOffset = readS.readUint32();
count = readS.readUint32();
@@ -77,7 +77,7 @@ bool ResourceContext::loadResV1(uint32 contextOffset, uint32 contextSize) {
if (result) {
_table.resize(count);
- MemoryReadStreamEndian readS1(tableBuffer.getBuffer(), tableBuffer.size(), _isBigEndian);
+ Common::MemoryReadStreamEndian readS1(tableBuffer.getBuffer(), tableBuffer.size(), _isBigEndian);
for (i = 0; i < count; i++) {
resourceData = &_table[i];
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 8eb4833278..f710a9e8ab 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -83,9 +83,6 @@ class Resource;
class ResourceContext;
-using Common::MemoryReadStream;
-using Common::MemoryReadStreamEndian;
-
// #define SAGA_DEBUG 1 // define for test functions
#define SAGA_IMAGE_DATA_OFFSET 776
#define SAGA_IMAGE_HEADER_LEN 8
@@ -480,9 +477,10 @@ public:
}
};
-class ByteArrayReadStreamEndian : public MemoryReadStreamEndian {
+class ByteArrayReadStreamEndian : public Common::MemoryReadStreamEndian {
public:
- ByteArrayReadStreamEndian(const ByteArray & byteArray, bool bigEndian = false) : MemoryReadStreamEndian(byteArray.getBuffer(), byteArray.size(), bigEndian) {
+ ByteArrayReadStreamEndian(const ByteArray & byteArray, bool bigEndian = false)
+ : Common::MemoryReadStreamEndian(byteArray.getBuffer(), byteArray.size(), bigEndian) {
}
};
diff --git a/engines/saga/script.h b/engines/saga/script.h
index e5054d5f4e..080b1558d6 100644
--- a/engines/saga/script.h
+++ b/engines/saga/script.h
@@ -270,7 +270,7 @@ public:
typedef Common::List<ScriptThread> ScriptThreadList;
-#define SCRIPTOP_PARAMS ScriptThread *thread, MemoryReadStream *scriptS, bool &stopParsing, bool &breakOut
+#define SCRIPTOP_PARAMS ScriptThread *thread, Common::SeekableReadStream *scriptS, bool &stopParsing, bool &breakOut
#define SCRIPTFUNC_PARAMS ScriptThread *thread, int nArgs, bool &disContinue
#define OPCODE(x) {&Script::x, #x}
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp
index eb62fb20ff..cbe18040a2 100644
--- a/engines/saga/sprite.cpp
+++ b/engines/saga/sprite.cpp
@@ -122,7 +122,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
spritePointer += offset;
if (bigHeader) {
- MemoryReadStreamEndian readS2(spritePointer, 8, _spriteContext->isBigEndian());
+ Common::MemoryReadStreamEndian readS2(spritePointer, 8, _spriteContext->isBigEndian());
spriteInfo->xAlign = readS2.readSint16();
spriteInfo->yAlign = readS2.readSint16();
@@ -132,7 +132,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
spriteDataPointer = spritePointer + readS2.pos();
} else {
- MemoryReadStreamEndian readS2(spritePointer, 4);
+ Common::MemoryReadStreamEndian readS2(spritePointer, 4);
spriteInfo->xAlign = readS2.readSByte();
spriteInfo->yAlign = readS2.readSByte();
@@ -438,7 +438,7 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou
memset(outPointer, 0, _decodeBuf.size());
- MemoryReadStream readS(inputBuffer, inLength);
+ Common::MemoryReadStream readS(inputBuffer, inLength);
while (!readS.eos() && (outPointer < outPointerEnd)) {
bg_runcount = readS.readByte();
diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp
index 098970f4e8..0b59f3ba17 100644
--- a/engines/saga/sthread.cpp
+++ b/engines/saga/sthread.cpp
@@ -198,7 +198,7 @@ bool Script::runThread(ScriptThread &thread) {
bool breakOut = false;
int operandChar;
- MemoryReadStream scriptS(thread._moduleBase, thread._moduleBaseSize);
+ Common::MemoryReadStream scriptS(thread._moduleBase, thread._moduleBaseSize);
scriptS.seek(thread._instructionOffset);