aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/actions.cpp
diff options
context:
space:
mode:
authorMarisa-Chan2013-11-20 11:44:43 +0000
committerMarisa-Chan2013-11-20 11:44:43 +0000
commitff541a0d021796d0c42d627dc4dcfe91c1335487 (patch)
tree9687c70a78e53cad1f78011371ee0a70806e62f2 /engines/zvision/actions.cpp
parent5ab767cb37da791aa0ca4a1354d405a7ac85f7e6 (diff)
downloadscummvm-rg350-ff541a0d021796d0c42d627dc4dcfe91c1335487.tar.gz
scummvm-rg350-ff541a0d021796d0c42d627dc4dcfe91c1335487.tar.bz2
scummvm-rg350-ff541a0d021796d0c42d627dc4dcfe91c1335487.zip
ZVISION: Impliment inventory functions and ActionInventory.
Diffstat (limited to 'engines/zvision/actions.cpp')
-rw-r--r--engines/zvision/actions.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp
index f540e3e34a..5568e39bdb 100644
--- a/engines/zvision/actions.cpp
+++ b/engines/zvision/actions.cpp
@@ -156,6 +156,55 @@ bool ActionEnableControl::execute() {
return true;
}
+//////////////////////////////////////////////////////////////////////////////
+// ActionInventory
+//////////////////////////////////////////////////////////////////////////////
+
+ActionInventory::ActionInventory(ZVision *engine, const Common::String &line) :
+ ResultAction(engine) {
+ char buf[25];
+ sscanf(line.c_str(), "%*[^(](%25s %d)", buf, &_key);
+
+ if (strcmp(buf, "add") == 0) {
+ _type = 0;
+ } else if (strcmp(buf, "addi") == 0) {
+ _type = 1;
+ } else if (strcmp(buf, "drop") == 0) {
+ _type = 2;
+ } else if (strcmp(buf, "dropi") == 0) {
+ _type = 3;
+ } else if (strcmp(buf, "cycle") == 0) {
+ _type = 4;
+ }
+
+}
+
+bool ActionInventory::execute() {
+ switch (_type) {
+ case 0: // add
+ _engine->getScriptManager()->invertory_add(_key);
+ break;
+ case 1: // addi
+ _engine->getScriptManager()->invertory_add(_engine->getScriptManager()->getStateValue(_key));
+ break;
+ case 2: // drop
+ if (_key >= 0)
+ _engine->getScriptManager()->invertory_drop(_key);
+ else
+ _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem));
+ break;
+ case 3: // dropi
+ _engine->getScriptManager()->invertory_drop(_engine->getScriptManager()->getStateValue(_key));
+ break;
+ case 4: // cycle
+ _engine->getScriptManager()->invertory_cycle();
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
//////////////////////////////////////////////////////////////////////////////
// ActionKill