[Scummvm-git-logs] scummvm master -> fdfede64ca258d73b6de09c9334c7bc8ce2a3b65
somaen
noreply at scummvm.org
Thu May 26 21:08:56 UTC 2022
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:
fdfede64ca TINSEL: Add debug commands to add all clues, as well as listing them.
Commit: fdfede64ca258d73b6de09c9334c7bc8ce2a3b65
https://github.com/scummvm/scummvm/commit/fdfede64ca258d73b6de09c9334c7bc8ce2a3b65
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-05-26T23:08:35+02:00
Commit Message:
TINSEL: Add debug commands to add all clues, as well as listing them.
At the same time, name the NOTEBOOK_CLUE attribute appropriately
Changed paths:
engines/tinsel/debugger.cpp
engines/tinsel/debugger.h
engines/tinsel/dialogs.cpp
engines/tinsel/dialogs.h
engines/tinsel/inv_objects.h
engines/tinsel/noir/notebook.cpp
diff --git a/engines/tinsel/debugger.cpp b/engines/tinsel/debugger.cpp
index 09fbbb1cc6c..6eb51a1ef11 100644
--- a/engines/tinsel/debugger.cpp
+++ b/engines/tinsel/debugger.cpp
@@ -64,7 +64,9 @@ int strToInt(const char *s) {
Console::Console() : GUI::Debugger() {
if (TinselVersion == 3) {
registerCmd("add_clue", WRAP_METHOD(Console, cmd_add_clue));
+ registerCmd("add_all_clues", WRAP_METHOD(Console, cmd_add_all_clues));
registerCmd("cross_clue", WRAP_METHOD(Console, cmd_cross_clue));
+ registerCmd("list_clues", WRAP_METHOD(Console, cmd_list_clues));
}
registerCmd("item", WRAP_METHOD(Console, cmd_item));
registerCmd("scene", WRAP_METHOD(Console, cmd_scene));
@@ -177,6 +179,14 @@ bool Console::cmd_add_clue(int argc, const char **argv) {
return false;
}
+bool Console::cmd_add_all_clues(int argc, const char **argv) {
+ auto clues = _vm->_dialogs->GetAllNotebookClues();
+ for (auto clue : clues) {
+ _vm->_notebook->AddClue(clue);
+ }
+ return false;
+}
+
bool Console::cmd_cross_clue(int argc, const char **argv) {
if (argc < 2) {
debugPrintf("%s clue_id\n", argv[0]);
@@ -188,4 +198,12 @@ bool Console::cmd_cross_clue(int argc, const char **argv) {
return false;
}
+bool Console::cmd_list_clues(int argc, const char **argv) {
+ auto clues = _vm->_dialogs->GetAllNotebookClues();
+ for (auto clue : clues) {
+ debugPrintf("%d\n", clue);
+ }
+ return true;
+}
+
} // End of namespace Tinsel
diff --git a/engines/tinsel/debugger.h b/engines/tinsel/debugger.h
index f40d0d03e5e..2e5b52645ac 100644
--- a/engines/tinsel/debugger.h
+++ b/engines/tinsel/debugger.h
@@ -35,7 +35,9 @@ public:
private:
bool cmd_add_clue(int argc, const char **argv);
+ bool cmd_add_all_clues(int argc, const char **argv);
bool cmd_cross_clue(int argc, const char **argv);
+ bool cmd_list_clues(int argc, const char **argv);
bool cmd_item(int argc, const char **argv);
bool cmd_scene(int argc, const char **argv);
bool cmd_music(int argc, const char **argv);
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 756d0b77678..ddbb4261fc0 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -1268,7 +1268,7 @@ void Dialogs::InventoryIconCursor(bool bNewItem) {
if (TinselVersion == 3) {
auto invObj = GetInvObject(_heldItem);
- if (invObj->hasAttribute(InvObjAttr::V3ATTR_X200)) {
+ if (invObj->hasAttribute(InvObjAttr::NOTEBOOK_CLUE)) {
_heldFilm = _vm->_systemReel->Get((SysReel)objIndex);
} else {
_heldFilm = _invFilms[objIndex];
@@ -1720,7 +1720,7 @@ void Dialogs::HoldItem(int item, bool bKeepFilm) {
else if (invObj->hasAttribute(InvObjAttr::DEFINV2))
AddToInventory(INV_2, _heldItem);
else {
- if ((TinselVersion < 3) || (!(invObj->hasAttribute(InvObjAttr::V3ATTR_X200)) && !(invObj->hasAttribute(InvObjAttr::V3ATTR_X400)))) {
+ if ((TinselVersion < 3) || (!(invObj->hasAttribute(InvObjAttr::NOTEBOOK_CLUE)) && !(invObj->hasAttribute(InvObjAttr::V3ATTR_X400)))) {
// Hook for definable default inventory
AddToInventory(INV_1, _heldItem);
}
@@ -5217,6 +5217,18 @@ void Dialogs::syncInvInfo(Common::Serializer &s) {
}
}
+// Let the debugger know all the available clues.
+Common::Array<int> Dialogs::GetAllNotebookClues() const {
+ Common::Array<int> clues;
+ for (int i = 0; i < _invObjects->numObjects(); i++) {
+ auto obj = _invObjects->GetObjectByIndex(i);
+ if (obj->hasAttribute(InvObjAttr::NOTEBOOK_CLUE)) {
+ clues.push_back(obj->getId());
+ }
+ }
+ return clues;
+}
+
/**************************************************************************/
/************************ Initialisation stuff ****************************/
/**************************************************************************/
diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h
index b08e4b197f5..a63cabf4724 100644
--- a/engines/tinsel/dialogs.h
+++ b/engines/tinsel/dialogs.h
@@ -295,6 +295,7 @@ public:
int StartWidth, int StartHeight, int MaxWidth, int MaxHeight);
// Noir
+ Common::Array<int> GetAllNotebookClues() const;
void idec_invMain(SCNHANDLE text, int MaxContents);
bool InventoryActive();
diff --git a/engines/tinsel/inv_objects.h b/engines/tinsel/inv_objects.h
index d736b893c74..0bf677ed343 100644
--- a/engines/tinsel/inv_objects.h
+++ b/engines/tinsel/inv_objects.h
@@ -40,7 +40,7 @@ enum class InvObjAttr {
// Noir only
V3ATTR_X80 = 0x80,
- V3ATTR_X200 = 0x200,
+ NOTEBOOK_CLUE = 0x200,
V3ATTR_X400 = 0x400,
NOTEBOOK_TITLE = 0x800, // is a notebook title
V3ATTR_X1000 = 0x1000,
diff --git a/engines/tinsel/noir/notebook.cpp b/engines/tinsel/noir/notebook.cpp
index 2fe64ec9a93..c8b5c90fbfc 100644
--- a/engines/tinsel/noir/notebook.cpp
+++ b/engines/tinsel/noir/notebook.cpp
@@ -117,6 +117,11 @@ int Notebook::AddTitle(const InventoryObjectT3 &invObject) {
}
void Notebook::AddClue(const InventoryObjectT3 &invObject) {
+ if (invObject.getUnknown() == 0) {
+ // This affects two clues, that should get special treatment.
+ warning("TODO: Handle clues with no parent page");
+ return;
+ }
// Add title if missing, otherwise just get the page it's on.
auto titleObject = _vm->_dialogs->GetInvObjectT3(invObject.getUnknown());
int pageIndex = AddTitle(*titleObject);
More information about the Scummvm-git-logs
mailing list