ENGINES: Do not use MemoryReadStream where (Seekable)ReadStream suffices; avoid using 'using'

svn-id: r54323
This commit is contained in:
Max Horn 2010-11-18 16:38:03 +00:00
parent 4707b610fc
commit a008d14055
13 changed files with 25 additions and 27 deletions

View file

@ -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;

View file

@ -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;
};

View file

@ -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;
}

View file

@ -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 {

View file

@ -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();

View file

@ -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) {

View file

@ -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());

View file

@ -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;

View file

@ -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];

View file

@ -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) {
}
};

View file

@ -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}

View file

@ -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();

View file

@ -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);