aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2009-12-05 07:47:01 +0000
committerPaul Gilbert2009-12-05 07:47:01 +0000
commit0841063a32f6468ab099546f6dd06ae8a0f015cb (patch)
treec34a8b2b0d6cafce4b2d9d8e924d3d5213771e45 /engines
parent0e85be840547009f60f25cf8f319a730d957be72 (diff)
downloadscummvm-rg350-0841063a32f6468ab099546f6dd06ae8a0f015cb.tar.gz
scummvm-rg350-0841063a32f6468ab099546f6dd06ae8a0f015cb.tar.bz2
scummvm-rg350-0841063a32f6468ab099546f6dd06ae8a0f015cb.zip
Added a new variation to the 'object' command to add an object to the player's inventory
svn-id: r46267
Diffstat (limited to 'engines')
-rw-r--r--engines/m4/console.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 99540743e9..1f58101851 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -304,7 +304,7 @@ bool Console::cmdObject(int argc, const char **argv) {
if (_vm->isM4()) {
DebugPrintf("Command not implemented for M4 games\n");
} else if (argc == 1) {
- DebugPrintf("Usage: object ['list' | '#objnum']\n");
+ DebugPrintf("Usage: object ['list' | '#objnum' | 'add #objnum']\n");
} else if (!strcmp(argv[1], "list")) {
// List of objects
for (uint objStart = 0; objStart < _vm->_globals->getObjectsSize(); objStart += 5) {
@@ -319,16 +319,29 @@ bool Console::cmdObject(int argc, const char **argv) {
}
DebugPrintf("\n");
+ } else if (!strcmp(argv[1], "add") && (argc == 3)) {
+ // Add the specified object to the player's inventory
+ int objNum = strToInt(argv[2]);
+
+ if ((objNum < 0) || (objNum >= (int)_vm->_globals->getObjectsSize()))
+ DebugPrintf("Invalid object specified\n");
+ else if (_vm->isM4())
+ DebugPrintf("Not implemented for M4 games\n");
+ else {
+ _vm->_scene->getMadsInterface()->addObjectToInventory(objNum);
+ return false;
+ }
+
} else {
// Print the details of a specific object
- int id = strToInt(argv[1]);
+ int objNum = strToInt(argv[1]);
- if ((id < 0) || (id >= (int)_vm->_globals->getObjectsSize()))
+ if ((objNum < 0) || (objNum >= (int)_vm->_globals->getObjectsSize()))
DebugPrintf("Invalid object specified\n");
else {
- const MadsObject *obj = _vm->_globals->getObject(id);
+ const MadsObject *obj = _vm->_globals->getObject(objNum);
- DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", id, _vm->_globals->getVocab(obj->descId),
+ DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", objNum, _vm->_globals->getVocab(obj->descId),
obj->roomNumber, (int)obj->article, englishMADSArticleList[obj->article], obj->vocabCount);
if (obj->vocabCount > 0) {