aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-21 21:30:38 -0400
committerEugene Sandulenko2013-09-06 14:48:15 +0300
commit29f323fd27d67aede4668e07984eabd69180aee5 (patch)
treeed3e84d02ab1efe4081a2f6a5505008d6b873d17 /engines
parent47faa885015f619b730d8716c8527ae5819cb35f (diff)
downloadscummvm-rg350-29f323fd27d67aede4668e07984eabd69180aee5.tar.gz
scummvm-rg350-29f323fd27d67aede4668e07984eabd69180aee5.tar.bz2
scummvm-rg350-29f323fd27d67aede4668e07984eabd69180aee5.zip
FULLPIPE: Completed Background loading
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/fullpipe.h3
-rw-r--r--engines/fullpipe/gfx.h7
-rw-r--r--engines/fullpipe/ngiarchive.cpp33
-rw-r--r--engines/fullpipe/ngiarchive.h27
-rw-r--r--engines/fullpipe/scene.cpp2
-rw-r--r--engines/fullpipe/utils.cpp60
-rw-r--r--engines/fullpipe/utils.h41
7 files changed, 129 insertions, 44 deletions
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 034fda3caf..013303d71e 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -48,6 +48,7 @@ class GameProject;
class CGameVar;
class CInventory2;
class Scene;
+class NGIArchive;
class FullpipeEngine : public ::Engine {
protected:
@@ -96,6 +97,8 @@ public:
Scene *accessScene(int sceneId);
+ NGIArchive *_currArchive;
+
public:
bool _isSaveAllowed;
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 4ecf4f485d..6df8e7be84 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -40,13 +40,14 @@ class Picture : public MemoryObject {
int _height;
int _bitmap;
int _field_54;
- int _memoryObject2;
+ MemoryObject2 *_memoryObject2;
int _alpha;
- int _paletteData;
+ byte *_paletteData;
public:
Picture();
virtual bool load(MfcArchive &file);
+ void setAOIDs();
};
class BigPicture : public Picture {
@@ -94,7 +95,7 @@ class Background : public CObject {
int _colorMemoryObj;
int _bigPictureArray1Count;
int _bigPictureArray2Count;
- int _bigPictureArray;
+ BigPicture ***_bigPictureArray;
public:
Background();
diff --git a/engines/fullpipe/ngiarchive.cpp b/engines/fullpipe/ngiarchive.cpp
index 801d020495..5d895c17a0 100644
--- a/engines/fullpipe/ngiarchive.cpp
+++ b/engines/fullpipe/ngiarchive.cpp
@@ -33,33 +33,6 @@
namespace Fullpipe {
-#define NGI_FILENAME_MAX 13
-
-struct NgiHeader {
- int32 pos;
- int32 extVal;
- int32 flags;
- int32 size;
- char filename[NGI_FILENAME_MAX];
-};
-
-typedef Common::HashMap<Common::String, NgiHeader*, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> NgiHeadersMap;
-
-class NGIArchive : public Common::Archive {
- NgiHeadersMap _headers;
- Common::String _ngiFilename;
-
-public:
- NGIArchive(const Common::String &name);
- virtual ~NGIArchive();
-
- // Archive implementation
- virtual bool hasFile(const Common::String &name) const;
- virtual int listMembers(Common::ArchiveMemberList &list) const;
- virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
- virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
-};
-
NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename) {
Common::File ngiFile;
@@ -118,6 +91,8 @@ NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename)
free(fat);
+ g_fullpipe->_currArchive = this;
+
debug(0, "NGIArchive::NGIArchive(%s): Located %d files", filename.c_str(), _headers.size());
}
@@ -127,6 +102,8 @@ NGIArchive::~NGIArchive() {
for ( ; it != _headers.end(); ++it) {
delete it->_value;
}
+
+ g_fullpipe->_currArchive = 0;
}
bool NGIArchive::hasFile(const Common::String &name) const {
@@ -163,8 +140,6 @@ Common::SeekableReadStream *NGIArchive::createReadStreamForMember(const Common::
archiveFile.open(_ngiFilename);
archiveFile.seek(hdr->pos, SEEK_SET);
- // TODO: It would be good if ArjFile could decompress files in a streaming
- // mode, so it would not need to pre-allocate the entire output.
byte *data = (byte *)malloc(hdr->size);
assert(data);
diff --git a/engines/fullpipe/ngiarchive.h b/engines/fullpipe/ngiarchive.h
index ee977c6140..a5b05a2e50 100644
--- a/engines/fullpipe/ngiarchive.h
+++ b/engines/fullpipe/ngiarchive.h
@@ -29,6 +29,33 @@ namespace Fullpipe {
class Archive;
+#define NGI_FILENAME_MAX 13
+
+struct NgiHeader {
+ int32 pos;
+ int32 extVal;
+ int32 flags;
+ int32 size;
+ char filename[NGI_FILENAME_MAX];
+};
+
+typedef Common::HashMap<Common::String, NgiHeader*, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> NgiHeadersMap;
+
+class NGIArchive : public Common::Archive {
+ NgiHeadersMap _headers;
+ Common::String _ngiFilename;
+
+public:
+ NGIArchive(const Common::String &name);
+ virtual ~NGIArchive();
+
+ // Archive implementation
+ virtual bool hasFile(const Common::String &name) const;
+ virtual int listMembers(Common::ArchiveMemberList &list) const;
+ virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
+ virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+};
+
/**
* This factory method creates an Archive instance corresponding to the content
* of the NGI compressed file with the given name.
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index fb0a771376..4f17230d6c 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -98,6 +98,8 @@ void SceneTag::loadScene() {
delete file;
+ g_fullpipe->_currArchive = 0;
+
free(fname);
free(archname);
}
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 468d03b6f9..0462c4ec3e 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -23,9 +23,11 @@
#include "fullpipe/fullpipe.h"
#include "common/file.h"
+#include "common/memstream.h"
#include "fullpipe/objects.h"
#include "fullpipe/motion.h"
+#include "fullpipe/ngiarchive.h"
namespace Fullpipe {
@@ -102,6 +104,64 @@ char *MfcArchive::readPascalString(bool twoByte) {
return tmp;
}
+MemoryObject::MemoryObject() {
+ _filename = 0;
+ _field_8 = 0;
+ _field_C = 0;
+ _field_10 = -1;
+ _field_14 = 1;
+ _dataSize = 0;
+ _flags = 0;
+ _libHandle = 0;
+ _data = 0;
+}
+
+bool MemoryObject::load(MfcArchive &file) {
+ _filename = file.readPascalString();
+
+ if (g_fullpipe->_currArchive) {
+ _field_14 = 0;
+ _libHandle = g_fullpipe->_currArchive;
+ }
+
+ return true;
+}
+
+void MemoryObject::loadFile(char *filename) {
+ if (!_data) {
+ if (g_fullpipe->_currArchive != _libHandle) {
+ assert(0);
+ }
+
+ Common::SeekableReadStream *s = _libHandle->createReadStreamForMember(filename);
+
+ if (s) {
+ debug(0, "Reading %s", filename);
+ assert(s->size() > 0);
+ _data = calloc(s->size(), 1);
+ s->read(_data, s->size());
+
+ delete s;
+ }
+ }
+}
+
+MemoryObject2::MemoryObject2() {
+ _data2 = 0;
+}
+
+bool MemoryObject2::load(MfcArchive &file) {
+ MemoryObject::load(file);
+
+ _flags |= 1;
+
+ if (_filename) {
+ MemoryObject::loadFile(_filename);
+ }
+
+ return true;
+}
+
int MfcArchive::readCount() {
int count = readUint16LE();
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index f1e4080f49..bb9ed89935 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -30,6 +30,7 @@
namespace Fullpipe {
class CObject;
+class NGIArchive;
typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
@@ -77,18 +78,34 @@ class CObList : public Common::List<CObject>, public CObject {
};
class MemoryObject : CObject {
- int filename;
- int field_8;
- int field_C;
- int field_10;
- char field_14;
- char field_15;
- char field_16;
- char field_17;
- int data;
- int dataSize;
- int flags;
- int libHandle;
+ friend class MemoryObject2;
+ friend class Picture;
+
+ char *_filename;
+ int _field_8;
+ int _field_C;
+ int _field_10;
+ char _field_14;
+ char _field_15;
+ char _field_16;
+ char _field_17;
+ void *_data;
+ int _dataSize;
+ int _flags;
+ NGIArchive *_libHandle;
+
+ public:
+ MemoryObject();
+ virtual bool load(MfcArchive &file);
+ void loadFile(char *filename);
+};
+
+class MemoryObject2 : public MemoryObject {
+ void *_data2;
+
+ public:
+ MemoryObject2();
+ virtual bool load(MfcArchive &file);
};
class CObArray : public Common::Array<CObject>, public CObject {