diff options
| author | Eugene Sandulenko | 2013-07-20 23:55:04 +0300 | 
|---|---|---|
| committer | Eugene Sandulenko | 2013-09-06 14:51:04 +0300 | 
| commit | c4499bb4b290484cd1af35f2c354e0b2897e4a62 (patch) | |
| tree | 92f2c4b8c6c307bca7fc6ce6c255174ff0aa162f | |
| parent | 62cbdd81f0843ad10fb768e8cf97222144cb8a1e (diff) | |
| download | scummvm-rg350-c4499bb4b290484cd1af35f2c354e0b2897e4a62.tar.gz scummvm-rg350-c4499bb4b290484cd1af35f2c354e0b2897e4a62.tar.bz2 scummvm-rg350-c4499bb4b290484cd1af35f2c354e0b2897e4a62.zip | |
FULLPIPE: Further work on sceneSwitcher
| -rw-r--r-- | engines/fullpipe/fullpipe.cpp | 2 | ||||
| -rw-r--r-- | engines/fullpipe/fullpipe.h | 2 | ||||
| -rw-r--r-- | engines/fullpipe/gameloader.cpp | 8 | ||||
| -rw-r--r-- | engines/fullpipe/gameloader.h | 5 | ||||
| -rw-r--r-- | engines/fullpipe/gfx.cpp | 38 | ||||
| -rw-r--r-- | engines/fullpipe/gfx.h | 2 | ||||
| -rw-r--r-- | engines/fullpipe/inventory.cpp | 4 | ||||
| -rw-r--r-- | engines/fullpipe/inventory.h | 2 | ||||
| -rw-r--r-- | engines/fullpipe/objects.h | 9 | ||||
| -rw-r--r-- | engines/fullpipe/scene.cpp | 14 | ||||
| -rw-r--r-- | engines/fullpipe/scene.h | 3 | ||||
| -rw-r--r-- | engines/fullpipe/scenes.cpp | 74 | ||||
| -rw-r--r-- | engines/fullpipe/stateloader.cpp | 4 | 
13 files changed, 91 insertions, 76 deletions
| diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 1d0b237e96..436eabaec6 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -61,6 +61,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)  	_needQuit = false;  	_aniMan = 0; +	_aniMan2 = 0; +	_currentScene = 0;  	_scene2 = 0;  	_globalMessageQueueList = 0; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 6a10f231ee..5050e1c2e6 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -95,8 +95,10 @@ public:  	Common::Rect _sceneRect;  	int _sceneWidth;  	int _sceneHeight; +	Scene *_currentScene;  	Scene *_scene2;  	StaticANIObject *_aniMan; +	StaticANIObject *_aniMan2;  	SoundList *_currSoundList1[11];  	int _currSoundListCount; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 0f35fb7a72..7f38515afd 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -27,6 +27,14 @@  namespace Fullpipe { +CInventory2 *getGameLoaderInventory() { +	return &g_fullpipe->_gameLoader->_inventory; +} + +CInteractionController *getGameLoaderInteractionController() { +	return g_fullpipe->_gameLoader->_interactionController; +} +  CGameLoader::CGameLoader() {  	_interactionController = new CInteractionController(); diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 9322e458b0..a37181d5fd 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -43,10 +43,10 @@ class CGameLoader : public CObject {  	CGameVar *_gameVar;  	CInventory2 _inventory; +	CInteractionController *_interactionController;   private:  	GameProject *_gameProject; -	CInteractionController *_interactionController;  	int _field_C;  	int _field_10;  	int _field_14; @@ -71,6 +71,9 @@ class CGameLoader : public CObject {  	int _preloadId2;  }; +CInventory2 *getGameLoaderInventory(); +CInteractionController *getGameLoaderInteractionController(); +  } // End of namespace Fullpipe  #endif /* FULLPIPE_GAMELOADER_H */ diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 5f6d75b33b..fb9466177c 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -95,7 +95,7 @@ bool Background::load(MfcArchive &file) {  void Background::addPictureObject(PictureObject *pct) {  	if (pct->_field_4) -		renumPictures(pct); +		pct->renumPictures(&_picObjList);  	bool inserted = false;  	for (uint i = 0; i < _picObjList.size(); i++) { @@ -111,24 +111,6 @@ void Background::addPictureObject(PictureObject *pct) {  	}  } -void Background::renumPictures(PictureObject *pct) { -	int *buf = (int *)calloc(_picObjList.size() + 2, sizeof(int)); - -	for (uint i = 0; i < _picObjList.size(); i++) { -		if (pct->_id == ((PictureObject *)_picObjList[i])->_id) -			buf[((PictureObject *)_picObjList[i])->_field_4] = 1; -	} -	 -	if (buf[pct->_field_4]) { -		uint count; -		for (count = 1; buf[count] && count < _picObjList.size() + 2; count++) -			; -		pct->_field_4 = count; -	} - -	free(buf); -} -  PictureObject::PictureObject() {  	_ox = 0;  	_oy = 0; @@ -205,6 +187,24 @@ void GameObject::setOXY(int x, int y) {  	_oy = y;  } +void GameObject::renumPictures(CPtrList *lst) { +	int *buf = (int *)calloc(lst->size() + 2, sizeof(int)); + +	for (uint i = 0; i < lst->size(); i++) { +		if (_id == ((PictureObject *)((*lst)[i]))->_id) +			buf[((PictureObject *)((*lst)[i]))->_field_4] = 1; +	} + +	if (buf[_field_4]) { +		uint count; +		for (count = 1; buf[count] && count < lst->size() + 2; count++) +			; +		_field_4 = count; +	} + +	free(buf); +} +  Picture::Picture() {  	_x = 0;  	_y = 0; diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 3340b20e7c..7eea54241c 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -109,6 +109,7 @@ class GameObject : public CObject {  	GameObject();  	virtual bool load(MfcArchive &file);  	void setOXY(int x, int y); +	void renumPictures(CPtrList *lst);  };  class PictureObject : public GameObject { @@ -143,7 +144,6 @@ class Background : public CObject {  	Background();  	virtual bool load(MfcArchive &file);  	void addPictureObject(PictureObject *pct); -	void renumPictures(PictureObject *pct);  };  class Shadows : public CObject { diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 5ee85aab02..0480753bc2 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -28,10 +28,6 @@  namespace Fullpipe { -CInventory2 *getGameLoaderInventory() { -	return &g_fullpipe->_gameLoader->_inventory; -} -  bool CInventory::load(MfcArchive &file) {  	debug(5, "CInventory::load()"); diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 7991e2f3eb..36170b86bf 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -103,8 +103,6 @@ class CInventory2 : public CInventory {  }; -CInventory2 *getGameLoaderInventory(); -  } // End of namespace Fullpipe  #endif /* FULLPIPE_INVENTORY_H */ diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index 57f96b76c0..48bb5838e6 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -68,12 +68,17 @@ class CInteraction : public CObject {  class CInteractionController : public CObject {  	CObList _interactions;  	int16 _field_20; -	int _flag24; +	bool _flag24;   public: -	CInteractionController() : _field_20(0), _flag24(1) {} +	CInteractionController() : _field_20(0), _flag24(true) {}  	virtual bool load(MfcArchive &file); + +	void enableFlag24() { _flag24 = true; } +	void disableFlag24() { _flag24 = false; } + +	void sortInteractions(int sceneId);  };  class CInputControllerItemArray { diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index dec89119bf..ab4f817373 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -269,6 +269,20 @@ void Scene::deleteStaticANIObject(StaticANIObject *obj) {  		}  } +void Scene::addStaticANIObject(StaticANIObject *obj, bool addList2) { +	if (obj->_field_4) +		obj->renumPictures(&_staticANIObjectList1); + +	_staticANIObjectList1.push_back(obj); + +	if (addList2) { +		if (!obj->_field_4) +			obj->clearFlags(); + +		_staticANIObjectList2.push_back(obj); +	} +} +  void Scene::draw(int par) {  	updateScrolling(par); diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 82041439cd..ac47d7e0ef 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -52,7 +52,8 @@ class Scene : public Background {  	void updateScrolling(int par);  	StaticANIObject *getAniMan();  	StaticANIObject *getStaticANIObject1ById(int obj, int a3); -	void deleteStaticANIObject(StaticANIObject * obj); +	void deleteStaticANIObject(StaticANIObject *obj); +	void addStaticANIObject(StaticANIObject *obj, bool addList2);  };  class SceneTag : public CObject { diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index e3ebc22b80..b79f32f6e3 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -36,17 +36,6 @@ namespace Fullpipe {  bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {  	CGameVar *sceneVar; -	int v12; -	int v13; -	Scene *v14; -	int v15; -	int v16; -	int v17; -	int v18; -	CNode *v19; -	CNode *v20; -	Scene *v21; -	PictureObject *v22;  	Common::Point sceneDim;  	Scene *scene = accessScene(entrance->_sceneId); @@ -100,48 +89,40 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {  		}  	} +	getGameLoaderInteractionController()->sortInteractions(scene->_sceneId); +	_currentScene = scene; +	scene->addStaticANIObject(_aniMan, 1); +	_scene2 = scene; +	_aniMan->_movementObj = 0; +	_aniMan->_staticsObj = _aniMan->getStaticsById(ST_MAN_EMPTY); +	_aniMan->setOXY(0, 0); +  #if 0 -	v12 = scene->sceneId; -	v13 = (int)getGameLoaderInteractionController(); -	CInteractionController_sortInteractions(v13, v12); -	v14 = g_currentScene; -	g_currentScene = v4; -	Scene_addStaticANIObject(scene, (int)g_aniMan, 1); -	g_scene2 = v4; -	g_aniMan->movementObj = 0; -	g_aniMan->staticsObj = StaticANIObject_getStaticsById(g_aniMan, ST_MAN_EMPTY); -	(*(void (__stdcall **)(_DWORD))(g_aniMan->GameObject.CObject.vmt + 24))(0); -	if (g_aniMan) { -		g_aniMan2 = (int)g_aniMan; -		v15 = getSc2MotionControllerBySceneId(LOWORD(entrance->sceneId)); -		initMovGraph2((void *)v15); -		v16 = getSc2MotionControllerBySceneId(LOWORD(entrance->sceneId)); -		(*(void (__thiscall **)(int, StaticANIObject *))(*(_DWORD *)v16 + offsetof(CMotionControllerVmt, addObject)))(v16, g_aniMan); -		v17 = getSc2MotionControllerBySceneId(LOWORD(entrance->sceneId)); -		(*(void (__thiscall **)(int))(*(_DWORD *)v17 + offsetof(CMotionControllerVmt, setField8)))(v17); -		v18 = (int)getGameLoaderInteractionController(); -		CInteractionController_enableFlag24(v18); +	if (_aniMan) { +		_aniMan2 = _aniMan; +		getSc2MotionControllerBySceneId(entrance->_sceneId)->initMovGraph2(); +		getSc2MotionControllerBySceneId(entrance->_sceneId)->addObject(_aniMan); +		getSc2MotionControllerBySceneId(entrance->_sceneId)->setEnabled(); +		getGameLoaderInteractionController()->enableFlag24();  		input_setInputDisabled(0);  	} else { -		g_aniMan2 = 0; +		_aniMan2 = 0;  	} -	g_currentScene = v14; -	Scene_setPictureObjectsFlag4((int)scene); -	if (scene->staticANIObjectList1.m_nCount) { -		v19 = scene->staticANIObjectList1.m_pNodeHead; -		while (v19) { -			v20 = v19; -			v19 = v19->pNext; -			GameObject_setFlags((GameObject *)v20->data, *((_WORD *)v20->data + 6) & 0xFE7F); -		} + +	scene->setPictureObjectsFlag4(); + +	for (CPtrList::iterator s = scene->_staticANIObjectList1.begin(); s != scene->_staticANIObjectList1.end(); ++s) { +		StaticANIObject *o = (StaticANIObject *)s; +		o->setFlags(o->field_6 & 0xFE7F);  	} -	v21 = accessScene(SC_INV); -	v22 = Scene_getPictureObjectById(v21, PIC_INV_MENU, 0); -	GameObject_setFlags(&v22->GameObject, v22->GameObject.flags & 0xFFFB); + +	PictureObject *p = accessScene(SC_INV)->getPictureObjectById(PIC_INV_MENU, 0); +	p->setFlags(p->_flags & 0xFFFB); +  	removeMessageHandler(2, -1); -	g_updateScreenCallback = 0; +	_updateScreenCallback = 0; -	switch (entrance->sceneId) { +	switch (entrance->_sceneId) {  	case SC_INTRO1:  		sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1");  		scene->preloadMovements(sceneVar); @@ -630,6 +611,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {  		break;  	}  #endif +  	return true;  } diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 08b09918aa..c383a054e7 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -169,6 +169,10 @@ bool CInteractionController::load(MfcArchive &file) {  	return _interactions.load(file);  } +void CInteractionController::sortInteractions(int sceneId) { +	warning("STUB: CInteractionController::sortInteractions(%d)", sceneId); +} +  CInputController::CInputController() {  	// TODO  } | 
