aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-06 23:52:43 +0300
committerEugene Sandulenko2013-09-06 14:48:08 +0300
commit05418b908afd2563e85a56652f750af65a3d4cc8 (patch)
tree96086ff2c67bf8d2fd3073fe95899e0f8f85ea3b
parent4bc204cfc466c889c2e539cc23eab87f37d409c9 (diff)
downloadscummvm-rg350-05418b908afd2563e85a56652f750af65a3d4cc8.tar.gz
scummvm-rg350-05418b908afd2563e85a56652f750af65a3d4cc8.tar.bz2
scummvm-rg350-05418b908afd2563e85a56652f750af65a3d4cc8.zip
FULLPIPE: Turn all MfcArchive loading functions into virtual methods
-rw-r--r--engines/fullpipe/objects.h66
-rw-r--r--engines/fullpipe/stateloader.cpp29
2 files changed, 51 insertions, 44 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index c39bbb37f8..802306dc94 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -26,21 +26,15 @@
namespace Fullpipe {
class CObject {
- int vmt;
+ public:
+ virtual bool load(MfcArchive &in) { return true; }
+ virtual ~CObject() {}
};
-class CObList {
- int vmt;
- int m_pNodeHead;
- int m_pNodeTail;
- int m_nCount;
- int m_pNodeFree;
- int m_pBlocks;
- int m_nBlockSize;
-};
+typedef Common::List<CObject> CObList;
class MemoryObject {
- CObject obj;
+ //CObject obj;
int filename;
int field_8;
int field_C;
@@ -56,7 +50,7 @@ class MemoryObject {
};
class CObArray {
- CObject obj;
+ //CObject obj;
int m_pData;
int m_nSize;
int m_nMaxSize;
@@ -70,7 +64,7 @@ struct CNode {
};
class CPtrList {
- CObject obj;
+ //CObject obj;
CNode *m_pNodeHead;
int m_pNodeTail;
int m_nCount;
@@ -79,8 +73,7 @@ class CPtrList {
int m_nBlockSize;
};
-class SceneTag {
- CObject _obj;
+class SceneTag : CObject {
int _field_4;
char *_tag;
int _scene;
@@ -88,33 +81,35 @@ class SceneTag {
int16 _field_12;
public:
- SceneTag(MfcArchive &file);
+ SceneTag();
~SceneTag();
+
+ virtual bool load(MfcArchive &file);
};
typedef Common::List<SceneTag> SceneTagList_;
-class SceneTagList {
+class SceneTagList : CObject {
SceneTagList_ _list;
public:
- SceneTagList(MfcArchive &file);
+ virtual bool load(MfcArchive &file);
};
-class GameProject {
- CObject _obj;
+class GameProject : CObject {
int _field_4;
char *_headerFilename;
SceneTagList *_sceneTagList;
int _field_10;
public:
- GameProject(MfcArchive &file);
+ GameProject();
~GameProject();
+ virtual bool load(MfcArchive &file);
};
class CInteraction {
- CObject obj;
+ //CObject obj;
int16 objectId1;
int16 objectId2;
int16 objectId3;
@@ -132,11 +127,9 @@ class CInteraction {
int stringObj;
};
-typedef Common::List<CInteraction> CInteractions;
-
class CInteractionController {
- CObject _obj;
- CInteractions _interactions;
+ //CObject _obj;
+ CObList _interactions;
int16 _field_20;
int _flag24;
@@ -149,7 +142,7 @@ class CInputControllerItemArray {
};
class CInputController {
- CObject obj;
+ //CObject obj;
int flag;
int flags;
int cursorHandle;
@@ -176,7 +169,7 @@ union VarValue {
};
class Message {
- CObject obj;
+ //CObject obj;
int messageKind;
int16 parentId;
char gap_A[2];
@@ -202,7 +195,7 @@ class ExCommand {
};
class CGameVar {
- CObject obj;
+ //CObject obj;
CGameVar *nextVarObj;
CGameVar *prevVarObj;
CGameVar *parentVarObj;
@@ -228,15 +221,14 @@ class InventoryPoolItem {
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
-class CInventory {
- CObject _obj;
+class CInventory : CObject {
int16 _sceneId;
int16 _field_6;
InventoryPoolItems _itemsPool;
public:
CInventory() { _sceneId = 0; }
- bool load(MfcArchive &file);
+ virtual bool load(MfcArchive &file);
};
struct InventoryItem {
@@ -279,7 +271,7 @@ class ShadowsItemArray {
};
class Shadows {
- CObject obj;
+ //CObject obj;
int sceneId;
int staticAniObjectId;
int movementId;
@@ -320,7 +312,7 @@ class BigPicture {
Picture pic;
};
-class CInventory2 {
+class CInventory2 : CObject {
CInventory _inventory;
InventoryItems _inventoryItems;
InventoryIcons _inventoryIcons;
@@ -334,8 +326,8 @@ class CInventory2 {
public:
CInventory2();
- bool load(MfcArchive &file);
- bool read(MfcArchive &file);
+ bool loadPartial(MfcArchive &file);
+ virtual bool load(MfcArchive &file);
};
class CGameLoader {
@@ -344,7 +336,7 @@ class CGameLoader {
~CGameLoader();
private:
- CObject _obj;
+ //CObject _obj;
GameProject *_gameProject;
CInteractionController *_interactionController;
int _field_C;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index ba80798a9b..bdfd4e0b06 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -51,7 +51,9 @@ bool CGameLoader::loadFile(const char *fname) {
_gameName = file.readPascalString();
debug(0, "_gameName: %s", _gameName);
- _gameProject = new GameProject(file);
+ _gameProject = new GameProject();
+
+ _gameProject->load(file);
if (g_gameProjectVersion < 12) {
error("Old gameProjectVersion: %d", g_gameProjectVersion);
@@ -72,11 +74,13 @@ CGameLoader::~CGameLoader() {
delete _gameProject;
}
-GameProject::GameProject(MfcArchive &file) {
+GameProject::GameProject() {
_field_4 = 0;
_headerFilename = 0;
_field_10 = 12;
+}
+bool GameProject::load(MfcArchive &file) {
g_gameProjectVersion = file.readUint32LE();
g_gameProjectValue = file.readUint16LE();
g_scrollSpeed = file.readUint32LE();
@@ -88,7 +92,9 @@ GameProject::GameProject(MfcArchive &file) {
debug(0, "_scrollSpeed = %d", g_scrollSpeed);
debug(0, "_headerFilename = %s", _headerFilename);
- _sceneTagList = new SceneTagList(file);
+ _sceneTagList = new SceneTagList();
+
+ _sceneTagList->load(file);
if (g_gameProjectVersion >= 3)
_field_4 = file.readUint32LE();
@@ -97,32 +103,41 @@ GameProject::GameProject(MfcArchive &file) {
file.readUint32LE();
file.readUint32LE();
}
+
+ return true;
}
GameProject::~GameProject() {
free(_headerFilename);
}
-SceneTagList::SceneTagList(MfcArchive &file) {
+bool SceneTagList::load(MfcArchive &file) {
int numEntries = file.readUint16LE();
debug(0, "numEntries: %d", numEntries);
for (int i = 0; i < numEntries; i++) {
- SceneTag *t = new SceneTag(file);
+ SceneTag *t = new SceneTag();
+ t->load(file);
_list.push_back(*t);
}
+
+ return true;
}
-SceneTag::SceneTag(MfcArchive &file) {
+SceneTag::SceneTag() {
_field_4 = 0;
_scene = 0;
+}
+bool SceneTag::load(MfcArchive &file) {
_sceneId = file.readUint16LE();
_tag = file.readPascalString();
debug(0, "sceneId: %d tag: %s", _sceneId, _tag);
+
+ return true;
}
SceneTag::~SceneTag() {
@@ -165,7 +180,7 @@ bool CInventory2::load(MfcArchive &file) {
return _inventory.load(file);
}
-bool CInventory2::read(MfcArchive &file) { // CInventory2_SerializePartially
+bool CInventory2::loadPartial(MfcArchive &file) { // CInventory2_SerializePartially
int numInvs = file.readUint32LE();
debug(0, "numInvs: %d", numInvs);