aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel
diff options
context:
space:
mode:
authorMax Horn2010-11-23 22:26:43 +0000
committerMax Horn2010-11-23 22:26:43 +0000
commitb485d0ee49f305bcb241447988309eac9c38c4c7 (patch)
tree9afcc4fb9d31732a694c1eff8b7e9c9ad07d620e /engines/tinsel
parent382982d6e3b99ae8890133e08c063332c00aa221 (diff)
downloadscummvm-rg350-b485d0ee49f305bcb241447988309eac9c38c4c7.tar.gz
scummvm-rg350-b485d0ee49f305bcb241447988309eac9c38c4c7.tar.bz2
scummvm-rg350-b485d0ee49f305bcb241447988309eac9c38c4c7.zip
TINSEL: Turn TinselFile into a SeekableReadStream
svn-id: r54439
Diffstat (limited to 'engines/tinsel')
-rw-r--r--engines/tinsel/drives.cpp27
-rw-r--r--engines/tinsel/drives.h25
2 files changed, 13 insertions, 39 deletions
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp
index 06b4968e8b..53cc59e260 100644
--- a/engines/tinsel/drives.cpp
+++ b/engines/tinsel/drives.cpp
@@ -153,7 +153,7 @@ bool GotoCD() {
bool TinselFile::_warningShown = false;
-TinselFile::TinselFile() {
+TinselFile::TinselFile() : ReadStreamEndian((_vm->getFeatures() & GF_BIG_ENDIAN) != 0) {
_stream = NULL;
}
@@ -168,8 +168,7 @@ bool TinselFile::openInternal(const Common::String &filename) {
if (!stream)
return false;
- _stream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(),
- (_vm->getFeatures() & GF_BIG_ENDIAN) != 0, DisposeAfterUse::YES);
+ _stream = new Common::SeekableSubReadStream(stream, 0, stream->size(), DisposeAfterUse::YES);
return true;
}
@@ -226,24 +225,9 @@ bool TinselFile::err() const {
return _stream->err();
}
-uint32 TinselFile::readUint32() {
+void TinselFile::clearErr() {
assert(_stream);
- return _stream->readUint32();
-}
-
-int16 TinselFile::readSint16() {
- assert(_stream);
- return _stream->readUint16();
-}
-
-int32 TinselFile::readSint32() {
- assert(_stream);
- return _stream->readUint32();
-}
-
-Common::SeekableReadStream *TinselFile::readStream(uint32 dataSize) {
- assert(_stream);
- return _stream->readStream(dataSize);
+ _stream->clearErr();
}
uint32 TinselFile::read(void *dataPtr, uint32 dataSize) {
@@ -251,9 +235,6 @@ uint32 TinselFile::read(void *dataPtr, uint32 dataSize) {
return _stream->read(dataPtr, dataSize);
}
-bool TinselFile::skip(uint32 offset) {
- return seek(offset, SEEK_CUR);
-}
diff --git a/engines/tinsel/drives.h b/engines/tinsel/drives.h
index de9d706091..709c0d2392 100644
--- a/engines/tinsel/drives.h
+++ b/engines/tinsel/drives.h
@@ -27,14 +27,10 @@
#ifndef TINSEL_DRIVES_H
#define TINSEL_DRIVES_H
-#include "common/file.h"
+#include "common/stream.h"
#include "tinsel/dw.h"
#include "tinsel/coroutine.h"
-namespace Common {
-class SeekableSubReadStreamEndian;
-}
-
namespace Tinsel {
// flags2
@@ -63,11 +59,10 @@ void SetNextCD(int cdNumber);
bool GotoCD();
-// TODO: Make TinselFile a SeekableReadStream subclass??
-class TinselFile {
+class TinselFile : public Common::SeekableReadStream, public Common::ReadStreamEndian {
private:
static bool _warningShown;
- Common::SeekableSubReadStreamEndian *_stream;
+ Common::SeekableReadStream *_stream;
bool openInternal(const Common::String &filename);
public:
TinselFile();
@@ -76,17 +71,15 @@ public:
void close();
char getCdNumber();
+ bool err() const;
+ void clearErr();
+
+ bool eos() const;
+ uint32 read(void *dataPtr, uint32 dataSize);
+
int32 pos() const;
int32 size() const;
bool seek(int32 offset, int whence = SEEK_SET);
- bool eos() const;
- bool err() const;
- uint32 readUint32();
- int16 readSint16();
- int32 readSint32();
- Common::SeekableReadStream *readStream(uint32 dataSize);
- uint32 read(void *dataPtr, uint32 dataSize);
- bool skip(uint32 offset);
};