diff options
author | Eugene Sandulenko | 2013-08-24 21:07:16 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:19 +0300 |
commit | 3e4670e6be0b0ea77044355cb1d2c25704564cd1 (patch) | |
tree | 11babe089ec1a536f21f83e7ddcef6eddc326597 /engines | |
parent | 1261cd421d176d6caa7230c5cf726b08e04ff25f (diff) | |
download | scummvm-rg350-3e4670e6be0b0ea77044355cb1d2c25704564cd1.tar.gz scummvm-rg350-3e4670e6be0b0ea77044355cb1d2c25704564cd1.tar.bz2 scummvm-rg350-3e4670e6be0b0ea77044355cb1d2c25704564cd1.zip |
FULLPIPE: Implement Scene::initObjectCursors()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 5 | ||||
-rw-r--r-- | engines/fullpipe/input.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 49 | ||||
-rw-r--r-- | engines/fullpipe/scene.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/scenes.cpp | 2 |
6 files changed, 59 insertions, 4 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 569958cf31..6f4feee865 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -132,6 +132,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _inventoryScene = 0; _inventory = 0; + _minCursorId = 0; + _isSaveAllowed = true; g_fullpipe = this; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 69a1acc700..5d4deedebf 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -53,6 +53,7 @@ struct CursorInfo; class EntranceInfo; class ExCommand; class GameProject; +class GameObject; class GlobalMessageQueueList; class MessageHandler; struct MovTable; @@ -198,7 +199,11 @@ public: int (*_updateCursorCallback)(); int _cursorId; + int _minCursorId; + Common::Array<int> _objectIdCursors; + void setCursor(int id); + void updateCursorsCommon(); int getObjectState(const char *objname); void setObjectState(const char *name, int state); diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index b649c013f8..64fd0d5d15 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -117,4 +117,8 @@ void FullpipeEngine::defHandleKeyDown(int key) { warning("STUB: FullpipeEngine::defHandleKeyDown(%d)", key); } +void FullpipeEngine::updateCursorsCommon() { + +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 806145504f..c413779963 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -26,6 +26,7 @@ #include "fullpipe/ngiarchive.h" #include "fullpipe/statics.h" #include "fullpipe/messages.h" +#include "fullpipe/gameloader.h" #include "fullpipe/constants.h" @@ -326,7 +327,7 @@ void Scene::setPictureObjectsFlag4() { } PictureObject *Scene::getPictureObjectById(int objId, int flags) { - for (uint i = 1; i < _picObjList.size(); i++) { + for (uint i = 0; i < _picObjList.size(); i++) { if (((PictureObject *)_picObjList[i])->_id == objId && ((PictureObject *)_picObjList[i])->_okeyCode == flags) return (PictureObject *)_picObjList[i]; } @@ -334,6 +335,15 @@ PictureObject *Scene::getPictureObjectById(int objId, int flags) { return 0; } +PictureObject *Scene::getPictureObjectByName(const char *objName, int flags) { + for (uint i = 0; i < _picObjList.size(); i++) { + if (!strcmp(((PictureObject *)_picObjList[i])->_objectName, objName) && ((PictureObject *)_picObjList[i])->_okeyCode == flags || flags == -1) + return (PictureObject *)_picObjList[i]; + } + + return 0; +} + void Scene::deletePictureObject(PictureObject *obj) { for (uint i = 0; i < _picObjList.size(); i++) { if (((PictureObject *)_picObjList[i]) == obj) { @@ -386,8 +396,41 @@ void Scene::preloadMovements(CGameVar *var) { } } -void Scene::initObjectCursors(const char *name) { - warning("STUB: Scene::initObjectCursors(%s)", name); +void Scene::initObjectCursors(const char *varname) { + CGameVar *cursorsVar = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("CURSORS"); + + if (!cursorsVar || !cursorsVar->_subVars) + return; + + int maxId = 0; + int minId = 0xffff; + + for (CGameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) { + GameObject *obj = getPictureObjectByName(sub->_varName, -1); + + if (obj || (obj = getStaticANIObject1ByName(sub->_varName, -1)) != 0) { + if (obj->_id < minId) + minId = obj->_id; + if (obj->_id > maxId) + maxId = obj->_id; + } + } + + g_fullpipe->_minCursorId = minId; + + g_fullpipe->_objectIdCursors.resize(maxId - minId + 1); + + for (CGameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) { + GameObject *obj = getPictureObjectByName(sub->_varName, -1); + + if (!obj) + obj = getStaticANIObject1ByName(sub->_varName, -1); + + PictureObject *pic = getGameLoaderInventory()->getScene()->getPictureObjectByName(sub->_value.stringValue, -1); + + if (obj && pic) + g_fullpipe->_objectIdCursors[obj->_id - minId] = pic->_id; + } } bool Scene::compareObjPriority(const void *p1, const void *p2) { diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 9c57bcbc10..d1a5b39721 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -67,6 +67,7 @@ class Scene : public Background { void setPictureObjectsFlag4(); PictureObject *getPictureObjectById(int objId, int flags); + PictureObject *getPictureObjectByName(const char *name, int keyCode); void deletePictureObject(PictureObject *obj); void preloadMovements(CGameVar *var); diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 30cb3a8e36..2916a4082f 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -1137,7 +1137,7 @@ int global_messageHandler4(ExCommand *cmd) { } int defaultUpdateCursor() { - warning("STUB: defaultUpdateCursor"); + g_fullpipe->updateCursorsCommon(); return g_fullpipe->_cursorId; } |