aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorwhiterandrek2018-06-21 18:34:43 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit278e279e8009b994c0ed00430d89485b8a67ddb2 (patch)
treed302e5928618d34f93b96b47fc418375f7cabcdd /engines
parentba161a9e2553fc18289a5b0975146ee0379e3b5a (diff)
downloadscummvm-rg350-278e279e8009b994c0ed00430d89485b8a67ddb2.tar.gz
scummvm-rg350-278e279e8009b994c0ed00430d89485b8a67ddb2.tar.bz2
scummvm-rg350-278e279e8009b994c0ed00430d89485b8a67ddb2.zip
PINK: added commands to manipulate inventory
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/console.cpp23
-rw-r--r--engines/pink/console.h3
-rw-r--r--engines/pink/objects/inventory.h2
3 files changed, 28 insertions, 0 deletions
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp
index ead4cf3832..43002b80ff 100644
--- a/engines/pink/console.cpp
+++ b/engines/pink/console.cpp
@@ -24,6 +24,7 @@
#include "pink/pink.h"
#include "pink/objects/module.h"
#include "pink/objects/pages/game_page.h"
+#include "pink/objects/actors/lead_actor.h"
namespace Pink {
@@ -43,6 +44,9 @@ Console::Console(PinkEngine *vm)
registerCmd("listPageVars", WRAP_METHOD(Console, Cmd_ListPageVars));
registerCmd("setPageVar", WRAP_METHOD(Console, Cmd_SetPageVar));
+
+ registerCmd("listItems", WRAP_METHOD(Console, Cmd_ListItems));
+ registerCmd("addItem", WRAP_METHOD(Console, Cmd_addItem));
}
bool Console::Cmd_ListModules(int argc, const char **argv) {
@@ -148,4 +152,23 @@ bool Console::Cmd_SetPageVar(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_ListItems(int argc, const char **argv) {
+ const Common::Array<InventoryItem*> &items = _vm->_module->_invMgr._items;
+ for (uint i = 0; i < items.size(); ++i) {
+ debugPrintf("%s\n", items[i]->getName().c_str());
+ }
+ return true;
+}
+
+bool Console::Cmd_addItem(int argc, const char **argv) {
+ if (argc != 2) {
+ debugPrintf("Usage: %s item\n", argv[0]);
+ return true;
+ }
+ InventoryMgr *inv = &_vm->_module->_invMgr;
+ LeadActor *actor = _vm->_actor;
+ inv->setItemOwner(actor->getName(), inv->findInventoryItem(argv[1]));
+ return true;
+}
+
} // End of namespace Pink
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 85e287fcd9..6b9b335fd5 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -51,6 +51,9 @@ private:
bool Cmd_ListPageVars(int argc, const char **argv);
bool Cmd_SetPageVar(int argc, const char **argv);
+ bool Cmd_ListItems(int argc, const char **argv);
+ bool Cmd_addItem(int argc, const char **argv);
+
private:
PinkEngine *_vm;
};
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index 15c21bf153..ca0e8a712b 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -69,6 +69,8 @@ public:
InventoryItem *getCurrentItem() { return _item; }
+ friend class Console;
+
private:
void close();
enum Direction {