FULLPIPE: Started work on CObList loader
This commit is contained in:
parent
05418b908a
commit
bd565771d0
4 changed files with 172 additions and 51 deletions
|
@ -31,7 +31,10 @@ 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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
58
engines/fullpipe/utils.cpp
Normal file
58
engines/fullpipe/utils.cpp
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue