aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-01 17:20:40 +0300
committerEugene Sandulenko2013-09-06 14:48:07 +0300
commitfa30dcef152aab077346ecf08e5436609535ef13 (patch)
tree6938b2c2471eec36bcf15285717d530fd940c54f
parent94f2adb8d6966b4306c00f647d2807b6ae9a6639 (diff)
downloadscummvm-rg350-fa30dcef152aab077346ecf08e5436609535ef13.tar.gz
scummvm-rg350-fa30dcef152aab077346ecf08e5436609535ef13.tar.bz2
scummvm-rg350-fa30dcef152aab077346ecf08e5436609535ef13.zip
FULLPIPE: Add loader for GameProject
-rw-r--r--engines/fullpipe/fullpipe.cpp2
-rw-r--r--engines/fullpipe/fullpipe.h6
-rw-r--r--engines/fullpipe/objects.h119
-rw-r--r--engines/fullpipe/stateloader.cpp63
4 files changed, 132 insertions, 58 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 5be5338f86..ca430fc868 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -55,6 +55,8 @@ Common::Error FullpipeEngine::run() {
_isSaveAllowed = false;
+ loadGam("fullpipe.gam");
+
Common::Archive *arch = makeNGIArchive("3896.nl");
return Common::kNoError;
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index daa992bd1d..d7bbe14795 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -69,7 +69,11 @@ public:
void updateEvents();
CGameLoader *g_gameLoader;
- bool loadGam(char *fname);
+ bool loadGam(const char *fname);
+
+ int _gameProjectVersion;
+ int _gameProjectValue;
+ int _scrollSpeed;
public:
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index e96de89ea6..5e4b28866b 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -64,15 +64,21 @@ class CPtrList {
};
class SceneTagList {
- CPtrList list;
+ CPtrList list;
+
+ public:
+ SceneTagList(Common::File &file);
};
class GameProject {
- CObject obj;
- int field_4;
- char *headerFilename;
- SceneTagList *sceneTagList;
- void *field_10;
+ CObject _obj;
+ int _field_4;
+ char *_headerFilename;
+ SceneTagList *_sceneTagList;
+ int _field_10;
+
+ public:
+ GameProject(Common::File &file);
};
class CInteractionController {
@@ -154,59 +160,60 @@ class CGameVar {
class CGameLoader {
public:
- bool loadFile(char *fname);
+ bool loadFile(const char *fname);
+ ~CGameLoader();
private:
- CObject obj;
- GameProject *gameProject;
- CInteractionController *interactionController;
- int field_C;
- int field_10;
- int field_14;
- int field_18;
- int field_1C;
- int field_20;
- int field_24;
- int field_28;
- int field_2C;
- CInputController inputController;
- int inventory;
- int field_7C;
- int field_80;
- int field_84;
- int field_88;
- int field_8C;
- int field_90;
- int field_94;
- int field_98;
- int field_9C;
- int field_A0;
- int field_A4;
- int field_A8;
- int field_AC;
- int field_B0;
- int field_B4;
- int field_B8;
- int field_BC;
- int field_C0;
- int field_C4;
- int field_C8;
- int field_CC;
- int field_D0;
- int field_D4;
- Sc2Array sc2array;
- void *sceneSwitcher;
- void *preloadCallback;
- void *readSavegameCallback;
- int16 field_F8;
- int16 field_FA;
- CObArray preloadItems;
+ CObject _obj;
+ GameProject *_gameProject;
+ CInteractionController *_interactionController;
+ int _field_C;
+ int _field_10;
+ int _field_14;
+ int _field_18;
+ int _field_1C;
+ int _field_20;
+ int _field_24;
+ int _field_28;
+ int _field_2C;
+ CInputController _inputController;
+ int _inventory;
+ int _field_7C;
+ int _field_80;
+ int _field_84;
+ int _field_88;
+ int _field_8C;
+ int _field_90;
+ int _field_94;
+ int _field_98;
+ int _field_9C;
+ int _field_A0;
+ int _field_A4;
+ int _field_A8;
+ int _field_AC;
+ int _field_B0;
+ int _field_B4;
+ int _field_B8;
+ int _field_BC;
+ int _field_C0;
+ int _field_C4;
+ int _field_C8;
+ int _field_CC;
+ int _field_D0;
+ int _field_D4;
+ Sc2Array _sc2array;
+ void *_sceneSwitcher;
+ void *_preloadCallback;
+ void *_readSavegameCallback;
+ int16 _field_F8;
+ int16 _field_FA;
+ CObArray _preloadItems;
CGameVar *gameVar;
- char *gameName;
- ExCommand exCommand;
- int updateCounter;
- int preloadId1;
- int preloadId2;
+ char *_gameName;
+ ExCommand _exCommand;
+ int _updateCounter;
+ int _preloadId1;
+ int _preloadId2;
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 1959bffd47..9a45fadcee 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -21,11 +21,14 @@
*/
#include "fullpipe/fullpipe.h"
+
+#include "common/file.h"
+
#include "fullpipe/objects.h"
namespace Fullpipe {
-bool FullpipeEngine::loadGam(char *fname) {
+bool FullpipeEngine::loadGam(const char *fname) {
g_gameLoader = new CGameLoader();
if (g_gameLoader->loadFile(fname)) {
@@ -36,4 +39,62 @@ bool FullpipeEngine::loadGam(char *fname) {
return true;
}
+bool CGameLoader::loadFile(const char *fname) {
+ Common::File file;
+
+ if (!file.open(fname))
+ return false;
+
+ char *tmp;
+ int len = file.readByte();
+ tmp = (char *)calloc(len + 1, 1);
+ file.read(tmp, len);
+
+ _gameName = tmp;
+
+ _gameProject = new GameProject(file);
+
+ return true;
+}
+
+CGameLoader::~CGameLoader() {
+ free(_gameName);
+}
+
+GameProject::GameProject(Common::File &file) {
+ _field_4 = 0;
+ _headerFilename = 0;
+ _field_10 = 12;
+
+ // FIXME
+ int _gameProjectVersion = file.readUint32LE();
+ int _gameProjectValue = file.readUint16LE();
+ int _scrollSpeed = file.readUint32LE();
+
+ char *tmp;
+ int len = file.readByte();
+ tmp = (char *)calloc(len + 1, 1);
+ file.read(tmp, len);
+
+ _headerFilename = tmp;
+
+ _sceneTagList = new SceneTagList(file);
+
+ debug(0, "_gameProjectVersion = %d", _gameProjectVersion);
+ debug(0, "_gameProjectValue = %d", _gameProjectValue);
+ debug(0, "_scrollSpeed = %d", _scrollSpeed);
+ debug(0, "_headerFilename = %s", _headerFilename);
+
+ if (_gameProjectVersion >= 3)
+ _field_4 = file.readUint32LE();
+
+ if (_gameProjectVersion >= 5) {
+ file.readUint32LE();
+ file.readUint32LE();
+ }
+}
+
+SceneTagList::SceneTagList(Common::File &file) {
+}
+
} // End of namespace Fullpipe