[Scummvm-git-logs] scummvm master -> d70bdfa033378b976824a738bc95f3ed76712997
dreammaster
paulfgilbert at gmail.com
Mon Dec 7 03:40:19 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d70bdfa033 GLK: COMPREHEND: Debugger command to allow for unlimited inventory
Commit: d70bdfa033378b976824a738bc95f3ed76712997
https://github.com/scummvm/scummvm/commit/d70bdfa033378b976824a738bc95f3ed76712997
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-12-06T19:40:03-08:00
Commit Message:
GLK: COMPREHEND: Debugger command to allow for unlimited inventory
Changed paths:
engines/glk/comprehend/debugger.cpp
engines/glk/comprehend/debugger.h
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game_opcodes.cpp
diff --git a/engines/glk/comprehend/debugger.cpp b/engines/glk/comprehend/debugger.cpp
index ba8d31c668..413356b698 100644
--- a/engines/glk/comprehend/debugger.cpp
+++ b/engines/glk/comprehend/debugger.cpp
@@ -29,7 +29,7 @@ namespace Comprehend {
Debugger *g_debugger;
-Debugger::Debugger() : Glk::Debugger() {
+Debugger::Debugger() : Glk::Debugger(), _invLimit(true) {
g_debugger = this;
registerCmd("dump", WRAP_METHOD(Debugger, cmdDump));
registerCmd("floodfills", WRAP_METHOD(Debugger, cmdFloodfills));
@@ -37,6 +37,7 @@ Debugger::Debugger() : Glk::Debugger() {
registerCmd("itemroom", WRAP_METHOD(Debugger, cmdItemRoom));
registerCmd("findstring", WRAP_METHOD(Debugger, cmdFindString));
registerCmd("draw", WRAP_METHOD(Debugger, cmdDraw));
+ registerCmd("invlimit", WRAP_METHOD(Debugger, cmdInventoryLimit));
}
Debugger::~Debugger() {
@@ -151,6 +152,16 @@ bool Debugger::cmdDraw(int argc, const char **argv) {
}
}
+bool Debugger::cmdInventoryLimit(int argc, const char **argv) {
+ if (argc == 1) {
+ debugPrintf("invlimit on|off\n");
+ } else {
+ _invLimit = !strcmp(argv[1], "on") || !strcmp(argv[1], "true");
+ debugPrintf("inventory limit is now %s\n", _invLimit ? "on" : "off");
+ }
+
+ return true;
+}
} // namespace Comprehend
} // namespace Glk
diff --git a/engines/glk/comprehend/debugger.h b/engines/glk/comprehend/debugger.h
index 25129ec760..6e5a3c6a7e 100644
--- a/engines/glk/comprehend/debugger.h
+++ b/engines/glk/comprehend/debugger.h
@@ -61,9 +61,16 @@ private:
*/
bool cmdDraw(int argc, const char **argv);
+ /**
+ * Flags whether to turn the inventory limit on or off
+ */
+ bool cmdInventoryLimit(int argc, const char **argv);
+
protected:
void print(const char *fmt, ...) override;
+public:
+ bool _invLimit;
public:
Debugger();
virtual ~Debugger();
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 67f0df825b..20ef395fab 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -889,6 +889,9 @@ void ComprehendGame::doMovementVerb(uint verbNum) {
void ComprehendGame::weighInventory() {
_totalInventoryWeight = 0;
+ if (!g_debugger->_invLimit)
+ // Allow for an unlimited number of items in inventory
+ return;
for (int idx = _itemCount - 1; idx > 0; --idx) {
Item *item = get_item(idx);
diff --git a/engines/glk/comprehend/game_opcodes.cpp b/engines/glk/comprehend/game_opcodes.cpp
index e049f1fb64..a390fd1827 100644
--- a/engines/glk/comprehend/game_opcodes.cpp
+++ b/engines/glk/comprehend/game_opcodes.cpp
@@ -23,6 +23,7 @@
#include "glk/comprehend/game_opcodes.h"
#include "glk/comprehend/game_data.h"
#include "glk/comprehend/comprehend.h"
+#include "glk/comprehend/debugger.h"
#include "common/algorithm.h"
#include "common/textconsole.h"
@@ -471,8 +472,12 @@ void ComprehendGameV1::execute_opcode(const Instruction *instr, const Sentence *
case OPCODE_INVENTORY_FULL:
item = get_item_by_noun(noun);
- func_set_test_result(func_state, _variables[VAR_INVENTORY_WEIGHT] +
+ if (g_debugger->_invLimit)
+ func_set_test_result(func_state, _variables[VAR_INVENTORY_WEIGHT] +
(item->_flags & ITEMF_WEIGHT_MASK) > _variables[VAR_INVENTORY_LIMIT]);
+ else
+ // Allow for an unlimited number of items in inventory
+ func_set_test_result(func_state, false);
break;
case OPCODE_OBJECT_NOT_PRESENT:
More information about the Scummvm-git-logs
mailing list