aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-20 17:21:37 -0400
committerEugene Sandulenko2013-09-06 14:48:14 +0300
commit925f41b9c4055d39498c61c8f22388176ee25cce (patch)
treef82d06ee8ba7c3fc3c570ed3ab0036c624c5bc68 /engines
parentbb4ea153ffa5eaf5be3e912e206566f7c9278a87 (diff)
downloadscummvm-rg350-925f41b9c4055d39498c61c8f22388176ee25cce.tar.gz
scummvm-rg350-925f41b9c4055d39498c61c8f22388176ee25cce.tar.bz2
scummvm-rg350-925f41b9c4055d39498c61c8f22388176ee25cce.zip
FULLPIPE: Made MfcArchive work with both files and archives
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/scene.cpp7
-rw-r--r--engines/fullpipe/utils.cpp10
-rw-r--r--engines/fullpipe/utils.h12
3 files changed, 22 insertions, 7 deletions
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 96ca7c05e6..887647d347 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -92,19 +92,22 @@ void SceneTag::loadScene() {
_scene = new Scene();
- //_scene->load(*file);
+ MfcArchive archive(file);
+
+ _scene->load(archive);
delete file;
free(fname);
free(archname);
-
}
Scene::Scene() {
}
bool Scene::load(MfcArchive &file) {
+ debug(0, "Scene::load");
+
return true;
}
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 26c03ceeea..468d03b6f9 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -30,12 +30,14 @@
namespace Fullpipe {
bool CObject::loadFile(const char *fname) {
- MfcArchive file;
+ Common::File file;
if (!file.open(fname))
return false;
- return load(file);
+ MfcArchive archive(&file);
+
+ return load(archive);
}
bool CObList::load(MfcArchive &file) {
@@ -201,7 +203,7 @@ static CObject *createObject(int objectId) {
return 0;
}
-MfcArchive::MfcArchive() {
+MfcArchive::MfcArchive(Common::SeekableReadStream *stream) {
for (int i = 0; classMap[i].name; i++) {
_classMap[classMap[i].name] = classMap[i].id;
}
@@ -209,6 +211,8 @@ MfcArchive::MfcArchive() {
_lastIndex = 1;
_level = 0;
+ _stream = stream;
+
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 409c5ded1a..b349fc305d 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -33,7 +33,7 @@ class CObject;
typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
-class MfcArchive : public Common::File {
+class MfcArchive : public Common::SeekableReadStream {
ClassMap _classMap;
Common::Array<CObject *> _objectMap;
Common::Array<int> _objectIdMap;
@@ -41,8 +41,10 @@ class MfcArchive : public Common::File {
int _lastIndex;
int _level;
+ Common::SeekableReadStream *_stream;
+
public:
- MfcArchive();
+ MfcArchive(Common::SeekableReadStream *file);
char *readPascalString(bool twoByte = false);
int readCount();
@@ -53,6 +55,12 @@ class MfcArchive : public Common::File {
void incLevel() { _level++; }
void decLevel() { _level--; }
int getLevel() { return _level; }
+
+ virtual bool eos() const { return _stream->eos(); }
+ virtual uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
+ virtual int32 pos() const { return _stream->pos(); }
+ virtual int32 size() const { return _stream->size(); }
+ virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); }
};
class CObject {