Skip to content

Commit

Permalink
FULLPIPE: Started sc2 file loading implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 6, 2013
1 parent ffd8eba commit d3d3d01
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 12 deletions.
28 changes: 24 additions & 4 deletions engines/fullpipe/objects.h
Expand Up @@ -29,6 +29,8 @@ class CObject {
public:
virtual bool load(MfcArchive &in) { return true; }
virtual ~CObject() {}

bool loadFile(const char *fname);
};

class CObList : public Common::List<CObject>, public CObject {
Expand Down Expand Up @@ -66,6 +68,7 @@ struct CNode {
typedef Common::Array<void *> CPtrList;

class SceneTag : public CObject {
public:
int _field_4;
char *_tag;
int _scene;
Expand Down Expand Up @@ -173,8 +176,26 @@ class CInputController {
CInputController();
};

class Sc2Array {
CObArray _objs;
class Sc2 : public CObject {
int16 _sceneId;
int16 _field_2;
//Scene *_scene;
//CMotionController *_motionController;
int _data1;
int _count1;
int _defPicAniInfos;
int _defPicAniInfosCount;
int _picAniInfos;
int _picAniInfosCount;
int _isLoaded;
int _entranceData;
int _entranceDataCount;

public:
virtual bool load(MfcArchive &file);
};

class Sc2Array : public Common::Array<Sc2> {
};

union VarValue {
Expand Down Expand Up @@ -367,12 +388,11 @@ class PreloadItems : public Common::Array<PreloadItem>, public CObject {
virtual bool load(MfcArchive &file);
};

class CGameLoader {
class CGameLoader : public CObject {
public:
CGameLoader();
virtual ~CGameLoader();

bool loadFile(const char *fname);
virtual bool load(MfcArchive &file);

private:
Expand Down
21 changes: 19 additions & 2 deletions engines/fullpipe/stateloader.cpp
Expand Up @@ -76,7 +76,7 @@ CGameLoader::~CGameLoader() {
delete _gameProject;
}

bool CGameLoader::loadFile(const char *fname) {
bool CObject::loadFile(const char *fname) {
MfcArchive file;

if (!file.open(fname))
Expand Down Expand Up @@ -106,7 +106,18 @@ bool CGameLoader::load(MfcArchive &file) {

debug(6, "sceneTag count: %d", _gameProject->_sceneTagList->size());

// TODO: Load Sc2
_sc2array.resize(_gameProject->_sceneTagList->size());

int i = 0;
for (SceneTagList::const_iterator it = _gameProject->_sceneTagList->begin(); it != _gameProject->_sceneTagList->end(); ++it, i++) {
char tmp[12];

snprintf(tmp, 11, "%04d.sc2", it->_sceneId);

debug(0, "sc: %d", it->_sceneId);

_sc2array[i].loadFile((const char *)tmp);
}

_preloadItems.load(file);

Expand Down Expand Up @@ -469,4 +480,10 @@ bool CGameVar::load(MfcArchive &file) {
return true;
}

bool Sc2::load(MfcArchive &file) {
_sceneId = file.readUint16LE();

return true;
}

} // End of namespace Fullpipe
12 changes: 6 additions & 6 deletions engines/fullpipe/utils.cpp
Expand Up @@ -56,12 +56,12 @@ int MfcArchive::readCount() {
}

enum {
kNullObject = 0,
kCInteraction = 1,
kMessageQueue = 2,
kExCommand = 3,
kCObjstateCommand = 4,
kCGameVar = 5
kNullObject,
kCInteraction,
kMessageQueue,
kExCommand,
kCObjstateCommand,
kCGameVar
};

const struct {
Expand Down

0 comments on commit d3d3d01

Please sign in to comment.