diff options
| author | Eugene Sandulenko | 2013-06-20 16:39:05 -0400 | 
|---|---|---|
| committer | Eugene Sandulenko | 2013-09-06 14:48:14 +0300 | 
| commit | bb4ea153ffa5eaf5be3e912e206566f7c9278a87 (patch) | |
| tree | 0ef8592893cddedb6d00854b3debbfdc80e74475 | |
| parent | 2412eb23ad7bc0efe143ca19caad8d0d01deb784 (diff) | |
| download | scummvm-rg350-bb4ea153ffa5eaf5be3e912e206566f7c9278a87.tar.gz scummvm-rg350-bb4ea153ffa5eaf5be3e912e206566f7c9278a87.tar.bz2 scummvm-rg350-bb4ea153ffa5eaf5be3e912e206566f7c9278a87.zip  | |
FULLPIPE: Started scene loading
| -rw-r--r-- | engines/fullpipe/fullpipe.cpp | 3 | ||||
| -rw-r--r-- | engines/fullpipe/fullpipe.h | 5 | ||||
| -rw-r--r-- | engines/fullpipe/scene.cpp | 47 | ||||
| -rw-r--r-- | engines/fullpipe/scene.h | 35 | ||||
| -rw-r--r-- | engines/fullpipe/stateloader.cpp | 2 | ||||
| -rw-r--r-- | engines/fullpipe/utils.cpp | 12 | ||||
| -rw-r--r-- | engines/fullpipe/utils.h | 2 | 
7 files changed, 86 insertions, 20 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 6df26afe44..d49fe9a773 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -28,7 +28,6 @@  #include "engines/util.h"  #include "fullpipe/fullpipe.h" -#include "fullpipe/ngiarchive.h"  #include "fullpipe/objectnames.h"  #include "fullpipe/objects.h" @@ -66,8 +65,6 @@ Common::Error FullpipeEngine::run() {  	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 52c0fd89a1..ce6935c25d 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -44,8 +44,10 @@ enum FullpipeGameFeatures {  };  class CGameLoader; +class GameProject;  class CGameVar;  class CInventory2; +class Scene;  extern int g_gameProjectVersion;  extern int g_gameProjectValue; @@ -76,6 +78,7 @@ public:  	void updateEvents();  	CGameLoader *_gameLoader; +	GameProject *_gameProject;  	bool loadGam(const char *fname);  	int _gameProjectVersion; @@ -95,7 +98,7 @@ public:  	void setObjectState(const char *name, int state);  	int getObjectEnumState(const char *name, const char *state); -	void accessScene(int sceneId); +	Scene *accessScene(int sceneId);  public: diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 3b4b3086d8..96ca7c05e6 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -23,10 +23,28 @@  #include "fullpipe/fullpipe.h"  #include "fullpipe/objects.h" +#include "fullpipe/ngiarchive.h"  namespace Fullpipe { -void FullpipeEngine::accessScene(int sceneId) { +Scene *FullpipeEngine::accessScene(int sceneId) { +	SceneTag *t = 0; + +	for (SceneTagList::iterator s = _gameProject->_sceneTagList->begin(); s != _gameProject->_sceneTagList->end(); ++s) { +		if (s->_sceneId == sceneId) { +			t = &(*s); +			break; +		} +	} + +	if (!t) +		return 0; + +	if (!t->_scene) { +		t->loadScene(); +	} + +	return t->_scene;  }  bool SceneTagList::load(MfcArchive &file) { @@ -63,4 +81,31 @@ SceneTag::~SceneTag() {  	free(_tag);  } +void SceneTag::loadScene() { +	char *archname = genFileName(0, _sceneId, "nl"); + +	Common::Archive *arch = makeNGIArchive(archname); + +	char *fname = genFileName(0, _sceneId, "sc"); + +	Common::SeekableReadStream *file = arch->createReadStreamForMember(fname); + +	_scene = new Scene(); + +	//_scene->load(*file); + +	delete file; + +	free(fname); +	free(archname); + +} + +Scene::Scene() { +} + +bool Scene::load(MfcArchive &file) { +	return true; +} +  } // End of namespace Fullpipe diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index ee2ddd982b..d049267ad4 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -25,11 +25,29 @@  namespace Fullpipe { +class Scene : public CObject { +	Background bg; +	CPtrList staticANIObjectList1; +	CPtrList staticANIObjectList2; +	CPtrList messageQueueList; +	CPtrList faObjectList; +	Shadows *shadows; +	int soundList; +	int16 sceneId; +	int stringObj; +	int field_BC; +	int libHandle; + +  public: +	Scene(); +	virtual bool load(MfcArchive &file); +}; +  class SceneTag : public CObject {   public:  	int _field_4;  	char *_tag; -	int _scene; +	Scene *_scene;  	int16 _sceneId;  	int16 _field_12; @@ -38,6 +56,7 @@ class SceneTag : public CObject {  	~SceneTag();  	virtual bool load(MfcArchive &file); +	void loadScene();  };  class SceneTagList : public Common::List<SceneTag>, public CObject { @@ -45,20 +64,6 @@ class SceneTagList : public Common::List<SceneTag>, public CObject {  	virtual bool load(MfcArchive &file);  }; -class Scene { -	Background bg; -	CPtrList staticANIObjectList1; -	CPtrList staticANIObjectList2; -	CPtrList messageQueueList; -	CPtrList faObjectList; -	Shadows *shadows; -	int soundList; -	int16 sceneId; -	int stringObj; -	int field_BC; -	int libHandle; -}; -  } // End of namespace Fullpipe  #endif /* FULLPIPE_SCENE_H */ diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index a85e7f3c0c..ea3655e763 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -91,6 +91,8 @@ bool CGameLoader::load(MfcArchive &file) {  	_gameProject->load(file); +	g_fullpipe->_gameProject = _gameProject; +  	if (g_gameProjectVersion < 12) {  		error("Old gameProjectVersion: %d", g_gameProjectVersion);  	} diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index b3d035bf06..26c03ceeea 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -285,4 +285,16 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {  	return res;  } +char *genFileName(int superId, int sceneId, const char *ext) { +	char *s = (char *)calloc(256, 1); + +	if (superId) { +		snprintf(s, 255, "%04d%04d.%s", superId, sceneId, ext); +	} else { +		snprintf(s, 255, "%04d.%s", sceneId, ext); +	} + +	return s; +} +  } // End of namespace Fullpipe diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 88a06417cf..409c5ded1a 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -102,6 +102,8 @@ struct CNode {  typedef Common::Array<void *> CPtrList; +char *genFileName(int superId, int sceneId, const char *ext); +  } // End of namespace Fullpipe  #endif /* FULLPIPE_UTILS_H */  | 
