FULLPIPE: Turn all MfcArchive loading functions into virtual methods
This commit is contained in:
parent
4bc204cfc4
commit
05418b908a
2 changed files with 51 additions and 44 deletions
|
@ -26,21 +26,15 @@
|
||||||
namespace Fullpipe {
|
namespace Fullpipe {
|
||||||
|
|
||||||
class CObject {
|
class CObject {
|
||||||
int vmt;
|
public:
|
||||||
|
virtual bool load(MfcArchive &in) { return true; }
|
||||||
|
virtual ~CObject() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CObList {
|
typedef Common::List<CObject> CObList;
|
||||||
int vmt;
|
|
||||||
int m_pNodeHead;
|
|
||||||
int m_pNodeTail;
|
|
||||||
int m_nCount;
|
|
||||||
int m_pNodeFree;
|
|
||||||
int m_pBlocks;
|
|
||||||
int m_nBlockSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MemoryObject {
|
class MemoryObject {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int filename;
|
int filename;
|
||||||
int field_8;
|
int field_8;
|
||||||
int field_C;
|
int field_C;
|
||||||
|
@ -56,7 +50,7 @@ class MemoryObject {
|
||||||
};
|
};
|
||||||
|
|
||||||
class CObArray {
|
class CObArray {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int m_pData;
|
int m_pData;
|
||||||
int m_nSize;
|
int m_nSize;
|
||||||
int m_nMaxSize;
|
int m_nMaxSize;
|
||||||
|
@ -70,7 +64,7 @@ struct CNode {
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPtrList {
|
class CPtrList {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
CNode *m_pNodeHead;
|
CNode *m_pNodeHead;
|
||||||
int m_pNodeTail;
|
int m_pNodeTail;
|
||||||
int m_nCount;
|
int m_nCount;
|
||||||
|
@ -79,8 +73,7 @@ class CPtrList {
|
||||||
int m_nBlockSize;
|
int m_nBlockSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SceneTag {
|
class SceneTag : CObject {
|
||||||
CObject _obj;
|
|
||||||
int _field_4;
|
int _field_4;
|
||||||
char *_tag;
|
char *_tag;
|
||||||
int _scene;
|
int _scene;
|
||||||
|
@ -88,33 +81,35 @@ class SceneTag {
|
||||||
int16 _field_12;
|
int16 _field_12;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SceneTag(MfcArchive &file);
|
SceneTag();
|
||||||
~SceneTag();
|
~SceneTag();
|
||||||
|
|
||||||
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Common::List<SceneTag> SceneTagList_;
|
typedef Common::List<SceneTag> SceneTagList_;
|
||||||
|
|
||||||
class SceneTagList {
|
class SceneTagList : CObject {
|
||||||
SceneTagList_ _list;
|
SceneTagList_ _list;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SceneTagList(MfcArchive &file);
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameProject {
|
class GameProject : CObject {
|
||||||
CObject _obj;
|
|
||||||
int _field_4;
|
int _field_4;
|
||||||
char *_headerFilename;
|
char *_headerFilename;
|
||||||
SceneTagList *_sceneTagList;
|
SceneTagList *_sceneTagList;
|
||||||
int _field_10;
|
int _field_10;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameProject(MfcArchive &file);
|
GameProject();
|
||||||
~GameProject();
|
~GameProject();
|
||||||
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInteraction {
|
class CInteraction {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int16 objectId1;
|
int16 objectId1;
|
||||||
int16 objectId2;
|
int16 objectId2;
|
||||||
int16 objectId3;
|
int16 objectId3;
|
||||||
|
@ -132,11 +127,9 @@ class CInteraction {
|
||||||
int stringObj;
|
int stringObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Common::List<CInteraction> CInteractions;
|
|
||||||
|
|
||||||
class CInteractionController {
|
class CInteractionController {
|
||||||
CObject _obj;
|
//CObject _obj;
|
||||||
CInteractions _interactions;
|
CObList _interactions;
|
||||||
int16 _field_20;
|
int16 _field_20;
|
||||||
int _flag24;
|
int _flag24;
|
||||||
|
|
||||||
|
@ -149,7 +142,7 @@ class CInputControllerItemArray {
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInputController {
|
class CInputController {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int flag;
|
int flag;
|
||||||
int flags;
|
int flags;
|
||||||
int cursorHandle;
|
int cursorHandle;
|
||||||
|
@ -176,7 +169,7 @@ union VarValue {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Message {
|
class Message {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int messageKind;
|
int messageKind;
|
||||||
int16 parentId;
|
int16 parentId;
|
||||||
char gap_A[2];
|
char gap_A[2];
|
||||||
|
@ -202,7 +195,7 @@ class ExCommand {
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGameVar {
|
class CGameVar {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
CGameVar *nextVarObj;
|
CGameVar *nextVarObj;
|
||||||
CGameVar *prevVarObj;
|
CGameVar *prevVarObj;
|
||||||
CGameVar *parentVarObj;
|
CGameVar *parentVarObj;
|
||||||
|
@ -228,15 +221,14 @@ class InventoryPoolItem {
|
||||||
|
|
||||||
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
|
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
|
||||||
|
|
||||||
class CInventory {
|
class CInventory : CObject {
|
||||||
CObject _obj;
|
|
||||||
int16 _sceneId;
|
int16 _sceneId;
|
||||||
int16 _field_6;
|
int16 _field_6;
|
||||||
InventoryPoolItems _itemsPool;
|
InventoryPoolItems _itemsPool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CInventory() { _sceneId = 0; }
|
CInventory() { _sceneId = 0; }
|
||||||
bool load(MfcArchive &file);
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InventoryItem {
|
struct InventoryItem {
|
||||||
|
@ -279,7 +271,7 @@ class ShadowsItemArray {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Shadows {
|
class Shadows {
|
||||||
CObject obj;
|
//CObject obj;
|
||||||
int sceneId;
|
int sceneId;
|
||||||
int staticAniObjectId;
|
int staticAniObjectId;
|
||||||
int movementId;
|
int movementId;
|
||||||
|
@ -320,7 +312,7 @@ class BigPicture {
|
||||||
Picture pic;
|
Picture pic;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInventory2 {
|
class CInventory2 : CObject {
|
||||||
CInventory _inventory;
|
CInventory _inventory;
|
||||||
InventoryItems _inventoryItems;
|
InventoryItems _inventoryItems;
|
||||||
InventoryIcons _inventoryIcons;
|
InventoryIcons _inventoryIcons;
|
||||||
|
@ -334,8 +326,8 @@ class CInventory2 {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CInventory2();
|
CInventory2();
|
||||||
bool load(MfcArchive &file);
|
bool loadPartial(MfcArchive &file);
|
||||||
bool read(MfcArchive &file);
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGameLoader {
|
class CGameLoader {
|
||||||
|
@ -344,7 +336,7 @@ class CGameLoader {
|
||||||
~CGameLoader();
|
~CGameLoader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CObject _obj;
|
//CObject _obj;
|
||||||
GameProject *_gameProject;
|
GameProject *_gameProject;
|
||||||
CInteractionController *_interactionController;
|
CInteractionController *_interactionController;
|
||||||
int _field_C;
|
int _field_C;
|
||||||
|
|
|
@ -51,7 +51,9 @@ bool CGameLoader::loadFile(const char *fname) {
|
||||||
_gameName = file.readPascalString();
|
_gameName = file.readPascalString();
|
||||||
debug(0, "_gameName: %s", _gameName);
|
debug(0, "_gameName: %s", _gameName);
|
||||||
|
|
||||||
_gameProject = new GameProject(file);
|
_gameProject = new GameProject();
|
||||||
|
|
||||||
|
_gameProject->load(file);
|
||||||
|
|
||||||
if (g_gameProjectVersion < 12) {
|
if (g_gameProjectVersion < 12) {
|
||||||
error("Old gameProjectVersion: %d", g_gameProjectVersion);
|
error("Old gameProjectVersion: %d", g_gameProjectVersion);
|
||||||
|
@ -72,11 +74,13 @@ CGameLoader::~CGameLoader() {
|
||||||
delete _gameProject;
|
delete _gameProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameProject::GameProject(MfcArchive &file) {
|
GameProject::GameProject() {
|
||||||
_field_4 = 0;
|
_field_4 = 0;
|
||||||
_headerFilename = 0;
|
_headerFilename = 0;
|
||||||
_field_10 = 12;
|
_field_10 = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameProject::load(MfcArchive &file) {
|
||||||
g_gameProjectVersion = file.readUint32LE();
|
g_gameProjectVersion = file.readUint32LE();
|
||||||
g_gameProjectValue = file.readUint16LE();
|
g_gameProjectValue = file.readUint16LE();
|
||||||
g_scrollSpeed = file.readUint32LE();
|
g_scrollSpeed = file.readUint32LE();
|
||||||
|
@ -88,7 +92,9 @@ GameProject::GameProject(MfcArchive &file) {
|
||||||
debug(0, "_scrollSpeed = %d", g_scrollSpeed);
|
debug(0, "_scrollSpeed = %d", g_scrollSpeed);
|
||||||
debug(0, "_headerFilename = %s", _headerFilename);
|
debug(0, "_headerFilename = %s", _headerFilename);
|
||||||
|
|
||||||
_sceneTagList = new SceneTagList(file);
|
_sceneTagList = new SceneTagList();
|
||||||
|
|
||||||
|
_sceneTagList->load(file);
|
||||||
|
|
||||||
if (g_gameProjectVersion >= 3)
|
if (g_gameProjectVersion >= 3)
|
||||||
_field_4 = file.readUint32LE();
|
_field_4 = file.readUint32LE();
|
||||||
|
@ -97,32 +103,41 @@ GameProject::GameProject(MfcArchive &file) {
|
||||||
file.readUint32LE();
|
file.readUint32LE();
|
||||||
file.readUint32LE();
|
file.readUint32LE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameProject::~GameProject() {
|
GameProject::~GameProject() {
|
||||||
free(_headerFilename);
|
free(_headerFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneTagList::SceneTagList(MfcArchive &file) {
|
bool SceneTagList::load(MfcArchive &file) {
|
||||||
int numEntries = file.readUint16LE();
|
int numEntries = file.readUint16LE();
|
||||||
|
|
||||||
debug(0, "numEntries: %d", numEntries);
|
debug(0, "numEntries: %d", numEntries);
|
||||||
|
|
||||||
for (int i = 0; i < numEntries; i++) {
|
for (int i = 0; i < numEntries; i++) {
|
||||||
SceneTag *t = new SceneTag(file);
|
SceneTag *t = new SceneTag();
|
||||||
|
t->load(file);
|
||||||
_list.push_back(*t);
|
_list.push_back(*t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneTag::SceneTag(MfcArchive &file) {
|
SceneTag::SceneTag() {
|
||||||
_field_4 = 0;
|
_field_4 = 0;
|
||||||
_scene = 0;
|
_scene = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SceneTag::load(MfcArchive &file) {
|
||||||
_sceneId = file.readUint16LE();
|
_sceneId = file.readUint16LE();
|
||||||
|
|
||||||
_tag = file.readPascalString();
|
_tag = file.readPascalString();
|
||||||
|
|
||||||
debug(0, "sceneId: %d tag: %s", _sceneId, _tag);
|
debug(0, "sceneId: %d tag: %s", _sceneId, _tag);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneTag::~SceneTag() {
|
SceneTag::~SceneTag() {
|
||||||
|
@ -165,7 +180,7 @@ bool CInventory2::load(MfcArchive &file) {
|
||||||
return _inventory.load(file);
|
return _inventory.load(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CInventory2::read(MfcArchive &file) { // CInventory2_SerializePartially
|
bool CInventory2::loadPartial(MfcArchive &file) { // CInventory2_SerializePartially
|
||||||
int numInvs = file.readUint32LE();
|
int numInvs = file.readUint32LE();
|
||||||
|
|
||||||
debug(0, "numInvs: %d", numInvs);
|
debug(0, "numInvs: %d", numInvs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue