aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/objects.h86
-rw-r--r--engines/fullpipe/stateloader.cpp66
-rw-r--r--engines/fullpipe/utils.cpp58
-rw-r--r--engines/fullpipe/utils.h13
4 files changed, 172 insertions, 51 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 802306dc94..40ca2023e4 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -31,22 +31,25 @@ class CObject {
virtual ~CObject() {}
};
-typedef Common::List<CObject> CObList;
+class CObList : Common::List<CObject>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
+};
class MemoryObject {
//CObject obj;
- 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;
+ 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;
};
class CObArray {
@@ -58,9 +61,9 @@ class CObArray {
};
struct CNode {
- CNode *pNext;
- CNode *pPrev;
- void *data;
+ CNode *pNext;
+ CNode *pPrev;
+ void *data;
};
class CPtrList {
@@ -73,7 +76,7 @@ class CPtrList {
int m_nBlockSize;
};
-class SceneTag : CObject {
+class SceneTag : public CObject {
int _field_4;
char *_tag;
int _scene;
@@ -89,14 +92,14 @@ class SceneTag : CObject {
typedef Common::List<SceneTag> SceneTagList_;
-class SceneTagList : CObject {
+class SceneTagList : public CObject {
SceneTagList_ _list;
public:
virtual bool load(MfcArchive &file);
};
-class GameProject : CObject {
+class GameProject : public CObject {
int _field_4;
char *_headerFilename;
SceneTagList *_sceneTagList;
@@ -127,14 +130,15 @@ class CInteraction {
int stringObj;
};
-class CInteractionController {
- //CObject _obj;
+class CInteractionController : public CObject {
CObList _interactions;
int16 _field_20;
int _flag24;
public:
CInteractionController() : _field_20(0), _flag24(1) {}
+
+ virtual bool load(MfcArchive &file);
};
class CInputControllerItemArray {
@@ -143,19 +147,22 @@ class CInputControllerItemArray {
class CInputController {
//CObject obj;
- int flag;
- int flags;
- int cursorHandle;
- int hCursor;
- int field_14;
- int cursorId;
- int cursorIndex;
- CInputControllerItemArray cursorsArray;
- int cursorDrawX;
- int cursorDrawY;
- int cursorDrawWidth;
- int cursorDrawHeight;
- int cursorItemPicture;
+ int _flag;
+ int _flags;
+ int _cursorHandle;
+ int _hCursor;
+ int _field_14;
+ int _cursorId;
+ int _cursorIndex;
+ CInputControllerItemArray _cursorsArray;
+ int _cursorDrawX;
+ int _cursorDrawY;
+ int _cursorDrawWidth;
+ int _cursorDrawHeight;
+ int _cursorItemPicture;
+
+ public:
+ CInputController();
};
class Sc2Array {
@@ -221,7 +228,7 @@ class InventoryPoolItem {
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
-class CInventory : CObject {
+class CInventory : public CObject {
int16 _sceneId;
int16 _field_6;
InventoryPoolItems _itemsPool;
@@ -312,7 +319,7 @@ class BigPicture {
Picture pic;
};
-class CInventory2 : CObject {
+class CInventory2 : public CObject {
CInventory _inventory;
InventoryItems _inventoryItems;
InventoryIcons _inventoryIcons;
@@ -332,8 +339,11 @@ class CInventory2 : CObject {
class CGameLoader {
public:
+ CGameLoader();
+ virtual ~CGameLoader();
+
bool loadFile(const char *fname);
- ~CGameLoader();
+ virtual bool load(MfcArchive &file);
private:
//CObject _obj;
@@ -357,7 +367,7 @@ class CGameLoader {
int16 _field_F8;
int16 _field_FA;
CObArray _preloadItems;
- CGameVar *gameVar;
+ CGameVar *_gameVar;
char *_gameName;
ExCommand _exCommand;
int _updateCounter;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index bdfd4e0b06..0057e4c694 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -42,12 +42,50 @@ bool FullpipeEngine::loadGam(const char *fname) {
return true;
}
+CGameLoader::CGameLoader() {
+ _interactionController = new CInteractionController();
+
+ // g_gameLoader = this; // FIXME
+
+ _gameProject = 0;
+ //_gameName = "untitled";
+
+ //addMessageHandler2(CGameLoader_messageHandler1, 0, 0);
+ //insertMessageHandler(CGameLoader_messageHandler2, 0, 128);
+ //insertMessageHandler(CGameLoader_messageHandler3, 0, 1);
+
+ _field_FA = 0;
+ _field_F8 = 0;
+ _sceneSwitcher = 0;
+ _preloadCallback = 0;
+ _readSavegameCallback = 0;
+ _gameVar = 0;
+ _preloadId1 = 0;
+ _preloadId2 = 0;
+ _updateCounter = 0;
+
+ //g_x = 0;
+ //g_y = 0;
+ //dword_478480 = 0;
+ //g_objectId2 = 0;
+ //g_id = 0;
+}
+
+CGameLoader::~CGameLoader() {
+ free(_gameName);
+ delete _gameProject;
+}
+
bool CGameLoader::loadFile(const char *fname) {
MfcArchive file;
if (!file.open(fname))
return false;
+ return load(file);
+}
+
+bool CGameLoader::load(MfcArchive &file) {
_gameName = file.readPascalString();
debug(0, "_gameName: %s", _gameName);
@@ -66,12 +104,9 @@ bool CGameLoader::loadFile(const char *fname) {
debug(0, "%x", file.pos());
- return true;
-}
+ _interactionController->load(file);
-CGameLoader::~CGameLoader() {
- free(_gameName);
- delete _gameProject;
+ return true;
}
GameProject::GameProject() {
@@ -195,4 +230,25 @@ bool CInventory2::loadPartial(MfcArchive &file) { // CInventory2_SerializePartia
return true;
}
+bool CInteractionController::load(MfcArchive &file) {
+ return _interactions.load(file);
+}
+
+bool CObList::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ for (int i = 0; i < count; i++) {
+ CObject *t = file.parseClass();
+ t->load(file);
+
+ push_back(*t);
+ }
+
+ return true;
+}
+
+CInputController::CInputController() {
+ // TODO
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
new file mode 100644
index 0000000000..e1031cf0ed
--- /dev/null
+++ b/engines/fullpipe/utils.cpp
@@ -0,0 +1,58 @@
+/* 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.
+ *
+ */
+
+#include "fullpipe/fullpipe.h"
+
+#include "common/file.h"
+
+#include "fullpipe/utils.h"
+#include "fullpipe/objects.h"
+
+namespace Fullpipe {
+
+char *MfcArchive::readPascalString() {
+ char *tmp;
+ int len = readByte();
+ tmp = (char *)calloc(len + 1, 1);
+ read(tmp, len);
+
+ return tmp;
+}
+
+int MfcArchive::readCount() {
+ int count = readUint16LE();
+
+ if (count == 0xffff)
+ count = readUint32LE();
+
+ return count;
+}
+
+CObject *MfcArchive::parseClass() {
+ CObject *res;
+
+ res = new CInventory2();
+
+ return res;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 73be4618c8..492f5ac6bf 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -25,16 +25,13 @@
namespace Fullpipe {
+class CObject;
+
class MfcArchive : public Common::File {
public:
- char *readPascalString() {
- char *tmp;
- int len = readByte();
- tmp = (char *)calloc(len + 1, 1);
- read(tmp, len);
-
- return tmp;
- }
+ char *readPascalString();
+ int readCount();
+ CObject *parseClass();
};
} // End of namespace Fullpipe