aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/stream.h29
-rw-r--r--engines/saga/actor.h2
-rw-r--r--engines/saga/animation.h2
-rw-r--r--engines/saga/font.cpp1
-rw-r--r--engines/saga/gfx.cpp1
-rw-r--r--engines/saga/image.cpp2
-rw-r--r--engines/saga/isomap.cpp1
-rw-r--r--engines/saga/music.cpp4
-rw-r--r--engines/saga/objectmap.cpp1
-rw-r--r--engines/saga/objectmap.h2
-rw-r--r--engines/saga/palanim.cpp1
-rw-r--r--engines/saga/rscfile.cpp1
-rw-r--r--engines/saga/saga.h3
-rw-r--r--engines/saga/scene.cpp1
-rw-r--r--engines/saga/script.cpp1
-rw-r--r--engines/saga/sndres.cpp1
-rw-r--r--engines/saga/sound.cpp2
-rw-r--r--engines/saga/sound.h2
-rw-r--r--engines/saga/sprite.cpp1
-rw-r--r--engines/saga/sthread.cpp1
-rw-r--r--engines/saga/stream.h60
21 files changed, 37 insertions, 82 deletions
diff --git a/common/stream.h b/common/stream.h
index d7d96f3605..deb018aad5 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -402,6 +402,35 @@ public:
void seek(int32 offs, int whence = SEEK_SET);
};
+
+/**
+ * This is a wrapper around MemoryReadStream, but it adds non-endian
+ * read methods whose endianness is set on the stream creation.
+ */
+class MemoryReadStreamEndian : public Common::MemoryReadStream {
+private:
+public:
+ bool _bigEndian;
+ MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian = false) : MemoryReadStream(buf, len), _bigEndian(bigEndian) {}
+
+ uint16 readUint16() {
+ return (_bigEndian) ? readUint16BE(): readUint16LE();
+ }
+
+ uint32 readUint32() {
+ return (_bigEndian) ? readUint32BE(): readUint32LE();
+ }
+
+ inline int16 readSint16() {
+ return (int16)readUint16();
+ }
+
+
+ inline int32 readSint32() {
+ return (int32)readUint32();
+ }
+};
+
/**
* Simple memory based 'stream', which implements the WriteStream interface for
* a plain memory block.
diff --git a/engines/saga/actor.h b/engines/saga/actor.h
index 7022ef1289..d0a31dc7d6 100644
--- a/engines/saga/actor.h
+++ b/engines/saga/actor.h
@@ -262,7 +262,7 @@ struct Location {
screenPoint.x = x / ACTOR_LMULT;
screenPoint.y = y / ACTOR_LMULT - z;
}
- void fromStream(Common::MemoryReadStream &stream) {
+ void fromStream(MemoryReadStream &stream) {
x = stream.readUint16LE();
y = stream.readUint16LE();
z = stream.readUint16LE();
diff --git a/engines/saga/animation.h b/engines/saga/animation.h
index 4306d8e00d..1d20cc5d76 100644
--- a/engines/saga/animation.h
+++ b/engines/saga/animation.h
@@ -28,8 +28,6 @@
#ifndef SAGA_ANIMATION_H
#define SAGA_ANIMATION_H
-#include "saga/stream.h"
-
namespace Saga {
#define MAX_ANIMATIONS 10
diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp
index 06e51a78e4..6ec30e570f 100644
--- a/engines/saga/font.cpp
+++ b/engines/saga/font.cpp
@@ -30,7 +30,6 @@
#include "saga/rscfile.h"
#include "saga/font.h"
-#include "saga/stream.h"
namespace Saga {
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 8509da62ed..4ce704a6b7 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -31,7 +31,6 @@
#include "saga/sagaresnames.h"
#include "saga/rscfile.h"
#include "saga/scene.h"
-#include "saga/stream.h"
#include "common/system.h"
#include "graphics/cursorman.h"
diff --git a/engines/saga/image.cpp b/engines/saga/image.cpp
index 9f72036634..d611655edd 100644
--- a/engines/saga/image.cpp
+++ b/engines/saga/image.cpp
@@ -27,8 +27,6 @@
#include "saga/saga.h"
-#include "saga/stream.h"
-
namespace Saga {
static int granulate(int value, int granularity) {
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp
index 4f635c6e3b..b889397280 100644
--- a/engines/saga/isomap.cpp
+++ b/engines/saga/isomap.cpp
@@ -32,7 +32,6 @@
#include "saga/sagaresnames.h"
#include "saga/scene.h"
#include "saga/isomap.h"
-#include "saga/stream.h"
namespace Saga {
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index 7181343717..171da1cc8c 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -30,7 +30,7 @@
#include "saga/rscfile.h"
#include "saga/sagaresnames.h"
#include "saga/music.h"
-#include "saga/stream.h"
+
#include "sound/audiostream.h"
#include "sound/mididrv.h"
#include "sound/midiparser.h"
@@ -57,7 +57,7 @@ private:
const int16 *_bufferEnd;
const int16 *_pos;
const GameSoundInfo *_musicInfo;
- Common::MemoryReadStream *_memoryStream;
+ MemoryReadStream *_memoryStream;
void refill();
bool eosIntern() const {
diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp
index 9e633a6709..c5bc46d47b 100644
--- a/engines/saga/objectmap.cpp
+++ b/engines/saga/objectmap.cpp
@@ -36,7 +36,6 @@
#include "saga/font.h"
#include "saga/interface.h"
#include "saga/objectmap.h"
-#include "saga/stream.h"
#include "saga/actor.h"
#include "saga/scene.h"
#include "saga/isomap.h"
diff --git a/engines/saga/objectmap.h b/engines/saga/objectmap.h
index c3b50c7497..2d4d793db9 100644
--- a/engines/saga/objectmap.h
+++ b/engines/saga/objectmap.h
@@ -28,8 +28,6 @@
#ifndef SAGA_OBJECTMAP_H
#define SAGA_OBJECTMAP_H
-#include "saga/stream.h"
-
namespace Saga {
diff --git a/engines/saga/palanim.cpp b/engines/saga/palanim.cpp
index f318b815cc..40604bde4c 100644
--- a/engines/saga/palanim.cpp
+++ b/engines/saga/palanim.cpp
@@ -30,7 +30,6 @@
#include "saga/events.h"
#include "saga/palanim.h"
-#include "saga/stream.h"
namespace Saga {
diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp
index ba56e838b7..e47b8e86c1 100644
--- a/engines/saga/rscfile.cpp
+++ b/engines/saga/rscfile.cpp
@@ -34,7 +34,6 @@
#include "saga/rscfile.h"
#include "saga/scene.h"
#include "saga/sndres.h"
-#include "saga/stream.h"
#include "common/advancedDetector.h"
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index eece1ee039..705213d84f 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -61,6 +61,9 @@ class Resource;
struct ResourceContext;
struct StringList;
+using Common::MemoryReadStream;
+using Common::MemoryReadStreamEndian;
+
//#define MIN_IMG_RLECODE 3
//#define MODEX_SCANLINE_LIMIT 200 //TODO: remove
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index 9a5bea8ed6..dbcca5021c 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -41,7 +41,6 @@
#include "saga/music.h"
#include "saga/scene.h"
-#include "saga/stream.h"
#include "saga/actor.h"
#include "saga/rscfile.h"
#include "saga/sagaresnames.h"
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp
index b2e1f267ae..83ef1e9df1 100644
--- a/engines/saga/script.cpp
+++ b/engines/saga/script.cpp
@@ -30,7 +30,6 @@
#include "saga/console.h"
#include "saga/script.h"
-#include "saga/stream.h"
#include "saga/interface.h"
#include "saga/itedata.h"
#include "saga/scene.h"
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index ac21656dfa..a7a186ac1a 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -32,7 +32,6 @@
#include "saga/rscfile.h"
#include "saga/sndres.h"
#include "saga/sound.h"
-#include "saga/stream.h"
#include "common/file.h"
diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp
index 621b3ed310..39e011e111 100644
--- a/engines/saga/sound.cpp
+++ b/engines/saga/sound.cpp
@@ -84,7 +84,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int
_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
} else {
Audio::AudioStream *stream = NULL;
- Common::MemoryReadStream *tmp = NULL;
+ MemoryReadStream *tmp = NULL;
switch (buffer.soundType) {
#ifdef USE_MAD
diff --git a/engines/saga/sound.h b/engines/saga/sound.h
index 961f8eba56..efe26e6b24 100644
--- a/engines/saga/sound.h
+++ b/engines/saga/sound.h
@@ -96,7 +96,7 @@ public:
SagaEngine *_vm;
Audio::Mixer *_mixer;
- Common::MemoryReadStream *_voxStream;
+ MemoryReadStream *_voxStream;
SndHandle _handles[SOUND_HANDLES];
};
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp
index ac911e5a9c..f36f25f385 100644
--- a/engines/saga/sprite.cpp
+++ b/engines/saga/sprite.cpp
@@ -34,7 +34,6 @@
#include "saga/font.h"
#include "saga/sprite.h"
-#include "saga/stream.h"
namespace Saga {
diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp
index 0749488aca..c949641c07 100644
--- a/engines/saga/sthread.cpp
+++ b/engines/saga/sthread.cpp
@@ -33,7 +33,6 @@
#include "saga/script.h"
-#include "saga/stream.h"
#include "saga/scene.h"
#include "saga/sagaresnames.h"
diff --git a/engines/saga/stream.h b/engines/saga/stream.h
deleted file mode 100644
index 2564f097e1..0000000000
--- a/engines/saga/stream.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SAGA_STREAM_H
-#define SAGA_STREAM_H
-
-#include "common/stream.h"
-
-namespace Saga {
-
-using Common::MemoryReadStream;
-
-class MemoryReadStreamEndian : public Common::MemoryReadStream {
-private:
-public:
- bool _bigEndian;
- MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian = false) : MemoryReadStream(buf, len), _bigEndian(bigEndian) {}
-
- uint16 readUint16() {
- return (_bigEndian) ? readUint16BE(): readUint16LE();
- }
-
- uint32 readUint32() {
- return (_bigEndian) ? readUint32BE(): readUint32LE();
- }
-
- inline int16 readSint16() {
- return (int16)readUint16();
- }
-
-
- inline int32 readSint32() {
- return (int32)readUint32();
- }
-};
-
-} // End of namespace Saga
-#endif