aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-20 15:26:21 -0400
committerEugene Sandulenko2013-09-06 14:48:14 +0300
commit569b794bfec9b25e1f6a8bb64009840b2cc85d7f (patch)
tree950dccbe8bb09837df4f4ec898c60e04af72f67e /engines/fullpipe
parentdac4f23f8464a3a5df3feebb2b74297df6a01c11 (diff)
downloadscummvm-rg350-569b794bfec9b25e1f6a8bb64009840b2cc85d7f.tar.gz
scummvm-rg350-569b794bfec9b25e1f6a8bb64009840b2cc85d7f.tar.bz2
scummvm-rg350-569b794bfec9b25e1f6a8bb64009840b2cc85d7f.zip
FULLPIPE: Continued work on Inventory
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/fullpipe.cpp5
-rw-r--r--engines/fullpipe/fullpipe.h7
-rw-r--r--engines/fullpipe/inventory.cpp24
-rw-r--r--engines/fullpipe/inventory.h5
-rw-r--r--engines/fullpipe/objects.h2
-rw-r--r--engines/fullpipe/stateloader.cpp8
6 files changed, 49 insertions, 2 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 406a6fdc48..1aa4f6c8c9 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -38,6 +38,7 @@ int g_gameProjectVersion = 0;
int g_gameProjectValue = 0;
int g_scrollSpeed = 0;
int g_currSoundListCount = 0;
+FullpipeEngine *g_fullpipe = 0;
FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
// Setup mixer
@@ -50,6 +51,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_rnd = new Common::RandomSource("fullpipe");
+ g_fullpipe = this;
}
FullpipeEngine::~FullpipeEngine() {
@@ -238,4 +240,7 @@ void FullpipeEngine::setObjectState(const char *name, int state) {
var->setSubVarAsInt(name, state);
}
+void FullpipeEngine::accessScene(int sceneId) {
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 92c0052d68..52c0fd89a1 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -45,6 +45,7 @@ enum FullpipeGameFeatures {
class CGameLoader;
class CGameVar;
+class CInventory2;
extern int g_gameProjectVersion;
extern int g_gameProjectValue;
@@ -89,9 +90,13 @@ public:
CGameVar *_swallowedEgg2;
CGameVar *_swallowedEgg3;
+ CInventory2 *_inventory;
+
void setObjectState(const char *name, int state);
int getObjectEnumState(const char *name, const char *state);
+ void accessScene(int sceneId);
+
public:
bool _isSaveAllowed;
@@ -101,6 +106,8 @@ public:
};
+extern FullpipeEngine *g_fullpipe;
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_H */
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 588b465415..877f260e57 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -47,7 +47,10 @@ bool CInventory::load(MfcArchive &file) {
}
int CInventory::getInventoryPoolItemIndexById(int itemId) {
- for (int i = 0; i < _itemsPool.size(); i++) {
+ if (_itemsPool.size() <= 0)
+ return -1;
+
+ for (uint i = 0; i < _itemsPool.size(); i++) {
if (_itemsPool[i].id == itemId)
return i;
}
@@ -55,6 +58,17 @@ int CInventory::getInventoryPoolItemIndexById(int itemId) {
return 0;
}
+bool CInventory::setItemFlags(int itemId, int flags) {
+ int idx = getInventoryPoolItemIndexById(itemId);
+
+ if (idx < 0)
+ return false;
+ else
+ _itemsPool[idx].flags = flags;
+
+ return true;
+}
+
CInventory2::CInventory2() {
_selectedId = -1;
_field_48 = -1;
@@ -78,4 +92,12 @@ bool CInventory2::loadPartial(MfcArchive &file) { // CInventory2_SerializePartia
return true;
}
+void CInventory2::addItem(int itemId, int value) {
+ warning("STUB: CInventory2::addItem");
+}
+
+void CInventory2::rebuildItemRects() {
+ g_fullpipe->accessScene(_sceneId);
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index 30b23c3c98..5f0131b173 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -44,6 +44,8 @@ struct InventoryPoolItem {
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
class CInventory : public CObject {
+ friend class CInventory2;
+
int16 _sceneId;
int16 _field_6;
InventoryPoolItems _itemsPool;
@@ -53,6 +55,7 @@ class CInventory : public CObject {
virtual bool load(MfcArchive &file);
int getInventoryPoolItemIndexById(int itemId);
+ bool setItemFlags(int itemId, int flags);
};
struct InventoryItem {
@@ -92,6 +95,8 @@ class CInventory2 : public CInventory {
public:
CInventory2();
bool loadPartial(MfcArchive &file);
+ void addItem(int itemId, int value);
+ void rebuildItemRects();
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 9ef2dfe22d..d6f46f7736 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -333,6 +333,7 @@ class CGameLoader : public CObject {
virtual bool load(MfcArchive &file);
CGameVar *_gameVar;
+ CInventory2 _inventory;
private:
GameProject *_gameProject;
@@ -347,7 +348,6 @@ class CGameLoader : public CObject {
int _field_28;
int _field_2C;
CInputController _inputController;
- CInventory2 _inventory;
Sc2Array _sc2array;
void *_sceneSwitcher;
void *_preloadCallback;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index d02d6f6e75..4e9d929e52 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -27,6 +27,7 @@
#include "common/list.h"
#include "fullpipe/objects.h"
+#include "fullpipe/gameobj.h"
namespace Fullpipe {
@@ -36,6 +37,13 @@ bool FullpipeEngine::loadGam(const char *fname) {
if (_gameLoader->loadFile(fname)) {
g_currSoundListCount = 0;
initObjectStates();
+
+ //set_g_messageQueueCallback1(messageQueueCallback1);
+ //addMessageHandler2(global_messageHandler, 0, 4);
+ _inventory = &_gameLoader->_inventory;
+ _inventory->setItemFlags(ANI_INV_MAP, 0x10003);
+ _inventory->addItem(ANI_INV_MAP, 1);
+ _inventory->rebuildItemRects();
// TODO
} else
return false;