diff options
author | Eugene Sandulenko | 2013-08-26 14:22:59 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:20 +0300 |
commit | d8bc218ce81ec7d24015bcb9a118e33aa244f225 (patch) | |
tree | aa7885c6c27c7a6a67f55651744297d2b01337a6 /engines | |
parent | 624309b0db913ab15ce58992603ab76c9f53598d (diff) | |
download | scummvm-rg350-d8bc218ce81ec7d24015bcb9a118e33aa244f225.tar.gz scummvm-rg350-d8bc218ce81ec7d24015bcb9a118e33aa244f225.tar.bz2 scummvm-rg350-d8bc218ce81ec7d24015bcb9a118e33aa244f225.zip |
FULLPIPE: More work on global_messageHandler3()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/interaction.h | 1 | ||||
-rw-r--r-- | engines/fullpipe/inventory.cpp | 36 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 7 | ||||
-rw-r--r-- | engines/fullpipe/scenes.cpp | 58 |
4 files changed, 67 insertions, 35 deletions
diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h index f86e8e9405..a0bd54b704 100644 --- a/engines/fullpipe/interaction.h +++ b/engines/fullpipe/interaction.h @@ -55,6 +55,7 @@ class CInteraction : public CObject { }; class CInteractionController : public CObject { + public: CObList _interactions; int16 _field_20; bool _flag24; diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 9384cb2463..adfbf664a2 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -25,6 +25,7 @@ #include "fullpipe/utils.h" #include "fullpipe/inventory.h" #include "fullpipe/gameloader.h" +#include "fullpipe/statics.h" namespace Fullpipe { @@ -101,6 +102,41 @@ void CInventory2::addItem(int itemId, int count) { _inventoryItems.push_back(new InventoryItem(itemId, count)); } +void CInventory2::addItem2(StaticANIObject *obj) { + if (getInventoryPoolItemIndexById(obj->_id) >= 0 && getInventoryPoolItemFieldCById(obj->_id) != 2) { + addItem(obj->_id, 1); + obj->hide(); + } +} + +void CInventory2::removeItem(int itemId, int count) { + warning("STUB: CInventory2::removeItem(%d, %d)", itemId, count); +} + +void CInventory2::removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority) { + warning("STUB: void removeItem2(sc, %d, %d, %d, %d)", itemId, x, y, priority); +} + +int CInventory2::getCountItemsWithId(int itemId) { + int res = 0; + + for (uint i = 0; i < _inventoryItems.size(); i++) { + if (_inventoryItems[i]->itemId == itemId) + res += _inventoryItems[i]->count; + } + + return res; +} + +int CInventory2::getInventoryPoolItemFieldCById(int itemId) { + for (uint i = 0; i < _itemsPool.size(); i++) { + if (_itemsPool[i]->id == itemId) + return _itemsPool[i]->field_C; + } + + return 0; +} + void CInventory2::rebuildItemRects() { _scene = g_fullpipe->accessScene(_sceneId); diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 902ecffeb6..8d72ffc8be 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -97,6 +97,13 @@ class CInventory2 : public CInventory { CInventory2(); bool loadPartial(MfcArchive &file); void addItem(int itemId, int count); + void addItem2(StaticANIObject *obj); + void removeItem(int itemId, int count); + void removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority); + + int getInventoryPoolItemFieldCById(int itemId); + int getCountItemsWithId(int itemId); + void rebuildItemRects(); Scene *getScene() { return _scene; } diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index ecbb8090e6..7f9e6bfacf 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -903,7 +903,7 @@ int global_messageHandler2(ExCommand *cmd) { } int global_messageHandler3(ExCommand *cmd) { - result = 0; + int result = 0; if (cmd->_messageKind == 17) { switch (cmd->_messageNum) { @@ -920,6 +920,8 @@ int global_messageHandler3(ExCommand *cmd) { } } + StaticANIObject *ani, *ani2; + switch (cmd->_messageKind) { case 17: switch (cmd->_messageNum) { @@ -941,7 +943,7 @@ int global_messageHandler3(ExCommand *cmd) { g_fullpipe->_msgY = 0; g_fullpipe->_msgObjectId2 = 0; g_fullpipe->_msgId = 0; - if (cmd->_keyCode & 1 || cmd->_keyCode & 2) { + if ((cmd->_keyCode & 1) || (cmd->_keyCode & 2)) { g_fullpipe->_msgX = cmd->_x; g_fullpipe->_msgY = cmd->_y; } @@ -951,7 +953,7 @@ int global_messageHandler3(ExCommand *cmd) { } return result; case 29: - if (g_fullpipe->_gameLoader->interactionController->_flag24 && g_fullpipe->_currentScene) { + if (g_fullpipe->_gameLoader->_interactionController->_flag24 && g_fullpipe->_currentScene) { ani = g_fullpipe->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); ani2 = g_fullpipe->_currentScene->getStaticANIObject1ById(getGameLoaderFieldFA(), -1); if (ani) { @@ -964,8 +966,8 @@ int global_messageHandler3(ExCommand *cmd) { return 1; } } else { - ani2 = g_fullpipe->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); - ani = g_fullpipe->_currentScene->getPictureObjectById(ani2, 0); + int id = g_fullpipe->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + ani = g_fullpipe->_currentScene->getPictureObjectById(id, 0); if (ani) { if (g_fullpipe->_msgObjectId2 == ani->_id && g_fullpipe->_msgId == ani->_okeyCode) { cmd->_messageKind = 0; @@ -979,37 +981,23 @@ int global_messageHandler3(ExCommand *cmd) { } } } - if (*((_DWORD *)getCurrSceneSc2MotionController() + 2) && cmd->cmd.msg.keyCode <= 0) { - if (g_fullpipe->_msgX != cmd->cmd.msg.sceneClickX || g_fullpipe->_msgY != cmd->cmd.msg.sceneClickY) { - v13 = getGameLoaderFieldFA(); - ani_ = Scene_getStaticANIObject1ById(g_fullpipe->_currentScene, (Objects)(unsigned __int16)v13, -1); - v15 = ani_; - if (!ani_ - || (LOBYTE(v16) = StaticANIObject_isIdle(ani_), v16) - && (v17 = v15->GameObject.flags, !(v17 & 0x80)) - && !(v17 & 0x100)) { - v18 = cmd->cmd.msg.sceneClickY; - v19 = cmd->cmd.msg.sceneClickX; - v20 = getGameLoaderFieldFA(); - result = startWalkTo(v20, -1, v19, v18, 0); + if (getCurrSceneSc2MotionController()->_isEnabled && cmd->_keyCode <= 0) { + if (g_fullpipe->_msgX != cmd->_sceneClickX || g_fullpipe->_msgY != cmd->_sceneClickY) { + ani = g_fullpipe->_currentScene->getStaticANIObject1ById(getGameLoaderFieldFA(), -1); + if (!ani || ani->isIdle() && !(ani->_flags & 0x80) && !(ani->_flags & 0x100)) { + result = startWalkTo(getGameLoaderFieldFA(), -1, cmd->_sceneClickX, cmd->_sceneClickY, 0); if (result) { - v21 = (ExCommand *)operator new(sizeof(ExCommand)); - if (v21) { - v22 = getGameLoaderFieldFA(); - v23 = ExCommand_ctor(v21, v22, 17, 64, 0, 0, 0, 1, 0, 0, 0); - } else { - v23 = 0; - } - v24 = v23->excFlags; - v23->msg.keyCode = 1; - v23->excFlags = v24 | 3; - v23->msg.x = cmd->cmd.msg.sceneClickX; - v23->msg.y = cmd->cmd.msg.sceneClickY; - ExCommand_postMessage(v23); + ExCommand *ex = new ExCommand(getGameLoaderFieldFA(), 17, 64, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = 1; + ex->_excFlags |= 3; + ex->_x = cmd->_sceneClickX; + ex->_y = cmd->_sceneClickY; + ex->postMessage(); } } - } elae { - cmd->cmd.msg.messageKind = 0; + } else { + cmd->_messageKind = 0; } } return result; @@ -1017,7 +1005,7 @@ int global_messageHandler3(ExCommand *cmd) { return result; } case 58: - input_setCursor(cmd->_keyCode); + g_fullpipe->setCursor(cmd->_keyCode); return result; case 59: setInputDisabled(1); @@ -1075,7 +1063,7 @@ int global_messageHandler3(ExCommand *cmd) { case 63: if (CObject::IsKindOf(cmd, &RTCObjstateCommand)) { result = 1; - setObjectState((char *)&cmd->objCommandName->m_pchData, cmd->value); + g_fullpipe->setObjectState(cmd->_objCommandName, cmd->_value); } return result; default: |